Commit Graph

733 Commits

Author SHA1 Message Date
chriseth
6797879128
Merge pull request #7647 from ethereum/virtual-5424
Implement virtual keyword
2019-11-19 13:21:27 +01:00
Daniel Kirchner
a0ae36ba70 Add selector member to public and external library functions. 2019-11-15 16:12:29 +01:00
chriseth
216e1749f4 Merge remote-tracking branch 'origin/develop' into develop_060 2019-11-14 13:42:46 +01:00
Mathias Baumann
5b8ff78176 Implement virtual keyword 2019-11-14 11:49:39 +01:00
Mathias Baumann
7d4e4b6088 Parse "virtual" keyword 2019-11-13 13:28:01 +01:00
djudjuu
e437443645 Inline assembly to AST json export 2019-11-13 12:13:22 +01:00
Daniel Kirchner
ce7268272d Allow obtaining the address of a library by conversion to `address`. 2019-11-12 17:09:13 +01:00
Daniel Kirchner
8148619d5b Merge branch 'develop' into develop_060 2019-11-12 10:32:41 +01:00
Mathias Baumann
e35a23bbcc Add `switch (..) to style checker 2019-11-11 17:44:21 +01:00
chriseth
5388c919f0 Some changes to "abstract". 2019-11-05 13:55:31 +01:00
Daniel Kirchner
3321fc56ea Split fallback function and introduce "fallback()" and "receive()" syntax. 2019-11-04 17:17:58 +01:00
Alexander Arlt
62950a9234 Support for abstract contracts. 2019-11-01 14:54:47 -05:00
Mathias Baumann
6c6a9054b2 Implement override checking 2019-10-30 17:31:33 +01:00
Mathias Baumann
5ff02c12e2 Add reference to contract in FunctionDefinition annotation 2019-10-30 17:31:33 +01:00
Mathias Baumann
b76106fc4a Parse override keyword for modifier definitions 2019-10-30 17:31:33 +01:00
chriseth
edf1e83fda Merge remote-tracking branch 'origin/develop' into develop_060 2019-10-28 15:21:49 +01:00
chriseth
07c67b98f6 Merge remote-tracking branch 'origin/develop' into HEAD 2019-10-28 12:12:52 +01:00
Christian Parpart
df729b3084 Make use of C++17 std::optional<> instead of boost::optional<>. 2019-10-28 11:39:30 +01:00
Mathias Baumann
c3e8023ad5 Fix wrong assert in overflow check 2019-10-23 14:59:34 +02:00
Gaith Hallak
62a62555bc Remove trailing spaces from JSON output 2019-10-02 19:02:35 +02:00
Gaith Hallak
9d34d7de2f Remove trailing spaces from JSON output 2019-10-02 18:01:47 +03:00
chriseth
f884373142 Merge branch 'origin/develop' into develop_060 2019-10-02 16:29:36 +02:00
Daniel Kirchner
7202ebb5b2 Fix internal compiler error for arrays of recursive structs. 2019-10-01 16:51:14 +02:00
Christian Parpart
00d7dac15f Fixes source location in warning for shadowing import delcarations. 2019-09-30 11:45:46 +02:00
chriseth
8e736a9f49 Type Checker for try/catch. 2019-09-23 17:22:56 +02:00
chriseth
a66c354698 AST for try and catch. 2019-09-23 17:22:09 +02:00
Leonardo Alt
43d6e00b14 Add push() for dynamic storage arrays 2019-09-17 13:47:33 +02:00
Daniel Kirchner
4782c800ec Initial introduction of array slices with partial implementation for dynamic calldata arrays. 2019-09-13 10:57:53 +02:00
Leonardo Alt
5cfe0b7670 Allow explicit conversion from address to address payable 2019-09-09 23:46:00 +02:00
Daniel Kirchner
5d69bdf81e Remove ASTPrinter. 2019-09-06 12:38:55 +02:00
krk
33f7f960cf Allow exponentials with signed base and unsigned power. 2019-09-04 17:32:47 +02:00
Mathias Baumann
24716404f8 Parse override keyword 2019-08-26 17:34:21 +02:00
Mathias L. Baumann
502bf01be2
Merge pull request #7278 from ethereum/develop
Merge develop into develop_060
2019-08-26 10:26:48 +02:00
Mathias Baumann
0e3ff25b4e Make sure json output array order is consistent
The source of the "contractDependencies" value was an std::map, thus
order was more or less random.
2019-08-19 17:42:03 +02:00
Daniel Kirchner
9f6fff2120 Replace casting of external functions to address by a member named "address". 2019-08-19 14:56:04 +02:00
Daniel Kirchner
b0a5666b43 Better error messages when writing to expressions that cannot be written to. 2019-08-14 17:59:48 +02:00
Leonardo Alt
7b22496b1f [SMTChecker] Fix ICE when inlining functions that use state vars and are in a different source 2019-08-09 17:50:52 +02:00
mingchuan
15631a7fbe Split calldataEncodedSize into calldataEncodedSize, calldataEncodedTailSize and calldataHeadSize and fix all usages. 2019-08-08 15:52:21 +02:00
rocky
7fd7cc1e76 Produce AST even when there are parser errors 2019-08-07 15:25:53 +02:00
Mathias Baumann
e887c06f6b FunctionType: Return correct stacksize for transfer/send 2019-08-01 13:56:09 +02:00
Christian Parpart
7b3aba81fb Adds a test to check_style.sh to check for spaces before colon (:) in range based for loops. 2019-06-24 17:32:58 +02:00
Daniel Kirchner
4d38df6920 Set state mutability of function type members `gas and value` to pure. 2019-06-13 18:27:53 +02:00
mingchuan
bf8af89bba
Fix assignment of struct containing array of mappings 2019-05-25 01:33:49 +08:00
chriseth
9a00729ce7 Provide dialect to Parser and InlineAssembly AST nodes. 2019-05-23 00:24:58 +02:00
Leonardo Alt
dcd6cb94bf Add function that retrieves first FunctionDefinition up the scope path 2019-05-09 09:15:11 +02:00
Leonardo Alt
371b37b660 Fix direct call to base class overloaded functions 2019-04-26 09:34:15 +02:00
chriseth
fb302c1c4f
Merge pull request #6473 from ethereum/libeventhash-6435
Fix external ABI type name for contracts
2019-04-18 12:53:34 +02:00
Mathias Baumann
0f4b53e9a0 Fix external ABI type name for contracts 2019-04-18 11:39:48 +02:00
Christian Parpart
9733ae7483
[libsolidity] TypeProvider: cleanup unnecessary std:: qualifiers 2019-04-17 14:45:29 +02:00
Christian Parpart
721bf367a3
[libsolidity] TypeProvider: eliminate redundant "Type" suffix in provider function signatures. 2019-04-17 14:42:07 +02:00
Christian Parpart
862b65d6e3
[libsolidity] remove ReferenceType::copyForLocationIfReference (use TypeProvider instead) 2019-04-17 13:25:03 +02:00
Christian Parpart
b83097bdc6
[libsolidity] Types: eliminate redundant MagicType::metaType() (use TypeProvider instead) 2019-04-17 12:59:48 +02:00
Christian Parpart
a99a460c79
[libsolidity] Types: remove some old comments 2019-04-17 12:00:33 +02:00
chriseth
4e2d4f02b0 Make data location explicit. 2019-04-16 23:22:08 +02:00
chriseth
2761aed1d3 Lazy-initialize string and bytes types. 2019-04-16 23:22:08 +02:00
chriseth
4656d7ca7d Change pre-created types to unique_ptr to avoid copying and moving. 2019-04-16 23:22:08 +02:00
Christian Parpart
58a45f2cb6 [libsolidity] TypeProvider: adds explicit uint256() accessor and removes default params in integerType(...). 2019-04-16 18:28:40 +02:00
Christian Parpart
59d4f54729 libsolidity: Be more restrictive to not allow any copy constructors at all in Type system.
This enforces us to be a little bit more historical in how to initialize
our std::array<>'s in TypeProvider.
2019-04-16 18:26:46 +02:00
Christian Parpart
a2a3b007f3 TypeProvider: storageType() to make all parameters explicit 2019-04-16 18:26:46 +02:00
Christian Parpart
bf43eebea9 libsolidity: Introducing TypeProvider API, for clear type system ownership. 2019-04-16 18:26:45 +02:00
chriseth
6b69c31703 Fix ABIEncoderV2 array overwrite bug. 2019-03-25 18:28:43 +01:00
Mathias Baumann
4c2b1c1f29 ArrayType::interfaceType(): Rename local variable to make more sense 2019-03-21 07:25:59 +01:00
Mathias Baumann
7d809df91a Add back StructType::recursive() 2019-03-21 07:25:59 +01:00
Mathias Baumann
8e899a0d32 Disallow internal function types as parameters for public/external library function 2019-03-21 07:25:57 +01:00
Mathias Baumann
0fbea8a1a0 Change return type for interfaceType() to ResultType 2019-03-21 07:25:28 +01:00
Mathias Baumann
84b68006ba Fix function calls with named arguments for overloaded functions 2019-03-20 14:54:41 +01:00
chriseth
48f0d41cc5
Merge pull request #6294 from ethereum/merge-canBeUsedExternally-and-interfaceType-6223
Merge interfaceType() canBeUsedExternally()
2019-03-14 18:12:07 +01:00
Mathias Baumann
4d060ef991 Merge interfaceType() canBeUsedExternally()
And cache the result for expensive calls.
2019-03-14 17:19:59 +01:00
Mathias Baumann
3b546acd57 Clarify documentation of ContractType::m_super 2019-03-14 15:59:26 +01:00
Erik Kundt
b9a7a88346 Improves Result<T> in order to prevent defects. 2019-03-14 14:33:28 +01:00
Mathias Baumann
e411a502fd Fix missing trailing dot in error message 2019-03-11 16:15:18 +01:00
Mathias Baumann
d70cb375cf isImplicitlyConvertibleTo(): Add better error messages 2019-03-11 13:38:02 +01:00
Mathias Baumann
9052a8f050 Move FunctionType::returnParameters() to CallableDeclaration
all the other functions of that type are also found there.
2019-03-06 11:13:01 +01:00
Mathias Baumann
b2262d67f0 Remove unused variable Contractdefinition::m_linearizedBaseContracts 2019-03-06 11:13:01 +01:00
Alex Beregszaszi
d2f493268b Provide access to the name of contracts. 2019-02-26 14:07:03 +00:00
Mathias Baumann
c65a96d189 Small documentation fixes in the code 2019-02-21 12:54:39 +01:00
chriseth
fb07462d82 Fix: Do use actual ABI signatures for events also in libraries instead of internal signature. 2019-02-20 14:35:24 +01:00
Daniel Kirchner
d74198b3cc Remove misleading note in Type::calldataEncodedSize. 2019-02-18 16:18:40 +01:00
Daniel Kirchner
0408130338
Merge pull request #6003 from ethereum/moreStyleChecks
Even more style checks.
2019-02-15 11:52:32 +01:00
Daniel Kirchner
809b9a95f9 Even more style checks. 2019-02-14 11:53:00 +01:00
Daniel Kirchner
32190dac48 Add stride helpers to ArrayType. 2019-02-14 10:51:39 +01:00
chriseth
1a823f0bf8 Fix tabs/spaces. 2019-02-13 17:05:48 +01:00
chriseth
17ea467e5b Fix style of "const". 2019-02-13 16:34:53 +01:00
Daniel Kirchner
0e4912a203 ABIEncoderV2: Implement calldata structs without dynamically encoded members. 2019-02-11 15:46:58 +01:00
chriseth
b5a2c66771
Merge pull request #5957 from ethereum/function-param-fix
Ensure function parameter names always matches parameter types length
2019-02-11 15:45:28 +01:00
chriseth
0c2d623ee4 Enable struct encoding. 2019-02-11 11:37:47 +01:00
Mathias Baumann
57c1c8b46c Ensure function parameter names always matches parameter types length 2019-02-11 10:57:57 +01:00
Alex Beregszaszi
ee09d54525 Change FIXMEs into TODOs where appropriate 2019-01-29 00:35:23 +00:00
chriseth
e3791d6dcf Fix reported packed encoded size for arrays and structs. 2019-01-23 11:13:22 +01:00
Alex Beregszaszi
7b759866cb
Merge pull request #5817 from ethereum/refactoring
Refactoring in TypeChecker and ContractDefinition
2019-01-18 11:36:49 +00:00
Daniel Kirchner
a766efc79f Add ContractDefinition::isInterface. 2019-01-18 12:11:35 +01:00
chriseth
a9fa2658d8 Add helper to show if contract can be deployed. 2019-01-17 20:36:48 +01:00
chriseth
e6fee257e6 Code generation for access to contract code. 2019-01-17 20:36:48 +01:00
chriseth
2fcfb216b5 Syntax for meta type information. 2019-01-17 20:36:48 +01:00
Christian Parpart
62fe57479e
make use of C++ = default constructor declarations as well as more non-static member initialization syntax. 2018-12-19 11:26:42 +01:00
Leonardo Alt
b185d01a26 Sort includes in libsolidity/ast 2018-12-17 15:33:15 +01:00
chriseth
baaefb4b42
Merge pull request #5619 from ethereum/cleanup-abc
Some code cleanup
2018-12-10 19:22:02 +01:00
Mathias Baumann
2f6dc2e773 Replace push_back with emplace_back where it makes sense 2018-12-10 19:02:39 +01:00
Yi Huang
81f703427e Add tests for implcit conversions from literals to fixed-point numbers. 2018-12-10 17:31:20 +01:00
Erik Kundt
e2395a3dcf Adds more detailed type errors and tests. 2018-12-07 12:35:35 +01:00
Erik Kundt
b2afb8cdda Adds an additional message to failing type conversions. 2018-12-07 11:55:53 +01:00
chriseth
5fde279d2a
Merge pull request #5514 from corollari/develop
Remove unary + from the type system
2018-12-06 10:27:09 +01:00
Albert
df08d79623 Fix #5470
Remove unary + from the type system
2018-12-06 01:54:04 +01:00
chriseth
3a378eae1a Restrict toHex to bytes. 2018-12-05 22:37:05 +01:00
Erik Kundt
e3accc6aa6 Simplifies Result<T> and prevents undefined behaviour. 2018-12-05 10:33:34 +01:00
Erik Kundt
05e74d096e Introduces Result<T> for operator and implicit conversion type checks. 2018-12-05 10:33:34 +01:00
Anurag Dashputre
82f5763e7a Fix internal compiler error for unimplemented base contract function. 2018-12-03 12:25:31 +01:00
chriseth
aaeb74f592
Merge pull request #5537 from ethereum/cp-SourceLocation-related-refactoring
[1/3] SourceLocation related refactoring.
2018-11-30 23:45:31 +01:00
Christian Parpart
c48a5264be
liblangutil: SourceLocation: adds (shared) pointer to underlying CharStream source, eliminating sourceName
Also, adapted affecting code to those changes.
2018-11-30 17:07:12 +01:00
chriseth
f6d013237d
Merge pull request #5538 from hydai/static_uint256
Replace IntegerType(256) with static function IntegerType::uint256()
2018-11-29 11:17:33 +01:00
Leonardo Alt
1d47919c0c Fix ICE when function type struct parameter has field of non-existent type 2018-11-29 10:38:47 +01:00
hydai
9326adc3db Replace IntegerType(256) with static function IntegerType::uint256() 2018-11-29 17:07:18 +08:00
chriseth
bc137c2eeb
Merge pull request #5485 from ethereum/refactorCallableFunction
Refactor callable function
2018-11-26 12:34:43 +01:00
Christian Parpart
ec47c8946b
Isolating libyul library API into its own namespace yul. 2018-11-23 14:29:00 +01:00
Christian Parpart
0f4ed52a71
Rewrite header paths to adapt to recent git mv of libsolidity/inlineasm to libyul 2018-11-23 11:18:57 +01:00
chriseth
92ba8a95f6 Make asCallableFunction to never fail and assert abount parameter size if bound instead. 2018-11-22 15:47:45 +01:00
chriseth
9e964852cc Rename 'asMemberFunction' to widen its purpose. 2018-11-22 15:24:45 +01:00
Christian Parpart
d67322a186 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
2018-11-21 19:13:44 +00:00
Christian Parpart
87821c53c3 Isolating files shared between Yul- and Solidity language frontend. 2018-11-21 18:58:12 +00:00
mordax
ea8b7d803e Removing redundant virtual from override function declaration
Remove trailing whitespace

Remove changelog change
2018-11-21 14:37:32 +00:00
chriseth
2cc304fd3f Fix for style. 2018-11-12 09:15:22 +01:00
chriseth
6bbedab383
Merge pull request #5265 from ethereum/cleanupsha3
Simplify sha3.
2018-11-09 15:39:57 +01:00
chriseth
cc2de07bc6
Merge pull request #5348 from ethereum/boostRationalNegativeDenominatorFix
Fix negative denominator in ``boost::rational`` during exponentiation.
2018-11-08 11:25:30 +01:00
chriseth
674e17c2a8 Performance: Replace string by special single-copy YulString class. 2018-11-07 19:30:27 +01:00
Daniel Kirchner
e036133d1b Fix negative denominator in `boost::rational` during exponentiation. 2018-11-06 10:52:10 +01:00
Erik Kundt
1d8e9af407 Fixes crash while encoding too large arrays. 2018-10-30 15:14:57 +01:00
chriseth
39687cf110 Remove unused AST utils. 2018-10-25 14:02:09 +02:00
Christian Parpart
f112377dd4
Refactor solidity::Token into an enum class with TokenTraits helper namespace 2018-10-22 17:00:51 +02:00
chriseth
e78b95d9d4 Renamed SHA3.{h,cpp} files. 2018-10-18 14:31:36 +02:00
Christian Parpart
4d5216c2e0 Fixes large rational number literals being wrongly interpreted.
Fixes #5052.
2018-10-09 14:36:49 +02:00
chriseth
7ff9a27979
Merge pull request #4734 from ethereum/astUpdate
JSON AST: replace ``isConstructor`` by ``kind`` which also supports fallbacks
2018-10-08 21:47:27 +02:00
Christian Parpart
9fb835b710 Fixes #5051 (introduced in #4684), effectively allowing underscores in address literals. 2018-10-02 15:37:15 +02:00
chriseth
db4f780283
Merge pull request #4962 from anurag-git/anurag_issue_3667-1
Removed default case from "ExpressionCompiler::visit(FunctionCall...)".
2018-10-01 13:24:26 +02:00
Anurag Dashputre
3321000f67 Removing extra default cases to force compile time error, instead of runtime. 2018-09-30 12:40:38 +05:30
Alex Beregszaszi
00b1b96eb4 Use better assertion messages for RationalNumberType::literalValue 2018-09-26 13:05:58 +01:00
chriseth
32112d6480
Merge pull request #5041 from liangdzou/fix_typo_in_doc
fix typo in docs and comments
2018-09-24 13:52:33 +02:00
Alex Beregszaszi
8f96fe698d
Merge pull request #5049 from ethereum/structtype-assert-annotation
Add assertion for annotated type in Structtype::canBeUsedExternally
2018-09-21 15:02:26 +01:00
Alex Beregszaszi
69ff61d149 Add assertion for annotated type in Structtype::canBeUsedExternally 2018-09-21 14:25:05 +01:00
liangdzou
f347dee812 fix typo 2018-09-21 09:27:33 +08:00
chriseth
dc9853bb6e
Merge pull request #5030 from ethereum/payableConversion
Make non-payable default for conversion to address.
2018-09-20 21:20:46 +02:00
liangdzou
44e8dfd393 fix typo 2018-09-20 22:54:57 +08:00
chriseth
d0461c49fe Make non-payable default for conversion to address. 2018-09-20 14:31:04 +02:00
Jordan Last
d0497aacc0 fixing rebase conflicts
add ElementaryTypes::BytesMemory and ElementaryTypes::StringMemory

fix rebase conflicts

fixing rebase conflicts

use make_shared instead of new

fix tabs and StateMutability parameter

create address and addressType functions, fix spaces in comment

fix typo and switch nonpayable to payable

fix spaces

fix comment again
2018-09-13 15:53:06 -06:00
Daniel Kirchner
ae35a58124 Add `stateMutability field to JSON AST for address` types. 2018-09-13 15:15:49 +02:00
Daniel Kirchner
12aaca1645 Add payable and non-payable state mutability to AddressType. 2018-09-13 15:15:49 +02:00
Daniel Kirchner
1ce3581a52 Accept `address payable` during parsing. 2018-09-11 14:52:23 +02:00
Daniel Kirchner
a434896458 Restore `isConstructor` in the legacy AST. 2018-09-11 14:47:25 +02:00
Daniel Kirchner
395ab9a872 Replace `isConstructor field in the JSON AST by a kind` field. 2018-09-11 14:47:25 +02:00
Daniel Kirchner
87804b6419 Split IntegerType into IntegerType and AddressType. 2018-09-05 12:19:14 +02:00
Daniel Kirchner
82f512a7d4 Add return data to bare calls. 2018-09-04 13:31:10 +02:00