aboutsummaryrefslogtreecommitdiffstats
path: root/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Parser.cpp')
-rw-r--r--Parser.cpp32
1 files changed, 3 insertions, 29 deletions
diff --git a/Parser.cpp b/Parser.cpp
index c9ab551e..1c61aab1 100644
--- a/Parser.cpp
+++ b/Parser.cpp
@@ -109,30 +109,6 @@ ASTPointer<ImportDirective> Parser::parseImportDirective()
return nodeFactory.createNode<ImportDirective>(url);
}
-void Parser::addStateVariableAccessor(ASTPointer<VariableDeclaration> const& _varDecl,
- vector<ASTPointer<FunctionDefinition>> & _functions)
-{
- ASTNodeFactory nodeFactory(*this);
- nodeFactory.setLocationEmpty();
- ASTPointer<ASTString> emptyDoc;
-
- vector<ASTPointer<VariableDeclaration>> parameters;
- auto expression = nodeFactory.createNode<Identifier>(make_shared<ASTString>(_varDecl->getName()));
- vector<ASTPointer<Statement>> block_statements = {nodeFactory.createNode<Return>(expression)};
-
- _functions.push_back(nodeFactory.createNode<FunctionDefinition>(
- make_shared<ASTString>(_varDecl->getName()),
- true, // isPublic
- false, // not a Constructor
- emptyDoc, // no documentation
- nodeFactory.createNode<ParameterList>(vector<ASTPointer<VariableDeclaration>>()),
- true, // is constant
- nodeFactory.createNode<ParameterList>(vector<ASTPointer<VariableDeclaration>>()),
- nodeFactory.createNode<Block>(block_statements)
- )
- );
-}
-
ASTPointer<ContractDefinition> Parser::parseContractDefinition()
{
ASTNodeFactory nodeFactory(*this);
@@ -174,9 +150,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition()
Token::isElementaryTypeName(currentToken))
{
bool const allowVar = false;
- stateVariables.push_back(parseVariableDeclaration(allowVar));
- if (visibilityIsPublic)
- addStateVariableAccessor(stateVariables.back(), functions);
+ stateVariables.push_back(parseVariableDeclaration(allowVar, visibilityIsPublic));
expectToken(Token::SEMICOLON);
}
else if (currentToken == Token::MODIFIER)
@@ -271,12 +245,12 @@ ASTPointer<StructDefinition> Parser::parseStructDefinition()
return nodeFactory.createNode<StructDefinition>(name, members);
}
-ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(bool _allowVar)
+ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(bool _allowVar, bool _isPublic)
{
ASTNodeFactory nodeFactory(*this);
ASTPointer<TypeName> type = parseTypeName(_allowVar);
nodeFactory.markEndPosition();
- return nodeFactory.createNode<VariableDeclaration>(type, expectIdentifierToken());
+ return nodeFactory.createNode<VariableDeclaration>(type, expectIdentifierToken(), _isPublic);
}
ASTPointer<ModifierDefinition> Parser::parseModifierDefinition()