diff options
author | Christian Parpart <christian@ethereum.org> | 2018-11-15 00:11:55 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-11-22 03:13:44 +0800 |
commit | d67322a1861d60a88151f7c25d6c3478a9a39acf (patch) | |
tree | af485e48c3436cd24e2db09a6a1bcf445605bae1 /libsolidity/inlineasm/AsmData.h | |
parent | 80371e2d25ce3eb868d6f75b99a54af9dc6c1583 (diff) | |
download | dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.gz dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.bz2 dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.lz dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.xz dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.zst dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.zip |
Introduce namespace `langutil` in liblangutil directory.
Also:
- Use {}-style list initialisation for SourceLocation construction
- Introduce new system includes
- Changes the API of the Scanner to take source as value (with move) as opposed to as a reference
Diffstat (limited to 'libsolidity/inlineasm/AsmData.h')
-rw-r--r-- | libsolidity/inlineasm/AsmData.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/libsolidity/inlineasm/AsmData.h b/libsolidity/inlineasm/AsmData.h index e9bf4841..23a9db75 100644 --- a/libsolidity/inlineasm/AsmData.h +++ b/libsolidity/inlineasm/AsmData.h @@ -45,56 +45,56 @@ namespace assembly using YulString = dev::yul::YulString; using Type = YulString; -struct TypedName { SourceLocation location; YulString name; Type type; }; +struct TypedName { langutil::SourceLocation location; YulString name; Type type; }; using TypedNameList = std::vector<TypedName>; /// Direct EVM instruction (except PUSHi and JUMPDEST) -struct Instruction { SourceLocation location; solidity::Instruction instruction; }; +struct Instruction { langutil::SourceLocation location; solidity::Instruction instruction; }; /// Literal number or string (up to 32 bytes) enum class LiteralKind { Number, Boolean, String }; -struct Literal { SourceLocation location; LiteralKind kind; YulString value; Type type; }; +struct Literal { langutil::SourceLocation location; LiteralKind kind; YulString value; Type type; }; /// External / internal identifier or label reference -struct Identifier { SourceLocation location; YulString name; }; +struct Identifier { langutil::SourceLocation location; YulString name; }; /// Jump label ("name:") -struct Label { SourceLocation location; YulString name; }; +struct Label { langutil::SourceLocation location; YulString name; }; /// Assignment from stack (":= x", moves stack top into x, potentially multiple slots) -struct StackAssignment { SourceLocation location; Identifier variableName; }; +struct StackAssignment { langutil::SourceLocation location; Identifier variableName; }; /// Assignment ("x := mload(20:u256)", expects push-1-expression on the right hand /// side and requires x to occupy exactly one stack slot. /// /// Multiple assignment ("x, y := f()"), where the left hand side variables each occupy /// a single stack slot and expects a single expression on the right hand returning /// the same amount of items as the number of variables. -struct Assignment { SourceLocation location; std::vector<Identifier> variableNames; std::shared_ptr<Expression> value; }; +struct Assignment { langutil::SourceLocation location; std::vector<Identifier> variableNames; std::shared_ptr<Expression> value; }; /// Functional instruction, e.g. "mul(mload(20:u256), add(2:u256, x))" -struct FunctionalInstruction { SourceLocation location; solidity::Instruction instruction; std::vector<Expression> arguments; }; -struct FunctionCall { SourceLocation location; Identifier functionName; std::vector<Expression> arguments; }; +struct FunctionalInstruction { langutil::SourceLocation location; solidity::Instruction instruction; std::vector<Expression> arguments; }; +struct FunctionCall { langutil::SourceLocation location; Identifier functionName; std::vector<Expression> arguments; }; /// Statement that contains only a single expression -struct ExpressionStatement { SourceLocation location; Expression expression; }; +struct ExpressionStatement { langutil::SourceLocation location; Expression expression; }; /// Block-scope variable declaration ("let x:u256 := mload(20:u256)"), non-hoisted -struct VariableDeclaration { SourceLocation location; TypedNameList variables; std::shared_ptr<Expression> value; }; +struct VariableDeclaration { langutil::SourceLocation location; TypedNameList variables; std::shared_ptr<Expression> value; }; /// Block that creates a scope (frees declared stack variables) -struct Block { SourceLocation location; std::vector<Statement> statements; }; +struct Block { langutil::SourceLocation location; std::vector<Statement> statements; }; /// Function definition ("function f(a, b) -> (d, e) { ... }") -struct FunctionDefinition { SourceLocation location; YulString name; TypedNameList parameters; TypedNameList returnVariables; Block body; }; +struct FunctionDefinition { langutil::SourceLocation location; YulString name; TypedNameList parameters; TypedNameList returnVariables; Block body; }; /// Conditional execution without "else" part. -struct If { SourceLocation location; std::shared_ptr<Expression> condition; Block body; }; +struct If { langutil::SourceLocation location; std::shared_ptr<Expression> condition; Block body; }; /// Switch case or default case -struct Case { SourceLocation location; std::shared_ptr<Literal> value; Block body; }; +struct Case { langutil::SourceLocation location; std::shared_ptr<Literal> value; Block body; }; /// Switch statement -struct Switch { SourceLocation location; std::shared_ptr<Expression> expression; std::vector<Case> cases; }; -struct ForLoop { SourceLocation location; Block pre; std::shared_ptr<Expression> condition; Block post; Block body; }; +struct Switch { langutil::SourceLocation location; std::shared_ptr<Expression> expression; std::vector<Case> cases; }; +struct ForLoop { langutil::SourceLocation location; Block pre; std::shared_ptr<Expression> condition; Block post; Block body; }; -struct LocationExtractor: boost::static_visitor<SourceLocation> +struct LocationExtractor: boost::static_visitor<langutil::SourceLocation> { - template <class T> SourceLocation operator()(T const& _node) const + template <class T> langutil::SourceLocation operator()(T const& _node) const { return _node.location; } }; /// Extracts the source location from an inline assembly node. -template <class T> inline SourceLocation locationOf(T const& _node) +template <class T> inline langutil::SourceLocation locationOf(T const& _node) { return boost::apply_visitor(LocationExtractor(), _node); } |