aboutsummaryrefslogtreecommitdiffstats
path: root/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Parser.cpp')
-rw-r--r--Parser.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/Parser.cpp b/Parser.cpp
index baddbad8..d99d33ac 100644
--- a/Parser.cpp
+++ b/Parser.cpp
@@ -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