aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-11-24 06:57:17 +0800
committerchriseth <c@ethdev.com>2015-11-26 22:37:55 +0800
commitb47d5932528357939ee29758a8b8027c90bdb1e5 (patch)
treea32526db014b5a654e193660e883e97ab437aa95 /libsolidity/parsing
parent86495dfc57dde9b825ffd8c219ea809446e978f9 (diff)
downloaddexon-solidity-b47d5932528357939ee29758a8b8027c90bdb1e5.tar.gz
dexon-solidity-b47d5932528357939ee29758a8b8027c90bdb1e5.tar.zst
dexon-solidity-b47d5932528357939ee29758a8b8027c90bdb1e5.zip
Do not store elements of a contract by AST node type.
Diffstat (limited to 'libsolidity/parsing')
-rw-r--r--libsolidity/parsing/Parser.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index 2d4ca43e..9272eb4b 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -132,12 +132,6 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition(bool _isLibrary)
expectToken(_isLibrary ? Token::Library : Token::Contract);
ASTPointer<ASTString> name = expectIdentifierToken();
vector<ASTPointer<InheritanceSpecifier>> baseContracts;
- vector<ASTPointer<StructDefinition>> structs;
- vector<ASTPointer<EnumDefinition>> enums;
- vector<ASTPointer<VariableDeclaration>> stateVariables;
- vector<ASTPointer<FunctionDefinition>> functions;
- vector<ASTPointer<ModifierDefinition>> modifiers;
- vector<ASTPointer<EventDefinition>> events;
if (m_scanner->currentToken() == Token::Is)
do
{
@@ -145,6 +139,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition(bool _isLibrary)
baseContracts.push_back(parseInheritanceSpecifier());
}
while (m_scanner->currentToken() == Token::Comma);
+ vector<ASTPointer<ASTNode>> subNodes;
expectToken(Token::LBrace);
while (true)
{
@@ -152,11 +147,11 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition(bool _isLibrary)
if (currentTokenValue == Token::RBrace)
break;
else if (currentTokenValue == Token::Function)
- functions.push_back(parseFunctionDefinition(name.get()));
+ subNodes.push_back(parseFunctionDefinition(name.get()));
else if (currentTokenValue == Token::Struct)
- structs.push_back(parseStructDefinition());
+ subNodes.push_back(parseStructDefinition());
else if (currentTokenValue == Token::Enum)
- enums.push_back(parseEnumDefinition());
+ subNodes.push_back(parseEnumDefinition());
else if (
currentTokenValue == Token::Identifier ||
currentTokenValue == Token::Mapping ||
@@ -166,13 +161,13 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition(bool _isLibrary)
VarDeclParserOptions options;
options.isStateVariable = true;
options.allowInitialValue = true;
- stateVariables.push_back(parseVariableDeclaration(options));
+ subNodes.push_back(parseVariableDeclaration(options));
expectToken(Token::Semicolon);
}
else if (currentTokenValue == Token::Modifier)
- modifiers.push_back(parseModifierDefinition());
+ subNodes.push_back(parseModifierDefinition());
else if (currentTokenValue == Token::Event)
- events.push_back(parseEventDefinition());
+ subNodes.push_back(parseEventDefinition());
else
fatalParserError(std::string("Function, variable, struct or modifier declaration expected."));
}
@@ -182,12 +177,7 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition(bool _isLibrary)
name,
docString,
baseContracts,
- structs,
- enums,
- stateVariables,
- functions,
- modifiers,
- events,
+ subNodes,
_isLibrary
);
}