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/codegen | |
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/codegen')
-rw-r--r-- | libsolidity/codegen/ArrayUtils.cpp | 1 | ||||
-rw-r--r-- | libsolidity/codegen/CompilerContext.cpp | 4 | ||||
-rw-r--r-- | libsolidity/codegen/CompilerUtils.cpp | 1 | ||||
-rw-r--r-- | libsolidity/codegen/ContractCompiler.cpp | 1 | ||||
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 1 | ||||
-rw-r--r-- | libsolidity/codegen/LValue.cpp | 1 | ||||
-rw-r--r-- | libsolidity/codegen/LValue.h | 42 |
7 files changed, 29 insertions, 22 deletions
diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp index a4000d60..4878f9f3 100644 --- a/libsolidity/codegen/ArrayUtils.cpp +++ b/libsolidity/codegen/ArrayUtils.cpp @@ -30,6 +30,7 @@ using namespace std; using namespace dev; +using namespace langutil; using namespace solidity; void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType const& _sourceType) const diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index fa6dfe60..9e4f2882 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -26,6 +26,7 @@ #include <libsolidity/codegen/Compiler.h> #include <libsolidity/interface/Version.h> #include <liblangutil/ErrorReporter.h> +#include <liblangutil/Scanner.h> #include <libsolidity/interface/SourceReferenceFormatter.h> #include <liblangutil/Scanner.h> #include <libsolidity/inlineasm/AsmParser.h> @@ -47,6 +48,7 @@ using namespace std; +using namespace langutil; namespace dev { @@ -359,7 +361,7 @@ void CompilerContext::appendInlineAssembly( ErrorList errors; ErrorReporter errorReporter(errors); - auto scanner = make_shared<Scanner>(CharStream(_assembly), "--CODEGEN--"); + auto scanner = make_shared<langutil::Scanner>(langutil::CharStream(_assembly), "--CODEGEN--"); auto parserResult = assembly::Parser(errorReporter, assembly::AsmFlavour::Strict).parse(scanner, false); #ifdef SOL_OUTPUT_ASM cout << assembly::AsmPrinter()(*parserResult) << endl; diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index a0d11017..93c8cc77 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -32,6 +32,7 @@ #include <libdevcore/Whiskers.h> using namespace std; +using namespace langutil; namespace dev { diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index c8d9d9d3..7a1dcd70 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -37,6 +37,7 @@ using namespace std; using namespace dev; +using namespace langutil; using namespace dev::solidity; namespace diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index bdf91fbf..57b513d2 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -36,6 +36,7 @@ #include <libdevcore/Whiskers.h> using namespace std; +using namespace langutil; namespace dev { diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp index 790ab309..6d71d36f 100644 --- a/libsolidity/codegen/LValue.cpp +++ b/libsolidity/codegen/LValue.cpp @@ -28,6 +28,7 @@ using namespace std; using namespace dev; +using namespace langutil; using namespace solidity; diff --git a/libsolidity/codegen/LValue.h b/libsolidity/codegen/LValue.h index f39eaee1..d854857b 100644 --- a/libsolidity/codegen/LValue.h +++ b/libsolidity/codegen/LValue.h @@ -55,17 +55,17 @@ public: /// Copies the value of the current lvalue to the top of the stack and, if @a _remove is true, /// also removes the reference from the stack. /// @a _location source location of the current expression, used for error reporting. - virtual void retrieveValue(SourceLocation const& _location, bool _remove = false) const = 0; + virtual void retrieveValue(langutil::SourceLocation const& _location, bool _remove = false) const = 0; /// Moves a value from the stack to the lvalue. Removes the value if @a _move is true. /// @a _location is the source location of the expression that caused this operation. /// Stack pre: value [lvalue_ref] /// Stack post: if !_move: value_of(lvalue_ref) virtual void storeValue(Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), bool _move = false) const = 0; + langutil::SourceLocation const& _location = {}, bool _move = false) const = 0; /// Stores zero in the lvalue. Removes the reference from the stack if @a _removeReference is true. /// @a _location is the source location of the requested operation virtual void setToZero( - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _removeReference = true ) const = 0; @@ -83,14 +83,14 @@ public: StackVariable(CompilerContext& _compilerContext, VariableDeclaration const& _declaration); unsigned sizeOnStack() const override { return 0; } - void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; + void retrieveValue(langutil::SourceLocation const& _location, bool _remove = false) const override; virtual void storeValue( Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _move = false ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _removeReference = true ) const override; @@ -109,14 +109,14 @@ class MemoryItem: public LValue public: MemoryItem(CompilerContext& _compilerContext, Type const& _type, bool _padded = true); unsigned sizeOnStack() const override { return 1; } - void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; + void retrieveValue(langutil::SourceLocation const& _location, bool _remove = false) const override; virtual void storeValue( Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _move = false ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _removeReference = true ) const override; private: @@ -137,14 +137,14 @@ public: /// Constructs the LValue and assumes that the storage reference is already on the stack. StorageItem(CompilerContext& _compilerContext, Type const& _type); unsigned sizeOnStack() const override { return 2; } - void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; + void retrieveValue(langutil::SourceLocation const& _location, bool _remove = false) const override; virtual void storeValue( Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _move = false ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _removeReference = true ) const override; }; @@ -159,14 +159,14 @@ public: /// Constructs the LValue and assumes that the storage reference is already on the stack. StorageByteArrayElement(CompilerContext& _compilerContext); unsigned sizeOnStack() const override { return 2; } - void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; + void retrieveValue(langutil::SourceLocation const& _location, bool _remove = false) const override; virtual void storeValue( Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _move = false ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _removeReference = true ) const override; }; @@ -181,14 +181,14 @@ class StorageArrayLength: public LValue public: /// Constructs the LValue, assumes that the reference to the array head is already on the stack. StorageArrayLength(CompilerContext& _compilerContext, ArrayType const& _arrayType); - void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; + void retrieveValue(langutil::SourceLocation const& _location, bool _remove = false) const override; virtual void storeValue( Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _move = false ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _removeReference = true ) const override; @@ -206,14 +206,14 @@ public: /// Empty unique_ptrs are possible if e.g. some values should be ignored during assignment. TupleObject(CompilerContext& _compilerContext, std::vector<std::unique_ptr<LValue>>&& _lvalues); unsigned sizeOnStack() const override; - void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; + void retrieveValue(langutil::SourceLocation const& _location, bool _remove = false) const override; virtual void storeValue( Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _move = false ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), + langutil::SourceLocation const& _location = {}, bool _removeReference = true ) const override; |