diff options
author | Christian Parpart <christian@ethereum.org> | 2018-10-22 22:48:21 +0800 |
---|---|---|
committer | Christian Parpart <christian@ethereum.org> | 2018-10-22 23:00:51 +0800 |
commit | f112377dd44e8281bff092639bb546ec8a6a39ac (patch) | |
tree | 4b6b8b3816a0a1620e73a30de687ff3557a10098 /libsolidity/ast | |
parent | c13b5280c1b44f18a2a1fb61ef5556e91c5678e7 (diff) | |
download | dexon-solidity-f112377dd44e8281bff092639bb546ec8a6a39ac.tar.gz dexon-solidity-f112377dd44e8281bff092639bb546ec8a6a39ac.tar.zst dexon-solidity-f112377dd44e8281bff092639bb546ec8a6a39ac.zip |
Refactor `solidity::Token` into an `enum class` with `TokenTraits` helper namespace
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/AST.h | 58 | ||||
-rw-r--r-- | libsolidity/ast/ASTJsonConverter.cpp | 12 | ||||
-rw-r--r-- | libsolidity/ast/ASTJsonConverter.h | 2 | ||||
-rw-r--r-- | libsolidity/ast/ASTPrinter.cpp | 8 | ||||
-rw-r--r-- | libsolidity/ast/Types.cpp | 64 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 58 |
6 files changed, 101 insertions, 101 deletions
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index b84f9730..d819402e 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -237,7 +237,7 @@ class PragmaDirective: public ASTNode public: PragmaDirective( SourceLocation const& _location, - std::vector<Token::Value> const& _tokens, + std::vector<Token> const& _tokens, std::vector<ASTString> const& _literals ): ASTNode(_location), m_tokens(_tokens), m_literals(_literals) {} @@ -245,13 +245,13 @@ public: virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; - std::vector<Token::Value> const& tokens() const { return m_tokens; } + std::vector<Token> const& tokens() const { return m_tokens; } std::vector<ASTString> const& literals() const { return m_literals; } private: /// Sequence of tokens following the "pragma" keyword. - std::vector<Token::Value> m_tokens; + std::vector<Token> m_tokens; /// Sequence of literals following the "pragma" keyword. std::vector<ASTString> m_literals; }; @@ -1379,7 +1379,7 @@ public: Assignment( SourceLocation const& _location, ASTPointer<Expression> const& _leftHandSide, - Token::Value _assignmentOperator, + Token _assignmentOperator, ASTPointer<Expression> const& _rightHandSide ): Expression(_location), @@ -1387,18 +1387,18 @@ public: m_assigmentOperator(_assignmentOperator), m_rightHandSide(_rightHandSide) { - solAssert(Token::isAssignmentOp(_assignmentOperator), ""); + solAssert(TokenTraits::isAssignmentOp(_assignmentOperator), ""); } virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; Expression const& leftHandSide() const { return *m_leftHandSide; } - Token::Value assignmentOperator() const { return m_assigmentOperator; } + Token assignmentOperator() const { return m_assigmentOperator; } Expression const& rightHandSide() const { return *m_rightHandSide; } private: ASTPointer<Expression> m_leftHandSide; - Token::Value m_assigmentOperator; + Token m_assigmentOperator; ASTPointer<Expression> m_rightHandSide; }; @@ -1441,7 +1441,7 @@ class UnaryOperation: public Expression public: UnaryOperation( SourceLocation const& _location, - Token::Value _operator, + Token _operator, ASTPointer<Expression> const& _subExpression, bool _isPrefix ): @@ -1450,17 +1450,17 @@ public: m_subExpression(_subExpression), m_isPrefix(_isPrefix) { - solAssert(Token::isUnaryOp(_operator), ""); + solAssert(TokenTraits::isUnaryOp(_operator), ""); } virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; - Token::Value getOperator() const { return m_operator; } + Token getOperator() const { return m_operator; } bool isPrefixOperation() const { return m_isPrefix; } Expression const& subExpression() const { return *m_subExpression; } private: - Token::Value m_operator; + Token m_operator; ASTPointer<Expression> m_subExpression; bool m_isPrefix; }; @@ -1475,25 +1475,25 @@ public: BinaryOperation( SourceLocation const& _location, ASTPointer<Expression> const& _left, - Token::Value _operator, + Token _operator, ASTPointer<Expression> const& _right ): Expression(_location), m_left(_left), m_operator(_operator), m_right(_right) { - solAssert(Token::isBinaryOp(_operator) || Token::isCompareOp(_operator), ""); + solAssert(TokenTraits::isBinaryOp(_operator) || TokenTraits::isCompareOp(_operator), ""); } virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; Expression const& leftExpression() const { return *m_left; } Expression const& rightExpression() const { return *m_right; } - Token::Value getOperator() const { return m_operator; } + Token getOperator() const { return m_operator; } BinaryOperationAnnotation& annotation() const override; private: ASTPointer<Expression> m_left; - Token::Value m_operator; + Token m_operator; ASTPointer<Expression> m_right; }; @@ -1653,21 +1653,21 @@ class Literal: public PrimaryExpression public: enum class SubDenomination { - None = Token::Illegal, - Wei = Token::SubWei, - Szabo = Token::SubSzabo, - Finney = Token::SubFinney, - Ether = Token::SubEther, - Second = Token::SubSecond, - Minute = Token::SubMinute, - Hour = Token::SubHour, - Day = Token::SubDay, - Week = Token::SubWeek, - Year = Token::SubYear + None = static_cast<int>(Token::Illegal), + Wei = static_cast<int>(Token::SubWei), + Szabo = static_cast<int>(Token::SubSzabo), + Finney = static_cast<int>(Token::SubFinney), + Ether = static_cast<int>(Token::SubEther), + Second = static_cast<int>(Token::SubSecond), + Minute = static_cast<int>(Token::SubMinute), + Hour = static_cast<int>(Token::SubHour), + Day = static_cast<int>(Token::SubDay), + Week = static_cast<int>(Token::SubWeek), + Year = static_cast<int>(Token::SubYear) }; Literal( SourceLocation const& _location, - Token::Value _token, + Token _token, ASTPointer<ASTString> const& _value, SubDenomination _sub = SubDenomination::None ): @@ -1675,7 +1675,7 @@ public: virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; - Token::Value token() const { return m_token; } + Token token() const { return m_token; } /// @returns the non-parsed value of the literal ASTString const& value() const { return *m_value; } @@ -1694,7 +1694,7 @@ public: std::string getChecksummedAddress() const; private: - Token::Value m_token; + Token m_token; ASTPointer<ASTString> m_value; SubDenomination m_subDenomination; }; diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 4b282d85..569e5b0e 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -589,7 +589,7 @@ bool ASTJsonConverter::visit(Conditional const& _node) bool ASTJsonConverter::visit(Assignment const& _node) { std::vector<pair<string, Json::Value>> attributes = { - make_pair("operator", Token::toString(_node.assignmentOperator())), + make_pair("operator", TokenTraits::toString(_node.assignmentOperator())), make_pair("leftHandSide", toJson(_node.leftHandSide())), make_pair("rightHandSide", toJson(_node.rightHandSide())) }; @@ -613,7 +613,7 @@ bool ASTJsonConverter::visit(UnaryOperation const& _node) { std::vector<pair<string, Json::Value>> attributes = { make_pair("prefix", _node.isPrefixOperation()), - make_pair("operator", Token::toString(_node.getOperator())), + make_pair("operator", TokenTraits::toString(_node.getOperator())), make_pair("subExpression", toJson(_node.subExpression())) }; appendExpressionAttributes(attributes, _node.annotation()); @@ -624,7 +624,7 @@ bool ASTJsonConverter::visit(UnaryOperation const& _node) bool ASTJsonConverter::visit(BinaryOperation const& _node) { std::vector<pair<string, Json::Value>> attributes = { - make_pair("operator", Token::toString(_node.getOperator())), + make_pair("operator", TokenTraits::toString(_node.getOperator())), make_pair("leftExpression", toJson(_node.leftExpression())), make_pair("rightExpression", toJson(_node.rightExpression())), make_pair("commonType", typePointerToJson(_node.annotation().commonType)), @@ -719,7 +719,7 @@ bool ASTJsonConverter::visit(Literal const& _node) Json::Value value{_node.value()}; if (!dev::validateUTF8(_node.value())) value = Json::nullValue; - Token::Value subdenomination = Token::Value(_node.subDenomination()); + Token subdenomination = Token(_node.subDenomination()); std::vector<pair<string, Json::Value>> attributes = { make_pair(m_legacy ? "token" : "kind", literalTokenKind(_node.token())), make_pair("value", value), @@ -728,7 +728,7 @@ bool ASTJsonConverter::visit(Literal const& _node) "subdenomination", subdenomination == Token::Illegal ? Json::nullValue : - Json::Value{Token::toString(subdenomination)} + Json::Value{TokenTraits::toString(subdenomination)} ) }; appendExpressionAttributes(attributes, _node.annotation()); @@ -790,7 +790,7 @@ string ASTJsonConverter::functionCallKind(FunctionCallKind _kind) } } -string ASTJsonConverter::literalTokenKind(Token::Value _token) +string ASTJsonConverter::literalTokenKind(Token _token) { switch (_token) { diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h index 29712f3b..8429708c 100644 --- a/libsolidity/ast/ASTJsonConverter.h +++ b/libsolidity/ast/ASTJsonConverter.h @@ -134,7 +134,7 @@ private: static std::string location(VariableDeclaration::Location _location); static std::string contractKind(ContractDefinition::ContractKind _kind); static std::string functionCallKind(FunctionCallKind _kind); - static std::string literalTokenKind(Token::Value _token); + static std::string literalTokenKind(Token _token); static std::string type(Expression const& _expression); static std::string type(VariableDeclaration const& _varDecl); static int nodeId(ASTNode const& _node) diff --git a/libsolidity/ast/ASTPrinter.cpp b/libsolidity/ast/ASTPrinter.cpp index 4273f225..255cb9be 100644 --- a/libsolidity/ast/ASTPrinter.cpp +++ b/libsolidity/ast/ASTPrinter.cpp @@ -289,7 +289,7 @@ bool ASTPrinter::visit(Conditional const& _node) bool ASTPrinter::visit(Assignment const& _node) { - writeLine(string("Assignment using operator ") + Token::toString(_node.assignmentOperator())); + writeLine(string("Assignment using operator ") + TokenTraits::toString(_node.assignmentOperator())); printType(_node); printSourcePart(_node); return goDeeper(); @@ -306,7 +306,7 @@ bool ASTPrinter::visit(TupleExpression const& _node) bool ASTPrinter::visit(UnaryOperation const& _node) { writeLine(string("UnaryOperation (") + (_node.isPrefixOperation() ? "prefix" : "postfix") + - ") " + Token::toString(_node.getOperator())); + ") " + TokenTraits::toString(_node.getOperator())); printType(_node); printSourcePart(_node); return goDeeper(); @@ -314,7 +314,7 @@ bool ASTPrinter::visit(UnaryOperation const& _node) bool ASTPrinter::visit(BinaryOperation const& _node) { - writeLine(string("BinaryOperation using operator ") + Token::toString(_node.getOperator())); + writeLine(string("BinaryOperation using operator ") + TokenTraits::toString(_node.getOperator())); printType(_node); printSourcePart(_node); return goDeeper(); @@ -370,7 +370,7 @@ bool ASTPrinter::visit(ElementaryTypeNameExpression const& _node) bool ASTPrinter::visit(Literal const& _node) { - char const* tokenString = Token::toString(_node.token()); + char const* tokenString = TokenTraits::toString(_node.token()); if (!tokenString) tokenString = "[no token]"; writeLine(string("Literal, token: ") + tokenString + " value: " + _node.value()); diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 195b2e2d..301687b4 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -268,11 +268,11 @@ string Type::identifier() const TypePointer Type::fromElementaryTypeName(ElementaryTypeNameToken const& _type) { - solAssert(Token::isElementaryTypeName(_type.token()), + solAssert(TokenTraits::isElementaryTypeName(_type.token()), "Expected an elementary type name but got " + _type.toString() ); - Token::Value token = _type.token(); + Token token = _type.token(); unsigned m = _type.firstNumber(); unsigned n = _type.secondNumber(); @@ -320,9 +320,9 @@ TypePointer Type::fromElementaryTypeName(string const& _name) vector<string> nameParts; boost::split(nameParts, _name, boost::is_any_of(" ")); solAssert(nameParts.size() == 1 || nameParts.size() == 2, "Cannot parse elementary type: " + _name); - Token::Value token; + Token token; unsigned short firstNum, secondNum; - tie(token, firstNum, secondNum) = Token::fromIdentifierOrKeyword(nameParts[0]); + tie(token, firstNum, secondNum) = TokenTraits::fromIdentifierOrKeyword(nameParts[0]); auto t = fromElementaryTypeName(ElementaryTypeNameToken(token, firstNum, secondNum)); if (auto* ref = dynamic_cast<ReferenceType const*>(t.get())) { @@ -502,16 +502,16 @@ u256 AddressType::literalValue(Literal const* _literal) const return u256(_literal->valueWithoutUnderscores()); } -TypePointer AddressType::unaryOperatorResult(Token::Value _operator) const +TypePointer AddressType::unaryOperatorResult(Token _operator) const { return _operator == Token::Delete ? make_shared<TupleType>() : TypePointer(); } -TypePointer AddressType::binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const +TypePointer AddressType::binaryOperatorResult(Token _operator, TypePointer const& _other) const { // Addresses can only be compared. - if (!Token::isCompareOp(_operator)) + if (!TokenTraits::isCompareOp(_operator)) return TypePointer(); return Type::commonType(shared_from_this(), _other); @@ -545,7 +545,7 @@ MemberList::MemberMap AddressType::nativeMembers(ContractDefinition const*) cons namespace { -bool isValidShiftAndAmountType(Token::Value _operator, Type const& _shiftAmountType) +bool isValidShiftAndAmountType(Token _operator, Type const& _shiftAmountType) { // Disable >>> here. if (_operator == Token::SHR) @@ -605,7 +605,7 @@ bool IntegerType::isExplicitlyConvertibleTo(Type const& _convertTo) const _convertTo.category() == Category::FixedPoint; } -TypePointer IntegerType::unaryOperatorResult(Token::Value _operator) const +TypePointer IntegerType::unaryOperatorResult(Token _operator) const { // "delete" is ok for all integer types if (_operator == Token::Delete) @@ -649,7 +649,7 @@ bigint IntegerType::maxValue() const return (bigint(1) << m_bits) - 1; } -TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const +TypePointer IntegerType::binaryOperatorResult(Token _operator, TypePointer const& _other) const { if ( _other->category() != Category::RationalNumber && @@ -657,7 +657,7 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe _other->category() != category() ) return TypePointer(); - if (Token::isShiftOp(_operator)) + if (TokenTraits::isShiftOp(_operator)) { // Shifts are not symmetric with respect to the type if (isValidShiftAndAmountType(_operator, *_other)) @@ -671,9 +671,9 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe return TypePointer(); // All integer types can be compared - if (Token::isCompareOp(_operator)) + if (TokenTraits::isCompareOp(_operator)) return commonType; - if (Token::isBooleanOp(_operator)) + if (TokenTraits::isBooleanOp(_operator)) return TypePointer(); if (auto intType = dynamic_pointer_cast<IntegerType const>(commonType)) { @@ -720,7 +720,7 @@ bool FixedPointType::isExplicitlyConvertibleTo(Type const& _convertTo) const return _convertTo.category() == category() || _convertTo.category() == Category::Integer; } -TypePointer FixedPointType::unaryOperatorResult(Token::Value _operator) const +TypePointer FixedPointType::unaryOperatorResult(Token _operator) const { switch(_operator) { @@ -769,7 +769,7 @@ bigint FixedPointType::minIntegerValue() const return bigint(0); } -TypePointer FixedPointType::binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const +TypePointer FixedPointType::binaryOperatorResult(Token _operator, TypePointer const& _other) const { auto commonType = Type::commonType(shared_from_this(), _other); @@ -777,9 +777,9 @@ TypePointer FixedPointType::binaryOperatorResult(Token::Value _operator, TypePoi return TypePointer(); // All fixed types can be compared - if (Token::isCompareOp(_operator)) + if (TokenTraits::isCompareOp(_operator)) return commonType; - if (Token::isBitOp(_operator) || Token::isBooleanOp(_operator) || _operator == Token::Exp) + if (TokenTraits::isBitOp(_operator) || TokenTraits::isBooleanOp(_operator) || _operator == Token::Exp) return TypePointer(); return commonType; } @@ -1006,7 +1006,7 @@ bool RationalNumberType::isExplicitlyConvertibleTo(Type const& _convertTo) const return false; } -TypePointer RationalNumberType::unaryOperatorResult(Token::Value _operator) const +TypePointer RationalNumberType::unaryOperatorResult(Token _operator) const { rational value; switch (_operator) @@ -1030,7 +1030,7 @@ TypePointer RationalNumberType::unaryOperatorResult(Token::Value _operator) cons return make_shared<RationalNumberType>(value); } -TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const +TypePointer RationalNumberType::binaryOperatorResult(Token _operator, TypePointer const& _other) const { if (_other->category() == Category::Integer || _other->category() == Category::FixedPoint) { @@ -1043,7 +1043,7 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ return TypePointer(); RationalNumberType const& other = dynamic_cast<RationalNumberType const&>(*_other); - if (Token::isCompareOp(_operator)) + if (TokenTraits::isCompareOp(_operator)) { // Since we do not have a "BoolConstantType", we have to do the actual comparison // at runtime and convert to mobile typse first. Such a comparison is not a very common @@ -1423,7 +1423,7 @@ bool FixedBytesType::isExplicitlyConvertibleTo(Type const& _convertTo) const _convertTo.category() == category(); } -TypePointer FixedBytesType::unaryOperatorResult(Token::Value _operator) const +TypePointer FixedBytesType::unaryOperatorResult(Token _operator) const { // "delete" and "~" is okay for FixedBytesType if (_operator == Token::Delete) @@ -1434,9 +1434,9 @@ TypePointer FixedBytesType::unaryOperatorResult(Token::Value _operator) const return TypePointer(); } -TypePointer FixedBytesType::binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const +TypePointer FixedBytesType::binaryOperatorResult(Token _operator, TypePointer const& _other) const { - if (Token::isShiftOp(_operator)) + if (TokenTraits::isShiftOp(_operator)) { if (isValidShiftAndAmountType(_operator, *_other)) return shared_from_this(); @@ -1449,7 +1449,7 @@ TypePointer FixedBytesType::binaryOperatorResult(Token::Value _operator, TypePoi return TypePointer(); // FixedBytes can be compared and have bitwise operators applied to them - if (Token::isCompareOp(_operator) || Token::isBitOp(_operator)) + if (TokenTraits::isCompareOp(_operator) || TokenTraits::isBitOp(_operator)) return commonType; return TypePointer(); @@ -1484,14 +1484,14 @@ u256 BoolType::literalValue(Literal const* _literal) const solAssert(false, "Bool type constructed from non-boolean literal."); } -TypePointer BoolType::unaryOperatorResult(Token::Value _operator) const +TypePointer BoolType::unaryOperatorResult(Token _operator) const { if (_operator == Token::Delete) return make_shared<TupleType>(); return (_operator == Token::Not) ? shared_from_this() : TypePointer(); } -TypePointer BoolType::binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const +TypePointer BoolType::binaryOperatorResult(Token _operator, TypePointer const& _other) const { if (category() != _other->category()) return TypePointer(); @@ -1531,14 +1531,14 @@ bool ContractType::isPayable() const return fallbackFunction && fallbackFunction->isPayable(); } -TypePointer ContractType::unaryOperatorResult(Token::Value _operator) const +TypePointer ContractType::unaryOperatorResult(Token _operator) const { if (isSuper()) return TypePointer{}; return _operator == Token::Delete ? make_shared<TupleType>() : TypePointer(); } -TypePointer ReferenceType::unaryOperatorResult(Token::Value _operator) const +TypePointer ReferenceType::unaryOperatorResult(Token _operator) const { if (_operator != Token::Delete) return TypePointer(); @@ -2237,7 +2237,7 @@ bool StructType::recursive() const return *m_recursive; } -TypePointer EnumType::unaryOperatorResult(Token::Value _operator) const +TypePointer EnumType::unaryOperatorResult(Token _operator) const { return _operator == Token::Delete ? make_shared<TupleType>() : TypePointer(); } @@ -2668,14 +2668,14 @@ bool FunctionType::isImplicitlyConvertibleTo(Type const& _convertTo) const return true; } -TypePointer FunctionType::unaryOperatorResult(Token::Value _operator) const +TypePointer FunctionType::unaryOperatorResult(Token _operator) const { - if (_operator == Token::Value::Delete) + if (_operator == Token::Delete) return make_shared<TupleType>(); return TypePointer(); } -TypePointer FunctionType::binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const +TypePointer FunctionType::binaryOperatorResult(Token _operator, TypePointer const& _other) const { if (_other->category() != category() || !(_operator == Token::Equal || _operator == Token::NotEqual)) return TypePointer(); diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 0f3373a1..b764717f 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -188,13 +188,13 @@ public: /// @returns the resulting type of applying the given unary operator or an empty pointer if /// this is not possible. /// The default implementation does not allow any unary operator. - virtual TypePointer unaryOperatorResult(Token::Value) const { return TypePointer(); } + virtual TypePointer unaryOperatorResult(Token) const { return TypePointer(); } /// @returns the resulting type of applying the given binary operator or an empty pointer if /// this is not possible. /// The default implementation allows comparison operators if a common type exists - virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const + virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const { - return Token::isCompareOp(_operator) ? commonType(shared_from_this(), _other) : TypePointer(); + return TokenTraits::isCompareOp(_operator) ? commonType(shared_from_this(), _other) : TypePointer(); } virtual bool operator==(Type const& _other) const { return category() == _other.category(); } @@ -329,8 +329,8 @@ public: virtual std::string richIdentifier() const override; virtual bool isImplicitlyConvertibleTo(Type const& _other) const override; virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; - virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; + virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override; virtual bool operator==(Type const& _other) const override; @@ -372,8 +372,8 @@ public: virtual std::string richIdentifier() const override; virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override; virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; - virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; + virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override; virtual bool operator==(Type const& _other) const override; @@ -414,8 +414,8 @@ public: virtual std::string richIdentifier() const override; virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override; virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; - virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; + virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override; virtual bool operator==(Type const& _other) const override; @@ -468,8 +468,8 @@ public: virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override; virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; - virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; + virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override; virtual std::string richIdentifier() const override; virtual bool operator==(Type const& _other) const override; @@ -526,7 +526,7 @@ public: explicit StringLiteralType(Literal const& _literal); virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override; - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } @@ -563,8 +563,8 @@ public: virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; virtual std::string richIdentifier() const override; virtual bool operator==(Type const& _other) const override; - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; - virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; + virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override; virtual unsigned calldataEncodedSize(bool _padded) const override { return _padded && m_bytes > 0 ? 32 : m_bytes; } virtual unsigned storageBytes() const override { return m_bytes; } @@ -590,8 +590,8 @@ public: BoolType() {} virtual Category category() const override { return Category::Bool; } virtual std::string richIdentifier() const override { return "t_bool"; } - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; - virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; + virtual TypePointer binaryOperatorResult(Token _operator, TypePointer const& _other) const override; virtual unsigned calldataEncodedSize(bool _padded) const override{ return _padded ? 32 : 1; } virtual unsigned storageBytes() const override { return 1; } @@ -613,8 +613,8 @@ public: explicit ReferenceType(DataLocation _location): m_location(_location) {} DataLocation location() const { return m_location; } - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override + virtual TypePointer unaryOperatorResult(Token _operator) const override; + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } @@ -749,7 +749,7 @@ public: virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override; /// Contracts can only be explicitly converted to address types and base contracts. virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; virtual std::string richIdentifier() const override; virtual bool operator==(Type const& _other) const override; virtual unsigned calldataEncodedSize(bool _padded ) const override @@ -865,7 +865,7 @@ class EnumType: public Type public: virtual Category category() const override { return Category::Enum; } explicit EnumType(EnumDefinition const& _enum): m_enum(_enum) {} - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; virtual std::string richIdentifier() const override; virtual bool operator==(Type const& _other) const override; virtual unsigned calldataEncodedSize(bool _padded) const override @@ -909,7 +909,7 @@ public: virtual bool isImplicitlyConvertibleTo(Type const& _other) const override; virtual std::string richIdentifier() const override; virtual bool operator==(Type const& _other) const override; - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override { return TypePointer(); } + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } virtual std::string toString(bool) const override; virtual bool canBeStored() const override { return false; } virtual u256 storageSize() const override; @@ -1056,8 +1056,8 @@ public: virtual bool operator==(Type const& _other) const override; virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override; virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; - virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override; + virtual TypePointer unaryOperatorResult(Token _operator) const override; + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override; virtual std::string canonicalName() const override; virtual std::string toString(bool _short) const override; virtual unsigned calldataEncodedSize(bool _padded) const override; @@ -1187,7 +1187,7 @@ public: virtual std::string toString(bool _short) const override; virtual std::string canonicalName() const override; virtual bool canLiveOutsideStorage() const override { return false; } - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override { return TypePointer(); } + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } virtual TypePointer encodingType() const override { return std::make_shared<IntegerType>(256); @@ -1220,7 +1220,7 @@ public: explicit TypeType(TypePointer const& _actualType): m_actualType(_actualType) {} TypePointer const& actualType() const { return m_actualType; } - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override { return TypePointer(); } + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } virtual std::string richIdentifier() const override; virtual bool operator==(Type const& _other) const override; virtual bool canBeStored() const override { return false; } @@ -1245,7 +1245,7 @@ public: virtual Category category() const override { return Category::Modifier; } explicit ModifierType(ModifierDefinition const& _modifier); - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override { return TypePointer(); } + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } virtual bool canBeStored() const override { return false; } virtual u256 storageSize() const override; virtual bool canLiveOutsideStorage() const override { return false; } @@ -1271,7 +1271,7 @@ public: explicit ModuleType(SourceUnit const& _source): m_sourceUnit(_source) {} - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override { return TypePointer(); } + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } virtual std::string richIdentifier() const override; virtual bool operator==(Type const& _other) const override; virtual bool canBeStored() const override { return false; } @@ -1298,7 +1298,7 @@ public: explicit MagicType(Kind _kind): m_kind(_kind) {} - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } @@ -1331,7 +1331,7 @@ public: virtual std::string richIdentifier() const override { return "t_inaccessible"; } virtual bool isImplicitlyConvertibleTo(Type const&) const override { return false; } virtual bool isExplicitlyConvertibleTo(Type const&) const override { return false; } - virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override { return TypePointer(); } + virtual TypePointer binaryOperatorResult(Token, TypePointer const&) const override { return TypePointer(); } virtual unsigned calldataEncodedSize(bool _padded) const override { (void)_padded; return 32; } virtual bool canBeStored() const override { return false; } virtual bool canLiveOutsideStorage() const override { return false; } |