mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Added the using x for y directive.
This commit is contained in:
@@ -168,6 +168,8 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition(bool _isLibrary)
|
||||
subNodes.push_back(parseModifierDefinition());
|
||||
else if (currentTokenValue == Token::Event)
|
||||
subNodes.push_back(parseEventDefinition());
|
||||
else if (currentTokenValue == Token::Using)
|
||||
subNodes.push_back(parseUsingDirective());
|
||||
else
|
||||
fatalParserError(std::string("Function, variable, struct or modifier declaration expected."));
|
||||
}
|
||||
@@ -475,6 +477,24 @@ ASTPointer<EventDefinition> Parser::parseEventDefinition()
|
||||
return nodeFactory.createNode<EventDefinition>(name, docstring, parameters, anonymous);
|
||||
}
|
||||
|
||||
ASTPointer<UsingForDirective> Parser::parseUsingDirective()
|
||||
{
|
||||
ASTNodeFactory nodeFactory(*this);
|
||||
|
||||
expectToken(Token::Using);
|
||||
//@todo this should actually parse a full path.
|
||||
ASTPointer<Identifier> library(parseIdentifier());
|
||||
ASTPointer<TypeName> typeName;
|
||||
expectToken(Token::For);
|
||||
if (m_scanner->currentToken() == Token::Mul)
|
||||
m_scanner->next();
|
||||
else
|
||||
typeName = parseTypeName(false);
|
||||
nodeFactory.markEndPosition();
|
||||
expectToken(Token::Semicolon);
|
||||
return nodeFactory.createNode<UsingForDirective>(library, typeName);
|
||||
}
|
||||
|
||||
ASTPointer<ModifierInvocation> Parser::parseModifierInvocation()
|
||||
{
|
||||
ASTNodeFactory nodeFactory(*this);
|
||||
|
||||
Reference in New Issue
Block a user