chriseth
c111d6e27e
Merge pull request #1491 from ameten/refactoring
...
Just refactored some code
2016-12-12 21:43:04 +01:00
Federico Bond
9ed65f2ab9
Include visibility level for functions in AST
2016-12-12 16:21:57 -03:00
chriseth
2738045030
Cleaner shift handling and type conversion for binary operations.
2016-12-12 11:12:12 +01:00
chriseth
2df60bec92
Type after shift should be type of left operand.
2016-12-12 11:12:12 +01:00
Alex Beregszaszi
b8b4f5e9f9
Support bitshifting in variables
2016-12-12 11:12:10 +01:00
chriseth
bfa4f45116
Split memcopy into three functions.
2016-12-11 17:57:15 +01:00
chriseth
4184525d4a
Fix inline assembly.
2016-12-11 17:57:15 +01:00
Alex Beregszaszi
efd7b4bfbb
Reset stack height after inline assembly block
2016-12-11 17:57:15 +01:00
Alex Beregszaszi
4a11200a27
Better assert message for appendInlineAssembnly
2016-12-11 17:57:15 +01:00
Alex Beregszaszi
b93589b3b6
Implement identity call in inline assembly
2016-12-11 17:57:15 +01:00
Alex Beregszaszi
bf5dac1fb2
Turn off the identity precompile for testing
2016-12-11 17:57:15 +01:00
Alex Beregszaszi
1bf412d9fd
Implement CompilerUtils::memoryCopy using inline assembly
2016-12-11 17:57:15 +01:00
Alex Beregszaszi
4abc8ab5a9
Add usingIdentity option to CompilerUtils::memoryCopy
2016-12-11 17:57:15 +01:00
chriseth
d2b8bdd016
Merge pull request #1464 from federicobond/warn-msgvalue
...
Warn about using msg.value in non-payable function
2016-12-11 16:46:06 +01:00
Federico Bond
df76230240
Fix names of JSON AST nodes
2016-12-11 02:07:08 -03:00
Federico Bond
05139500fb
Warn about using msg.value in non-payable function
2016-12-08 16:22:13 -03:00
Danil Nemirovsky
db42294a20
- fixed a misprint.
2016-12-08 21:33:09 +03:00
chriseth
84443eb560
Merge pull request #1351 from ethereum/truncate_bit
...
Truncate a boolean from calldata into one bit
2016-12-08 16:15:35 +01:00
chriseth
b201e148fa
Merge pull request #1465 from ethereum/missing_keywords
...
document missing keywords
2016-12-06 13:47:30 +01:00
Alex Beregszaszi
86d54c02cd
Throw if calling the identity precompile (memoryCopy) failed
2016-12-02 13:18:39 +00:00
Yoichi Hirai
43b56a61aa
parsing: default
and null
are reserved keywords
2016-12-02 11:52:11 +01:00
chriseth
f1907bbb12
Add the _runs
parameter.
2016-12-01 16:04:00 +01:00
Alex Beregszaszi
f869792eec
Fix type of optimizeRuns
2016-12-01 16:03:59 +01:00
chriseth
6a7ff039df
Use CBOR encoding.
2016-12-01 16:03:59 +01:00
chriseth
1e35526eb6
Fix tests.
2016-12-01 16:03:59 +01:00
chriseth
91ecc4533d
Add swarm hash to the end of the bytecode.
2016-12-01 16:03:59 +01:00
chriseth
659b635b2d
Make sure some keys are present.
2016-12-01 16:03:59 +01:00
chriseth
e666f8cda7
Incorporate comments.
2016-12-01 16:03:59 +01:00
chriseth
5789eaa78d
Metadata stamp.
2016-12-01 16:03:59 +01:00
chriseth
55a719a79c
Merge pull request #1462 from ethereum/fix-incorrect-assertion
...
codegen: assertion did not assert non-nullness
2016-12-01 15:14:31 +01:00
chriseth
2f9a91a034
Merge pull request #1463 from ethereum/duplicate-assignment
...
codegen: this commit removes one of duplicate assignments
2016-12-01 15:11:35 +01:00
Yoichi Hirai
1e791f30aa
codegen: this commit removes one of duplicate assignments
2016-12-01 12:03:25 +01:00
Yoichi Hirai
e29047b24d
codegen: assertion did not assert non-nullness
...
This commit strengthens an assertion so that it makes sure that a pointer is not null.
Moreover, `isLocalVariable(variable)` is now positively asserted, following the error message.
2016-12-01 11:58:34 +01:00
Yoichi Hirai
d77c8f730c
codegen: clean not only booleans but all types before storing them into memory
2016-11-30 17:42:21 +01:00
Yoichi Hirai
547deec4be
codegen: clean any data from the input
2016-11-30 17:42:03 +01:00
Yoichi Hirai
fb9babce54
codegen: truncate booleans before they enter storage
2016-11-30 17:41:51 +01:00
Yoichi Hirai
0123e74a2e
codegen: cleanup booleans before storing them into memory
2016-11-30 17:41:46 +01:00
Yoichi Hirai
03ccc6df70
codegen: truncate a boolean calldata down to one bit
2016-11-30 17:41:38 +01:00
Yoichi Hirai
eaab712944
parser: recognize an end of comment of the form **/
at the end of a multi-line doc comment
...
This fixes #1433
2016-11-30 17:28:07 +01:00
Alex Beregszaszi
2962426d53
Include the grammar verbatim in the documentation
2016-11-30 12:20:13 +00:00
Alex Beregszaszi
a9e92cb686
Rename dev::validate to dev::validateUTF8
2016-11-28 22:28:21 +00:00
Alex Beregszaszi
c01426efec
Make position optional in dev::validate
2016-11-28 22:27:55 +00:00
Alex Beregszaszi
f1bc979c0f
Use solUnimplemented wherever possible
2016-11-28 09:51:02 +00:00
chriseth
d7677826d4
Merge pull request #1395 from ethereum/grammar
...
Properly define the pragma directive in the grammar
2016-11-25 16:58:30 +01:00
chriseth
3a8a0708ff
Merge pull request #1381 from ethereum/overflown_enum_compared
...
Enum overflow checking before writing to storage
2016-11-25 16:22:12 +01:00
Yoichi Hirai
0be5859503
codegen: cleanup values to fit in storage bytes
2016-11-25 15:50:46 +01:00
Yoichi Hirai
548b7ce42d
codegen: storing of non-value types; add some assertions
2016-11-25 15:45:18 +01:00
Yoichi Hirai
fa486f5b44
codegen: shorten the bit truncation
2016-11-25 15:45:18 +01:00
Yoichi Hirai
9d25b5601e
codegen: merge type conversion and cleaning up
2016-11-25 15:45:18 +01:00
Yoichi Hirai
3fb9625127
codegen: document _chopSignBits parameter of convertType function
2016-11-25 15:45:17 +01:00
Yoichi Hirai
ea628001d5
codegen: add an option to CovertType so that it can truncate sign bits
2016-11-25 15:45:16 +01:00
Yoichi Hirai
56d6641086
codegen: cleanup stored values in a more consistent way
2016-11-25 15:44:36 +01:00
chriseth
da566b956e
Indentation.
2016-11-25 14:36:44 +01:00
Yoichi Hirai
e136ec8704
ast: string literals that are not valid UTF are not convertible to strings
2016-11-25 13:36:06 +01:00
Yoichi Hirai
5b8a773986
codegen: cleanup value types before storing them
2016-11-24 11:31:45 +01:00
VoR0220
3f9f725737
Fix licensing headers
...
Signed-off-by: VoR0220 <rj@erisindustries.com>
2016-11-23 12:22:33 +01:00
Alex Beregszaszi
92f1c9d492
Properly define the pragma directive in the grammar
2016-11-18 03:15:24 +00:00
Alex Beregszaszi
910269a29f
Add appendCallValueCheck
2016-11-17 17:23:35 +00:00
Alex Beregszaszi
60e9c901e9
Include payable for the constructor in the ABI
2016-11-17 17:23:35 +00:00
Alex Beregszaszi
ceeb8f4a2b
Add payable check for constructor in codegen
2016-11-17 17:23:35 +00:00
chriseth
2c14a96820
Some more assertions and style changes.
2016-11-16 15:09:01 +01:00
chriseth
ec31d08775
Change encoding to address-funid and add "function" as ABI type.
2016-11-16 14:37:19 +01:00
chriseth
7a292c9a05
Fix parser for function type disambiguity.
2016-11-16 14:37:19 +01:00
chriseth
0335ed4cb4
Simple peephole optimizer that is activated even if not requested.
2016-11-16 14:37:19 +01:00
chriseth
22b4d1b29a
Check that no internals are used in any external function type.
2016-11-16 14:37:18 +01:00
chriseth
e51f852504
Converted sub assembly to smart pointer.
2016-11-16 14:37:18 +01:00
chriseth
e543bd34c0
Stored combined creation and runtime tags.
...
Includes a change to Assembly to allow tags from sub-assemblies to be
used.
Sorry, this get a bit bigger than I thought.
2016-11-16 14:37:18 +01:00
chriseth
746266b8fc
ABI: Use external function.
2016-11-16 14:37:18 +01:00
chriseth
925d674146
Disallow payable internal functions.
2016-11-16 14:37:18 +01:00
chriseth
f7a62c1e69
Mention "payable" in the documentation.
2016-11-16 14:37:18 +01:00
chriseth
e1df3bd77f
Fix tests.
2016-11-16 14:37:18 +01:00
chriseth
f21f794f3c
delete for function types
2016-11-16 14:37:18 +01:00
Yoichi Hirai
c9f9b2ab4d
codegen: add a compilation mode and a runtime context to CompilerContext
2016-11-16 14:37:18 +01:00
chriseth
5011d6339a
Added function types to the grammar.
2016-11-16 14:37:18 +01:00
chriseth
47794c1da4
Implement uninitialized storage functions.
2016-11-16 14:37:18 +01:00
chriseth
cc847df3c2
Bugfix in code generator.
2016-11-16 14:37:18 +01:00
chriseth
ff3553a348
Change alignment.
2016-11-16 14:37:18 +01:00
chriseth
62492b67e7
Changelog entry and small fixes.
2016-11-16 14:37:18 +01:00
chriseth
95d7555e3c
External functions in storage.
2016-11-16 14:37:17 +01:00
chriseth
6f19559de0
Fix some type checks and tests for internal / external function parameters.
2016-11-16 14:37:17 +01:00
chriseth
97a3588701
Function type state variables.
2016-11-16 14:37:17 +01:00
chriseth
dd173f83e3
Code generator for function types.
2016-11-16 14:37:17 +01:00
chriseth
cc8583ec7d
Function types.
2016-11-16 14:37:17 +01:00
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