diff options
author | Christian <c@ethdev.com> | 2015-01-20 04:05:47 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-20 06:35:04 +0800 |
commit | af92f98d86ba1e15e3f41ac49bb9639be1ab4e41 (patch) | |
tree | e42cff46c9701491a43e58bebd8ead5b3e5241ec /Parser.cpp | |
parent | 6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9 (diff) | |
download | dexon-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.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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); |