diff options
author | Christian <c@ethdev.com> | 2015-01-28 18:28:22 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-28 18:28:22 +0800 |
commit | 34d07fc5837745ee3c8fbc571d0e2f0d02041cf1 (patch) | |
tree | 4160955c9664c0cc8f60cc621ebae5e9c4466f94 /Parser.cpp | |
parent | 5d3e21fd937940721c6c693c39d1fdc79e1f27c6 (diff) | |
download | dexon-solidity-34d07fc5837745ee3c8fbc571d0e2f0d02041cf1.tar.gz dexon-solidity-34d07fc5837745ee3c8fbc571d0e2f0d02041cf1.tar.zst dexon-solidity-34d07fc5837745ee3c8fbc571d0e2f0d02041cf1.zip |
Some fixes in parser.
Diffstat (limited to 'Parser.cpp')
-rw-r--r-- | Parser.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -167,7 +167,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition() ASTPointer<InheritanceSpecifier> Parser::parseInheritanceSpecifier() { ASTNodeFactory nodeFactory(*this); - ASTPointer<Identifier> name = ASTNodeFactory(*this).createNode<Identifier>(expectIdentifierToken()); + ASTPointer<Identifier> name(parseIdentifier()); vector<ASTPointer<Expression>> arguments; if (m_scanner->getCurrentToken() == Token::LPAREN) { @@ -283,7 +283,7 @@ ASTPointer<ModifierDefinition> Parser::parseModifierDefinition() ASTPointer<ModifierInvocation> Parser::parseModifierInvocation() { ASTNodeFactory nodeFactory(*this); - ASTPointer<Identifier> name = ASTNodeFactory(*this).createNode<Identifier>(expectIdentifierToken()); + ASTPointer<Identifier> name(parseIdentifier()); vector<ASTPointer<Expression>> arguments; if (m_scanner->getCurrentToken() == Token::LPAREN) { @@ -297,6 +297,13 @@ ASTPointer<ModifierInvocation> Parser::parseModifierInvocation() return nodeFactory.createNode<ModifierInvocation>(name, arguments); } +ASTPointer<Identifier> Parser::parseIdentifier() +{ + ASTNodeFactory nodeFactory(*this); + nodeFactory.markEndPosition(); + return nodeFactory.createNode<Identifier>(expectIdentifierToken()); +} + ASTPointer<TypeName> Parser::parseTypeName(bool _allowVar) { ASTPointer<TypeName> type; @@ -584,8 +591,8 @@ ASTPointer<Expression> Parser::parseLeftHandSideExpression() if (m_scanner->getCurrentToken() == Token::NEW) { expectToken(Token::NEW); - ASTPointer<Identifier> contractName = ASTNodeFactory(*this).createNode<Identifier>(expectIdentifierToken()); - nodeFactory.markEndPosition(); + ASTPointer<Identifier> contractName(parseIdentifier()); + nodeFactory.setEndPositionFromNode(contractName); expression = nodeFactory.createNode<NewExpression>(contractName); } else |