Commit Graph

692 Commits

Author SHA1 Message Date
Alex Beregszaszi
9719cf38e6 Move InterfaceHandler from string to JSON 2016-11-15 15:55:25 +00:00
Alex Beregszaszi
ae8403ed08 Rename ErrorTag to invalidJumpLabel in inline assembly 2016-11-15 10:30:33 +00:00
Alex Beregszaszi
91367234d9 Support ErrorTag as a jump label in inline assembly 2016-11-15 10:30:12 +00:00
chriseth
028ab1fbfb Merge pull request #1375 from ethereum/inline-assembly-stack-height
Fix inline assembly stack warnings when using variables
2016-11-15 11:25:12 +01:00
Alex Beregszaszi
dad33f80dd Fix inline assembly stack warnings when using variables 2016-11-15 02:53:19 +00:00
Alex Beregszaszi
ac46834d7d Do not include a trailing new line in the ABI JSON output 2016-11-15 02:20:38 +00:00
Rhett Aultman
58e75c7a48 Unimplemented features moved to their own exception (#1361)
Unimplemented features moved to their own exception

InternalCompilerError is an exception that really should be reserved for
actual internal errors of the compiler.  Unimplemented features can now
use either solUnimplemented( ) or, if it should be conditional, then
solUnimplementedAssert( ).

* Revert some unimplemented exceptions, add handlers

The jsonCompiler and CommandLineInterface needed handlers for the
new UnimplementedFeatureException, and some cases I had moved on to
the new exception were better treated as real internal compiler
errors.

* Standardize on "Unimplemented feature" message
2016-11-14 20:41:58 +00:00
chriseth
7884a69243 Merge pull request #1367 from asinyagin/develop
Print canonical names of structs and enums in AST
2016-11-14 19:55:35 +01:00
chriseth
07e4cd6e32 Merge pull request #1372 from ethereum/invalid_enum_as_external_ret
Invalid enum as external ret
2016-11-14 19:46:25 +01:00
Yoichi Hirai
dbcbfafda8
codegen: overflow checking also during conversion from enums 2016-11-14 17:09:53 +01:00
Yoichi Hirai
1ff67b492a
codegen: add a missing break; 2016-11-14 16:14:59 +01:00
Alex Sinyagin
6db9fd498a Print canonical names of structs and enums in AST 2016-11-14 13:39:46 +00:00
chriseth
68e7763387 Merge pull request #1365 from walter-weinmann/develop
#1362: As it stands currently, the >>> operator will not be implemented.
2016-11-14 14:02:38 +01:00
Walter Weinmann
176c06f386 #1362: As it stands currently, the >>> operator will not be implemented. 2016-11-14 13:22:29 +01:00
Yoichi Hirai
81f5734cbe
codegen: move the enum overflow checking closer to the conversion into enums 2016-11-14 11:11:39 +01:00
Yoichi Hirai
20c2ca3992
ast, codegen: disallow conversion between different enum types 2016-11-11 17:48:03 +01:00
Yoichi Hirai
0a6c937dcb
codegen: shorten the overflow checking when converting into enums 2016-11-11 17:48:03 +01:00
Yoichi Hirai
eee629652e
parsing: ban empty enum definition. 2016-11-11 17:48:03 +01:00
Yoichi Hirai
98dcd883e4
codegen: check the value range after converting something to an enum element 2016-11-11 17:48:03 +01:00
Yoichi Hirai
e6098f0039
ast: add EnumType::numberOfMembers() 2016-11-11 17:47:48 +01:00
chriseth
7820f80192 Merge pull request #1355 from ethereum/chriseth-patch-2
Fix semicolons
2016-11-11 17:39:56 +01:00
Yoichi Hirai
6c15757618
Type checker: move the burden of computing mobile type to commonType
This solves #621
2016-11-11 15:51:54 +01:00
chriseth
1e845c279b Fix semicolons 2016-11-11 09:33:19 +01:00
Rhett Aultman
4524ad0870 Add support for do/while loops
This commit adds support for a standard do <statement> while <expr>;
form of statement.  While loops were already being supported; supporting
a do/while loop mostly involves reusing code from while loops but putting
the conditional checking last.
2016-11-10 07:07:25 -08:00
yann300
02416d4460 add payable to AST 2016-11-03 16:36:38 +01:00
chriseth
9920e88eea Clear all value types prior to storing. 2016-10-31 16:40:30 +01:00
Yoichi Hirai
3ca5900b8c
ast: ban signed EXP, fixing #1246 2016-10-25 16:49:10 +02:00
chriseth
762f7ac250 Suggest correct version for pragma and complain about pre-release version. 2016-10-25 13:45:50 +02:00
chriseth
2f7c847ce4 Merge pull request #1279 from ethereum/semver-helper
Export major/minor/patch helpers on SemVerVersion
2016-10-25 13:20:08 +02:00
Alex Beregszaszi
7a988555c3 Export major/minor/patch helpers on SemVerVersion 2016-10-25 12:13:41 +01:00
chriseth
e00a4b47c0 Merge pull request #1264 from ethereum/988
State variable under contract's name
2016-10-25 12:50:24 +02:00
Yoichi Hirai
59f6c18c2b
analysis: determine if a member access on a contract is an l-value 2016-10-24 19:31:57 +02:00
chriseth
f25aa0c68b More checks for missing mobile type. 2016-10-24 16:45:25 +02:00
Yoichi Hirai
5245a3cf74
codegen: refactor common code 2016-10-24 16:34:23 +02:00
Yoichi Hirai
acba7b92e5
codegen: if a member access has been resolved as a variable, follow that
This fixes at least the first example in #988
2016-10-24 16:34:23 +02:00
Yoichi Hirai
7cee39fc17
codegen: skip contract L for L.Foo where Foo is a type
Fixes #1116
2016-10-24 15:30:26 +02:00
chriseth
2b00804d1d Fix crash in throw. 2016-10-24 14:32:49 +02:00
chriseth
cb1fcaf6f6 Merge pull request #1240 from ethereum/1151
ast: super contract type does not contain native members
2016-10-24 11:45:54 +02:00
Yoichi Hirai
9d9380d30e
ast: add a null check 2016-10-21 13:01:45 +02:00
Yoichi Hirai
83e8fdecc5
ast: ContractDefinition::inheritableMembers contains enums as well as structs
This fixes #1131
2016-10-21 13:01:45 +02:00
Alex Beregszaszi
7b0fb5d06b Support variable references within modifiers for inline assembly 2016-10-20 23:45:13 +01:00
Yoichi Hirai
7887045a48
ast: simplifications suggested by @chriseth 2016-10-20 16:09:52 +02:00
Yoichi Hirai
ff9039b2a8
When a contract type is super, its members do not contain the functions of itself
Fixes #1151
2016-10-20 16:09:52 +02:00
Alex Beregszaszi
0e33b63468 Allow warnings for inline assembly block 2016-10-20 13:25:28 +01:00
Alex Beregszaszi
c3330faf21 Issue warnings if stack is not balanced after inline assembly block 2016-10-20 13:25:28 +01:00
Alex Beregszaszi
0dd75ac100 Use warning function in TypeChecker 2016-10-20 13:25:28 +01:00
Alex Beregszaszi
7ac27c957e Use >> (SAR) to denote constant shifts 2016-10-20 00:03:09 +01:00
Alex Beregszaszi
33250eef9e Reject negative shifts within constants 2016-10-20 00:03:09 +01:00
RJ
48f2028911 Support shifting constants 2016-10-20 00:03:09 +01:00
Alex Beregszaszi
d18e56661d Disallow unsupported RValues in inline assembly 2016-10-19 20:44:15 +01:00
Alex Beregszaszi
9616470f67 Disallow magic variables in inline assembly 2016-10-19 20:44:15 +01:00
Alex Beregszaszi
fdd1108c1c Omit non-convertible bound functions 2016-10-19 10:41:04 +01:00
Alex Beregszaszi
003359a0b6 Ensure that bound functions cannot be defined without self type 2016-10-19 10:41:04 +01:00
Yoichi Hirai
d2470a3e39
super's size on stack is zero, because the expression compiler does not push an address.
This is different from `this`, which is translated to `ADDRESS` instruction.
2016-10-18 14:17:49 +02:00
Yoichi Hirai
8e11bac8de
Check if a fixedBytes fits an integer type
before looking up the size of the integer type.

Fixes #1150.
2016-10-13 20:17:13 +02:00
Alex Beregszaszi
48ac970677 Merge pull request #1169 from ethereum/inline-assembly-tags
Fix assignment after tags in inline assembly
2016-10-12 00:00:28 +01:00
chriseth
821fe6e916 Merge pull request #1181 from ethereum/formal_ignore_pragma
formal: ignore pragmas during Why3 code generation
2016-10-11 16:29:32 +02:00
Alex Beregszaszi
d0791fb365 Fix assignment after tags in inline assembly 2016-10-11 12:28:49 +01:00
Yoichi Hirai
ab1f4632aa Chack for non-version pragmas 2016-10-11 00:07:11 +02:00
Yoichi Hirai
092e5829d8 formal: ignore pragmas during Why3 code generation
Fixes #1177
2016-10-11 00:01:29 +02:00
Yoichi Hirai
7ae68e1e47 Fix pragma keyword check
Fixes #1192
2016-10-11 00:00:22 +02:00
chriseth
d3f410d8a8 Merge pull request #1189 from NicolaiSoeborg/develop
Add HexLiteral to grammar, fixes #1186
2016-10-10 23:41:55 +02:00
Nicolai
e923a5e190 Fix: HexLiteral must be even number of nibbles
solc even allow 0 nibbles:
bytes a = hex"";
2016-10-10 23:08:44 +02:00
chriseth
0b1d449057 Merge pull request #1168 from ethereum/rename-dev-sha3
Rename dev::sha3 to dev::keccak256
2016-10-10 21:23:27 +02:00
Nicolai
f6195c0a46 Add HexLiteral to grammar, fixes #1186 2016-10-10 19:42:42 +02:00
Alex Beregszaszi
ae0477744c Support address in inline assembly 2016-10-06 22:05:01 +01:00
Alex Beregszaszi
34df80c502 Add alias keccak256() for sha3() 2016-10-06 16:34:41 +02:00
Alex Beregszaszi
aefb6e5fcf Rename dev::sha3 to dev::keccak256 2016-10-06 14:53:40 +01:00
Alex Beregszaszi
6afdee5958 Support both suicide/selfdestruct in inline assembly 2016-10-06 12:44:33 +01:00
chriseth
212e016091 Merge pull request #1104 from ethereum/fixmemcosts
Fix memory resize costs during call
2016-09-17 12:30:41 +02:00
chriseth
5a45990458 Access output memory area so that we do not pay for resize during call. 2016-09-17 11:29:54 +02:00
chriseth
727c6fac85 Allow value transfer to library functions. 2016-09-17 11:29:27 +02:00
chriseth
031fd568cc Fix crash for TypeName[k]. 2016-09-15 18:16:34 +02:00
Yoichi Hirai
4337e70cca Prepare for leaky exceptions
Now toFormalType() reports errors by exceptions, they will be
sometimes leaked to the wider context.  This commits adds a catch.
2016-09-09 20:15:13 +02:00
Yoichi Hirai
ac7c6ae7d2 toFormalType reports errors by an exception
This allows error reporting without passing `ASTNode` to `toFormalType()`
2016-09-09 20:15:08 +02:00
Yoichi Hirai
c861cf579d Translate mapping types into Why3 arrays when keys are integers
Even when the keys are signed the translation is supposed to work
because Why3 arrays allow negative indices.
2016-09-09 19:11:15 +02:00
chriseth
2c4e9ece07 Merge pull request #1047 from pirapira/address-in-prelude
formal verification: Add Address module in the WhyML prelude
2016-09-09 17:34:52 +02:00
chriseth
6a55405160 Fix problem with release version string. 2016-09-08 17:56:28 +02:00
Yoichi Hirai
a98edb22e5 Add Address module in the WhyML prelude
In the `--formal` output, this commit adds a module called `Address`,
which defines the address type as unsigned integer type bounded at
2^160-1.
2016-09-07 20:39:23 +02:00
chriseth
ce11580988 Merge pull request #1041 from pirapira/typo_and_whitespace
Fix a typo and a whitespace inconsistency
2016-09-07 20:05:30 +02:00
chriseth
f4172d342a Merge pull request #1044 from pirapira/todo_item_to_issue
Append an issue id #1043 to a @todo comment about it
2016-09-07 18:23:22 +02:00
Yoichi Hirai
0a8f0fb051 Append an issue id #1043 to a @todo comment about it 2016-09-07 15:21:02 +02:00
Yoichi Hirai
c9b23d9829 Fix a typo and whitespaces 2016-09-07 14:29:01 +02:00
Alex Beregszaszi
2d9c407456 Include assert for selfType on bound functions to avoid crash 2016-09-06 22:10:51 +01:00
Alex Beregszaszi
7af8ecc27a Constructor must be internal or public 2016-09-06 17:53:13 +02:00
Alex Beregszaszi
319ec34093 Reject constant constructors 2016-09-06 17:31:29 +02:00
chriseth
462fc84e53 Merge pull request #1016 from ethereum/reserved
Report the usage of reserved keywords more nicely
2016-09-06 15:52:44 +02:00
chriseth
3588125692 Merge pull request #1014 from ethereum/strict-fallback
Reject constant modifier on the fallback function
2016-09-06 15:51:45 +02:00
chriseth
fb73da30d8 Merge pull request #1011 from walter-weinmann/wwe_grammar
Changes related to issues #984, #989, #999, #1001 and #1004.
2016-09-06 15:43:06 +02:00
chriseth
5ade1bc20f Merge pull request #1008 from ethereum/stipendwithsend
Provide gas stipend manually for send(0).
2016-09-06 15:37:05 +02:00
Alex Beregszaszi
a13c5b3157 Raise proper error on reserved keywords 2016-09-06 12:03:05 +01:00
Alex Beregszaszi
cfb6dfc35e Introduce isReservedKeyword() 2016-09-06 12:01:02 +01:00
Alex Beregszaszi
6ec40b3cde Reject constant modifier on the fallback function 2016-09-06 11:40:00 +01:00
chriseth
9ca7472089 Provide gas stipend manually for send(0). 2016-09-06 12:37:01 +02:00
Alex Beregszaszi
496b7ea1d2 Reserve view and pure as keywords 2016-09-06 11:37:00 +01:00
chriseth
f687635e47 Merge pull request #665 from axic/feature/accept-ether
BREAKING: Add payable modifier
2016-09-06 12:25:19 +02:00
chriseth
171c74843b Merge pull request #995 from chriseth/fixutf8astjson
Do not emit non-utf8 strings for ast json.
2016-09-06 12:25:04 +02:00
walter-weinmann
70d91462db Considering comment from @chriseth regarding FunctionCall. 2016-09-06 11:53:46 +02:00
chriseth
114502f8ad Merge pull request #1006 from ethereum/nenewaccountgas
Do not pay new account gas.
2016-09-06 11:13:31 +02:00
chriseth
dff9633084 Test and fixes for payable fallback in ABI. 2016-09-06 10:59:13 +02:00
chriseth
384f189a6a Tests for payable / private combination. 2016-09-06 10:58:56 +02:00
walter-weinmann
215fc04857 Considering comments from @chriseth regarding ExpressionStatement and FunctionCall. 2016-09-06 05:26:18 +02:00
chriseth
1eb7ddbb09 Make constant and payable mutually exclusive. 2016-09-05 21:28:28 +02:00
chriseth
9c64edf110 Change function type to include and propagate payable and constant modifier. 2016-09-05 21:28:28 +02:00
Alex Beregszaszi
962531af96 Merged in changes from chriseth/payable 2016-09-05 21:28:28 +02:00
Alex Beregszaszi
75d556a2cf Do not include the payable keyword for constructors 2016-09-05 21:28:18 +02:00
Alex Beregszaszi
a34f2f1a31 Support payable keyword for functions 2016-09-05 21:28:18 +02:00
walter-weinmann
8f233b545f Changes related to issues #984, #989, #999, #1001 and #1004. 2016-09-05 18:58:58 +02:00
Yoichi Hirai
e2b787cdd0 Merge pull request #1005 from ethereum/modifierbody
Require ";" after "_"
2016-09-05 18:28:32 +02:00
chriseth
be6a5f44d7 Merge pull request #993 from chriseth/fixshacrash
Guard encoding crashes with assertions.
2016-09-05 18:09:32 +02:00
chriseth
bf3f45c948 Improve error message. 2016-09-05 17:11:23 +02:00
chriseth
3b2174f7a8 Update grammar.txt to reflect the change. 2016-09-05 16:13:31 +02:00
chriseth
69c175fe22 Do not pay new account gas.
If we checked that the target contract exists, we do not have
to pay the "new account gas".
2016-09-05 15:52:44 +02:00
chriseth
02984b8de1 Require ";" after "_" 2016-09-05 14:54:50 +02:00
chriseth
24ffc38575 Do not use internal types for event parameters. 2016-09-02 00:39:30 +02:00
chriseth
ada31fa9b7 Do not emit non-utf8 strings for ast json. 2016-09-02 00:22:03 +02:00
chriseth
4134834ff3 Guard encoding crashes with assertions. 2016-09-01 20:07:14 +02:00
chriseth
b5d941d3d9 Merge pull request #935 from chriseth/pragma
Version pragma
2016-09-01 11:02:50 +02:00
chriseth
d87450b9b2 Use version string (including prerelease) for pragma matching. 2016-09-01 00:02:51 +02:00
chriseth
3c412ed2f6 Version pragma. 2016-09-01 00:02:51 +02:00
Dimitry
061aee2e97 fix CompilerStack::absolutePath 2016-08-31 22:10:20 +03:00
chriseth
4bfe09897e Make fallback function throw by default. 2016-08-30 15:31:50 +02:00
chriseth
cf974fd103 Merge pull request #664 from axic/feature/interface-fallback
Introduce fallback entry in the ABI
2016-08-30 15:21:19 +02:00
Bob Summerwill
91d4fa477c Merge pull request #941 from chriseth/versionString
Version string
2016-08-26 22:58:32 -07:00
Alex Beregszaszi
36a567cd61 Introduce fallback entry in the ABI 2016-08-26 19:03:46 +01:00
chriseth
fb7836d87b Merge pull request #897 from Denton-L/remove-standard
BREAKING: Remove standard contracts
2016-08-26 19:32:18 +02:00
chriseth
54ab787b83 Make versioning semver compatible and force commit hash availability. 2016-08-26 10:14:44 +02:00
chriseth
21b6aa92ff Disallow fallback function to return values. 2016-08-26 00:07:50 +02:00
chriseth
cab0f5448f Merge pull request #921 from chriseth/astjsoncleanup
JSON AST: Some attribute cleanup. Add linearized base contracts.
2016-08-23 17:14:13 +02:00
chriseth
345c0f36fb Fix crash when using json compiler with exponentiation. 2016-08-20 03:45:39 +02:00
Denton Liu
e00f802f72 Remove standard contracts 2016-08-19 10:34:50 -04:00
chriseth
35276d99e0 JSON AST: Some attribute cleanup. Add linearized base contracts. 2016-08-19 13:05:12 +02:00
Alex Sinyagin
4b9eb299d0 Rename root AST JSON node to SourceUnit 2016-08-18 15:38:20 +00:00
Alex Sinyagin
4387d8bbe3 Do not add children to EnumValue and PlaceholderStatement elements in JSON AST 2016-08-18 13:29:44 +00:00
Alex Sinyagin
9139d763d3 Use the full names for JSON AST nodes 2016-08-18 13:12:15 +00:00
Alex Sinyagin
5061eb2b2b Move creation of the root element of JSON AST to the SourceUnit visitor 2016-08-18 12:51:17 +00:00
Alex Sinyagin
406f3a4b5d Add ast json converter for PlaceholderStatement 2016-08-18 12:30:00 +00:00
Alex Sinyagin
e9c894c9f8 Add ast json converter for ArrayTypeName 2016-08-18 12:30:00 +00:00
Alex Sinyagin
bdc2436ae3 Add ast json converter for ModifierInvocation and EventDefinition 2016-08-18 12:30:00 +00:00
Alex Sinyagin
a5d15e6895 Add ast json converter for ModifierDefinition 2016-08-18 12:29:59 +00:00
Alex Sinyagin
95832da16e Add ast json converter for EnumValue 2016-08-18 12:29:59 +00:00
Alex Sinyagin
a9e04217a4 Add ast json converter for EnumDefinition 2016-08-18 12:29:59 +00:00
Alex Sinyagin
40ca2c9e97 Add ast json converter for UsingForDirective 2016-08-18 12:29:59 +00:00
Alex Sinyagin
9e7fc12463 Add a ast json converter for InheritanceSpecifier 2016-08-18 12:29:59 +00:00
chriseth
c282ab379a Merge pull request #918 from winsvega/solremove4
remove solidity --interface
2016-08-17 17:55:40 +02:00
chriseth
b2507e9f10 Merge pull request #839 from chriseth/checkcode
BREAKING: Make function calls throw if target does not have code.
2016-08-17 16:44:15 +02:00
chriseth
d6579a0a5f Merge pull request #888 from chriseth/throwOnDivZero
Throw on division by zero.
2016-08-17 16:43:13 +02:00
Dimitry
e5e2597702 remove solidity --interface 2016-08-17 12:39:10 +03:00
chriseth
774bb8ab3b Make function calls throw if target does not have code.
Low-level calls still just execute and will actually report "success".
This allows `x.call.value(y)()` for x being a non-contract account.
2016-08-17 11:30:40 +02:00
chriseth
9c83109549 BREAKING: return only exits current function/modifier 2016-08-17 11:29:31 +02:00