Skip to content

Commit 7107e9c

Browse files
authored
Merge pull request #122 from solidity-parser/custom-storage-layout
Add support for custom storage layout
2 parents 19324ea + d42dbad commit 7107e9c

File tree

13 files changed

+2774
-2509
lines changed

13 files changed

+2774
-2509
lines changed

antlr

src/ASTBuilder.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ export class ASTBuilder
5454

5555
this._currentContract = name
5656

57+
const customLayoutStorageList = ctx.customStorageLayout_list()
58+
if (customLayoutStorageList.length > 1) {
59+
throw new Error('Only one custom storage layout is allowed per contract')
60+
}
61+
5762
const node: AST.ContractDefinition = {
5863
type: 'ContractDefinition',
5964
name,
@@ -64,6 +69,12 @@ export class ASTBuilder
6469
kind,
6570
}
6671

72+
if (customLayoutStorageList.length === 1) {
73+
node.storageLayout = this.visitExpression(
74+
customLayoutStorageList[0].expression()
75+
)
76+
}
77+
6778
return this._addMeta(node, ctx)
6879
}
6980

src/antlr/Solidity.interp

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/antlr/Solidity.tokens

Lines changed: 135 additions & 131 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/antlr/SolidityLexer.interp

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)