mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Changes after rebase on top of Array Parsing
This commit is contained in:
parent
12c32392ab
commit
fb328b778c
2
AST.h
2
AST.h
@ -662,7 +662,7 @@ private:
|
|||||||
class ArrayTypeName: public TypeName
|
class ArrayTypeName: public TypeName
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArrayTypeName(Location const& _location, ASTPointer<TypeName> const& _baseType,
|
ArrayTypeName(SourceLocation const& _location, ASTPointer<TypeName> const& _baseType,
|
||||||
ASTPointer<Expression> const& _length):
|
ASTPointer<Expression> const& _length):
|
||||||
TypeName(_location), m_baseType(_baseType), m_length(_length) {}
|
TypeName(_location), m_baseType(_baseType), m_length(_length) {}
|
||||||
virtual void accept(ASTVisitor& _visitor) override;
|
virtual void accept(ASTVisitor& _visitor) override;
|
||||||
|
@ -473,7 +473,7 @@ bool Compiler::visit(Return const& _return)
|
|||||||
bool Compiler::visit(VariableDeclarationStatement const& _variableDeclarationStatement)
|
bool Compiler::visit(VariableDeclarationStatement const& _variableDeclarationStatement)
|
||||||
{
|
{
|
||||||
StackHeightChecker checker(m_context);
|
StackHeightChecker checker(m_context);
|
||||||
CompilerContext::LocationSetter locationSetter(m_context, &_variableDefinition);
|
CompilerContext::LocationSetter locationSetter(m_context, &_variableDeclarationStatement);
|
||||||
if (Expression const* expression = _variableDeclarationStatement.getExpression())
|
if (Expression const* expression = _variableDeclarationStatement.getExpression())
|
||||||
{
|
{
|
||||||
compileExpression(*expression, _variableDeclarationStatement.getDeclaration().getType());
|
compileExpression(*expression, _variableDeclarationStatement.getDeclaration().getType());
|
||||||
|
10
Parser.cpp
10
Parser.cpp
@ -45,7 +45,7 @@ public:
|
|||||||
m_parser(_parser), m_location(_childNode->getLocation()) {}
|
m_parser(_parser), m_location(_childNode->getLocation()) {}
|
||||||
|
|
||||||
void markEndPosition() { m_location.end = m_parser.getEndPosition(); }
|
void markEndPosition() { m_location.end = m_parser.getEndPosition(); }
|
||||||
void setLocation(Location const& _location) { m_location = _location; }
|
void setLocation(SourceLocation const& _location) { m_location = _location; }
|
||||||
void setLocationEmpty() { m_location.end = m_location.start; }
|
void setLocationEmpty() { m_location.end = m_location.start; }
|
||||||
/// Set the end position to the one of the given node.
|
/// Set the end position to the one of the given node.
|
||||||
void setEndPositionFromNode(ASTPointer<ASTNode> const& _node) { m_location.end = _node->getLocation().end; }
|
void setEndPositionFromNode(ASTPointer<ASTNode> const& _node) { m_location.end = _node->getLocation().end; }
|
||||||
@ -646,9 +646,9 @@ ASTPointer<Statement> Parser::parseSimpleStatement()
|
|||||||
primary = ASTNodeFactory(*this).createNode<ElementaryTypeNameExpression>(m_scanner->getCurrentToken());
|
primary = ASTNodeFactory(*this).createNode<ElementaryTypeNameExpression>(m_scanner->getCurrentToken());
|
||||||
m_scanner->next();
|
m_scanner->next();
|
||||||
}
|
}
|
||||||
vector<pair<ASTPointer<Expression>, Location>> indices;
|
vector<pair<ASTPointer<Expression>, SourceLocation>> indices;
|
||||||
solAssert(m_scanner->getCurrentToken() == Token::LBrack, "");
|
solAssert(m_scanner->getCurrentToken() == Token::LBrack, "");
|
||||||
Location indexLocation = primary->getLocation();
|
SourceLocation indexLocation = primary->getLocation();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
expectToken(Token::LBrack);
|
expectToken(Token::LBrack);
|
||||||
@ -913,7 +913,7 @@ Parser::LookAheadInfo Parser::peekStatementType() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<TypeName> Parser::typeNameIndexAccessStructure(
|
ASTPointer<TypeName> Parser::typeNameIndexAccessStructure(
|
||||||
ASTPointer<PrimaryExpression> const& _primary, vector<pair<ASTPointer<Expression>, Location>> const& _indices)
|
ASTPointer<PrimaryExpression> const& _primary, vector<pair<ASTPointer<Expression>, SourceLocation>> const& _indices)
|
||||||
{
|
{
|
||||||
ASTNodeFactory nodeFactory(*this, _primary);
|
ASTNodeFactory nodeFactory(*this, _primary);
|
||||||
ASTPointer<TypeName> type;
|
ASTPointer<TypeName> type;
|
||||||
@ -932,7 +932,7 @@ ASTPointer<TypeName> Parser::typeNameIndexAccessStructure(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<Expression> Parser::expressionFromIndexAccessStructure(
|
ASTPointer<Expression> Parser::expressionFromIndexAccessStructure(
|
||||||
ASTPointer<PrimaryExpression> const& _primary, vector<pair<ASTPointer<Expression>, Location>> const& _indices)
|
ASTPointer<PrimaryExpression> const& _primary, vector<pair<ASTPointer<Expression>, SourceLocation>> const& _indices)
|
||||||
{
|
{
|
||||||
ASTNodeFactory nodeFactory(*this, _primary);
|
ASTNodeFactory nodeFactory(*this, _primary);
|
||||||
ASTPointer<Expression> expression(_primary);
|
ASTPointer<Expression> expression(_primary);
|
||||||
|
4
Parser.h
4
Parser.h
@ -114,11 +114,11 @@ private:
|
|||||||
/// Returns a typename parsed in look-ahead fashion from something like "a[8][2**70]".
|
/// Returns a typename parsed in look-ahead fashion from something like "a[8][2**70]".
|
||||||
ASTPointer<TypeName> typeNameIndexAccessStructure(
|
ASTPointer<TypeName> typeNameIndexAccessStructure(
|
||||||
ASTPointer<PrimaryExpression> const& _primary,
|
ASTPointer<PrimaryExpression> const& _primary,
|
||||||
std::vector<std::pair<ASTPointer<Expression>, Location>> const& _indices);
|
std::vector<std::pair<ASTPointer<Expression>, SourceLocation>> const& _indices);
|
||||||
/// Returns an expression parsed in look-ahead fashion from something like "a[8][2**70]".
|
/// Returns an expression parsed in look-ahead fashion from something like "a[8][2**70]".
|
||||||
ASTPointer<Expression> expressionFromIndexAccessStructure(
|
ASTPointer<Expression> expressionFromIndexAccessStructure(
|
||||||
ASTPointer<PrimaryExpression> const& _primary,
|
ASTPointer<PrimaryExpression> const& _primary,
|
||||||
std::vector<std::pair<ASTPointer<Expression>, Location>> const& _indices);
|
std::vector<std::pair<ASTPointer<Expression>, SourceLocation>> const& _indices);
|
||||||
/// If current token value is not _value, throw exception otherwise advance token.
|
/// If current token value is not _value, throw exception otherwise advance token.
|
||||||
void expectToken(Token::Value _value);
|
void expectToken(Token::Value _value);
|
||||||
Token::Value expectAssignmentOperator();
|
Token::Value expectAssignmentOperator();
|
||||||
|
Loading…
Reference in New Issue
Block a user