aboutsummaryrefslogtreecommitdiffstats
path: root/Parser.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-20 04:05:47 +0800
committerChristian <c@ethdev.com>2015-01-20 06:35:04 +0800
commitaf92f98d86ba1e15e3f41ac49bb9639be1ab4e41 (patch)
treee42cff46c9701491a43e58bebd8ead5b3e5241ec /Parser.cpp
parent6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9 (diff)
downloaddexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.tar
dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.tar.gz
dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.tar.bz2
dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.tar.lz
dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.tar.xz
dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.tar.zst
dexon-solidity-af92f98d86ba1e15e3f41ac49bb9639be1ab4e41.zip
Constructor arguments for base classes.
Diffstat (limited to 'Parser.cpp')
-rw-r--r--Parser.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/Parser.cpp b/Parser.cpp
index 26fc2018..c0ca1abb 100644
--- a/Parser.cpp
+++ b/Parser.cpp
@@ -117,7 +117,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition()
docstring = make_shared<ASTString>(m_scanner->getCurrentCommentLiteral());
expectToken(Token::CONTRACT);
ASTPointer<ASTString> name = expectIdentifierToken();
- vector<ASTPointer<Identifier>> baseContracts;
+ vector<ASTPointer<InheritanceSpecifier>> baseContracts;
vector<ASTPointer<StructDefinition>> structs;
vector<ASTPointer<VariableDeclaration>> stateVariables;
vector<ASTPointer<FunctionDefinition>> functions;
@@ -125,7 +125,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition()
do
{
m_scanner->next();
- baseContracts.push_back(ASTNodeFactory(*this).createNode<Identifier>(expectIdentifierToken()));
+ baseContracts.push_back(parseInheritanceSpecifier());
}
while (m_scanner->getCurrentToken() == Token::COMMA);
expectToken(Token::LBRACE);
@@ -161,6 +161,23 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition()
stateVariables, functions);
}
+ASTPointer<InheritanceSpecifier> Parser::parseInheritanceSpecifier()
+{
+ ASTNodeFactory nodeFactory(*this);
+ ASTPointer<Identifier> name = ASTNodeFactory(*this).createNode<Identifier>(expectIdentifierToken());
+ vector<ASTPointer<Expression>> arguments;
+ if (m_scanner->getCurrentToken() == Token::LPAREN)
+ {
+ m_scanner->next();
+ arguments = parseFunctionCallArguments();
+ nodeFactory.markEndPosition();
+ expectToken(Token::RPAREN);
+ }
+ else
+ nodeFactory.setEndPositionFromNode(name);
+ return nodeFactory.createNode<InheritanceSpecifier>(name, arguments);
+}
+
ASTPointer<FunctionDefinition> Parser::parseFunctionDefinition(bool _isPublic)
{
ASTNodeFactory nodeFactory(*this);