Commit Graph

424 Commits

Author SHA1 Message Date
chriseth
3fed790a56 Type identifiers. 2017-01-19 13:23:57 +01:00
chriseth
23a654ade8 Fix default function type name visibility. 2017-01-19 11:11:40 +01:00
Federico Bond
d40ae663ec Fix typo in comment 2017-01-18 12:43:23 -03:00
chriseth
28a05e5aa3 Merge pull request #1581 from ethereum/fixosx
Fix JSON output on macos.
2017-01-18 15:41:39 +01:00
chriseth
005e190885 Merge pull request #1397 from roadriverrail/contract_collision
Error out when contracts collide on name
2017-01-18 14:28:00 +01:00
chriseth
c16e141ffb Fix JSON output on macos. 2017-01-18 14:09:40 +01:00
chriseth
99eaadd2cd Deterministic AST node identifiers. 2017-01-17 10:45:45 +01:00
Rhett Aultman
f10bf36ae3 Move fullyQualified() name to Declaration 2017-01-16 12:32:57 -05:00
Rhett Aultman
0c98e4b2da Stylistic corrections 2017-01-16 12:32:57 -05:00
Rhett Aultman
8f25bd54e3 Drop ':' if the source file name is empty
A large number of tests compile contracts while passing in an empty
string for the source name.  This leads to it being keyed by the name
":<contract>", while the tests try to look it up under the name
"<contract>".  This change resolves that issue by dropping the ':' in
cases where there is, effectively, no source file to prepend anyway.
2017-01-16 12:32:57 -05:00
Rhett Aultman
071b936b37 Only avoid collision if it's the same file
@chriseth had suggested that it would be better if contracts were
referenced in a file:contract notation, and that we output .bin files
that prepend original path names if necessary to avoid a collision.

This commit is mostly a draft; it still needs to be run through the test
suite.
2017-01-16 12:32:57 -05:00
Yoichi Hirai
abc24420a7
ast: events have FunctionType too 2017-01-11 20:06:59 +01:00
Yoichi Hirai
eda147f47b
ast: add Declaration::functionType() 2017-01-11 19:55:50 +01:00
Yoichi Hirai
6a312233fc
ast, codegen: enable accessing events through contract names.
Fixes #1286
2017-01-02 17:59:20 +01:00
Yoichi Hirai
f8fe6e4f7c Merge pull request #1503 from federicobond/json-visibility
Include visibility level for functions in AST
2016-12-14 17:23:14 +01:00
Yoichi Hirai
18f8f29c0a Merge pull request #1487 from ethereum/shift-ops
Shift operators
2016-12-14 16:31:27 +01:00
Federico Bond
de720e643d Improve error message when trying to modify constant variables 2016-12-13 00:32:37 -03: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
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
chriseth
91ecc4533d Add swarm hash to the end of the bytecode. 2016-12-01 16:03:59 +01:00
chriseth
5789eaa78d Metadata stamp. 2016-12-01 16:03:59 +01: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
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
VoR0220
3f9f725737 Fix licensing headers
Signed-off-by: VoR0220 <rj@erisindustries.com>
2016-11-23 12:22:33 +01: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
22b4d1b29a Check that no internals are used in any external function type. 2016-11-16 14:37:18 +01:00
chriseth
925d674146 Disallow payable internal functions. 2016-11-16 14:37:18 +01:00
chriseth
f21f794f3c delete for function types 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
6f19559de0 Fix some type checks and tests for internal / external function parameters. 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 Sinyagin
6db9fd498a Print canonical names of structs and enums in AST 2016-11-14 13:39:46 +00:00
Yoichi Hirai
20c2ca3992
ast, codegen: disallow conversion between different enum types 2016-11-11 17:48:03 +01:00
Yoichi Hirai
e6098f0039
ast: add EnumType::numberOfMembers() 2016-11-11 17:47:48 +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
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
Yoichi Hirai
3ca5900b8c
ast: ban signed EXP, fixing #1246 2016-10-25 16:49:10 +02:00
chriseth
f25aa0c68b More checks for missing mobile type. 2016-10-24 16:45:25 +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
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
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
aefb6e5fcf Rename dev::sha3 to dev::keccak256 2016-10-06 14:53:40 +01:00
Alex Beregszaszi
2d9c407456 Include assert for selfType on bound functions to avoid crash 2016-09-06 22:10:51 +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
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
a34f2f1a31 Support payable keyword for functions 2016-09-05 21:28:18 +02:00
chriseth
ada31fa9b7 Do not emit non-utf8 strings for ast json. 2016-09-02 00:22:03 +02:00
chriseth
3c412ed2f6 Version pragma. 2016-09-01 00:02:51 +02: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
0d894a6832 Merge pull request #844 from Denton-L/remove-after
BREAKING: Remove after
2016-08-12 15:09:55 +02:00
Alex Sinyagin
cbedc7b343 Fix Mapping and InlineAssembly in JSON AST 2016-08-11 17:00:19 +00:00
Alex Sinyagin
a7ff352d38 Fix JSON AST structure 2016-08-11 17:00:19 +00:00
Denton Liu
faf0b3f669 Remove After from Types.cpp 2016-08-11 10:15:59 -04:00
chriseth
55858de1e9 Merge pull request #794 from chriseth/fixastsource
Fix segfault in ast output.
2016-08-10 16:58:17 +02:00
Alex Beregszaszi
5d9347f022 Remove dev::utf8 namespace 2016-08-08 20:05:31 +01:00
Alex Beregszaszi
f1df3dee53 Use size_t in dev::utf8::validate() 2016-08-08 20:05:31 +01:00
Alex Beregszaszi
e8c2e87397 Use utf8::validate in StringLiteral::toString 2016-08-08 19:57:41 +01:00
Alex Beregszaszi
bf76321c9e Move LiteralString::toString from the header 2016-08-08 19:08:31 +01:00
chriseth
ac8e726970 Fix segfault in ast output. 2016-08-08 19:10:17 +02:00
chriseth
c55584d3e2 Source location as part of AST. 2016-07-20 19:45:43 +02:00
chriseth
754a992500 Inaccessible dynamic types 2016-06-02 12:52:25 +02:00
chriseth
708129abd5 Fixes for invalid cleanups for small types. 2016-05-20 16:52:40 +02:00
VoR0220
9192357452 updated docs
types

reference
2016-05-18 16:36:05 -05:00
VoR0220
6289410152 explicit conversion and loosening of binary operations on integer and fixed point types...still other problems
fixed some spaces and deleted lines from failing test
2016-05-18 15:52:09 -05:00
VoR0220
3ba308fb2e current debugging info 2016-05-18 15:52:09 -05:00
chriseth
d4206b7cd0 Remove unused tests and add asserts for not implemented parts in code generation.
quick fix on christian's rational

change so that ubuntu will stop yelling

be more specific with rational declaration for Windows sake

rational in namespace correction for windows
2016-05-10 16:03:33 -05:00
chriseth
656405240e Simplify interface of RationalNumber. 2016-05-10 19:40:37 +02:00
chriseth
cf226f0607 Special case for moving sign bit to fractional part. 2016-05-10 19:40:37 +02:00
chriseth
02e1c9be0d Cleanup. 2016-05-10 19:40:37 +02:00
chriseth
4dfe9a216c Disallow explicit fixed->enum, but allow bytes->fixed. 2016-05-10 19:40:37 +02:00
chriseth
ef7049f9a6 Some cleanup. 2016-05-10 19:40:37 +02:00
chriseth
22318c0c1a Replace "unsigned int" by "unsigned". 2016-05-10 19:40:37 +02:00
chriseth
80c368dac1 Prefer mobileType() to check rational range. 2016-05-10 19:40:35 +02:00
VoR0220
a6fc3c8f30 reorganized tests and fixed mobile types and implicit conversions of rationals and fixed point types
one final tweak

check for null types
2016-05-09 11:41:03 -05:00
VoR0220
bfc238c8d1 updated algorithm for bit finding...now to figure out literal value
tiny fixups

changed location of the check

got rid of extra space and fixed a couple of things

added binary results bits

change back literal value
2016-05-09 11:41:03 -05:00
VoR0220
5bddb2d6ff changed algorithm for finding bits 2016-05-09 11:41:03 -05:00
VoR0220
4b3e1f140c much better way of doing modulus 2016-05-09 11:41:03 -05:00
VoR0220
82039b732e added bytes conversion tests, resolved that, converted to binary scaling, refactored the find algo to prevent large numbers and take into account integer bytes
think we're good on solidity type name resolution now

removed couts

updates to documentation and more removed couts along with literal value implementation

forgot semicolons
2016-05-09 11:41:03 -05:00
VoR0220
f0ea817580 fixing modulus and Solidity Name and Type Resolution
minor fixes

current attempts at binary fixup
2016-05-09 11:41:03 -05:00
VoR0220
4b749fc333 changed names for Rational Constants and categories 2016-05-09 11:41:02 -05:00
VoR0220
4d283b2b30 currently what we have 2016-05-09 11:41:02 -05:00
RJ Catalano
93295ae8f8 got exponents up and working with their inverse, changed a few of the tests....something is working that likely shouldn't be
slight changes to how to flip the rational negative around...still trying to figure it out

tests added

updated tests

odd differences in trying soltest from solc binary, let me know if you can replicate

test not working for odd reason

fixed test problem with fixed literals...still need a way to log this error

broken up the tests, added some, changed some things in types and began compiler work

moar tests and prepping for rebuilding much of the types.cpp file

further fixing

infinite loop still happening but it's somewhere in the fixedPoint methodd

fractional bits needed algo improved! Eliminated 2 errors

Corrected problems with the previous commit. No infinite loops. Actually appear to have corrected an error
2016-05-09 11:41:02 -05:00
RJ Catalano
a1a2eac5fd size capabilities functioning properly for fixed types 2016-05-09 11:41:02 -05:00
RJ Catalano
91fda50922 fixed problem with var...probably a conversion problem for fixed in size capabilities
adding fixed type tests

Removing bitshift and regrouping fixed type tests together
2016-05-09 11:41:02 -05:00
RJ Catalano
6fa5e0fac9 Rational implemented...trying to figure out exponential 2016-05-09 11:41:02 -05:00
RJ Catalano
9a075458ad initial work for fixed types...potentially needing a constant literal type for this
notation

Rational implemented...trying to figure out exponential

fix for token bug, also quick fix for the wei and seconds

fixed problem with var...probably a conversion problem for fixed in size capabilities

adding fixed type tests

Removing bitshift and regrouping fixed type tests together

size capabilities functioning properly for fixed types

got exponents up and working with their inverse, changed a few of the tests....something is working that likely shouldn't be

slight changes to how to flip the rational negative around...still trying to figure it out

tests added

updated tests

odd differences in trying soltest from solc binary, let me know if you can replicate

test not working for odd reason

fixed test problem with fixed literals...still need a way to log this error

broken up the tests, added some, changed some things in types and began compiler work

moar tests and prepping for rebuilding much of the types.cpp file

further fixing

initial work for fixed types...potentially needing a constant literal type for this
2016-05-09 11:41:02 -05:00
chriseth
7ea3d950d7 Allow calling internal functions of libraries.
Internal functions of libraries can be called as if the library were a
base contract of the calling contract. As the calling convention for
internal functions is to not create a new call context, the code of
these functions will be pulled into the context of the caller,
duplicating their code. This might pull in code of further internal or
even private functions.

The use case for such functions is to allow libraries which can operate
on memory types such that these types can also be modified in place.
2016-05-03 22:41:18 +02:00
chriseth
6f54b13d7a Remove log.h from solidity. 2016-04-12 01:03:46 +02:00
Dimitry
ccbd3ff63f move libevmcore to solidity 2016-04-01 23:11:01 +03:00
chriseth
f049430723 Code generation (missing external access and source locations). 2016-03-30 02:37:00 +02:00
chriseth
949b00ed59 Parsing for inline assembly. 2016-03-30 02:37:00 +02:00
chriseth
299fef0c79 Do not allow value for delegatecall functions. 2016-03-11 17:50:09 +01:00
LianaHus
58e07151e3 - inline and assembly keywords added
- some style fixes
2016-03-11 17:49:32 +01:00
chriseth
e5514becb8 BREAKING: Implement delegatecall and make default for library calls. 2016-03-11 17:49:32 +01:00
RJ Catalano
9b67969fd6 further optimization, splitting function into pieces
generating strings on the fly, changed name, and added two tests
2016-02-18 11:23:00 -06:00
RJ Catalano
d2c0712f36 added const correctness to extract functions in Token
optimizations added in

more elegant solution created for m declaration

ubuntu wants to get rid of 0 <= first statement...so I will

change returnToken to token
2016-02-18 11:22:58 -06:00
RJ Catalano
84f2eb461b added two functions in Token to handle long identifiers, redid fromIdentifierOrKeyword, and made complementary changes in scanner and parser 2016-02-18 11:22:58 -06:00
RJ Catalano
f4da126018 tests added and changes made
fixed some silly problems in Token.cpp

windows error fix
2016-02-18 11:22:56 -06:00
RJ Catalano
7b918a7bc7 changes to redefine the token list, the scanner, and the parser and how they pass around variable types of different sizes
not ready for change to FixedPoint just yet

made this more const correct and added a switch statement for easier reading
2016-02-18 11:22:52 -06:00
LianaHus
5fb8953003 style fixes 2016-02-18 13:29:20 +01:00
chriseth
29faf1b298 Index access for bytesXX. 2016-02-09 17:07:04 +01:00
Lu Guanqun
4563d4bd3c [cond-expr] add visitor related functions 2016-01-22 17:14:00 +00:00
Lu Guanqun
4fa0326813 [cond-expr] add an AST node 2016-01-22 17:14:00 +00:00
LianaHus
b2daa5a9d8 fixed assert on EI creation for structs containing only mapping or arrays 2016-01-15 17:36:06 +01:00
chriseth
f20a604c5a Allow aliases during import. 2016-01-11 13:56:02 +01:00
chriseth
e27bfa023d Merge pull request #317 from chriseth/pathsEverywhere
Use paths instead of simple identifiers wherever possible.
2016-01-04 11:47:11 +01:00
chriseth
0e2fa39fad Use paths instead of simple identifiers wherever possible. 2015-12-21 18:44:21 +01:00
chriseth
2466fb68a0 Merge pull request #308 from chriseth/fixoverloadbug
Fix bug preventing overloads of different array types.
2015-12-21 15:37:51 +01:00
chriseth
54e3637d23 Add structs and enums to contract types. 2015-12-18 16:50:14 +01:00
chriseth
79c5d032fe Fix bug preventing overloads of different array types. 2015-12-18 13:56:37 +01:00
chriseth
603dc58040 Simple aliasing during import. 2015-12-18 12:46:56 +01:00
chriseth
d3c459b5a9 Parse complex import directives. 2015-12-18 12:46:54 +01:00
RJ Catalano
9ab066de8c new tests 2015-12-15 14:47:09 -06:00
RJ Catalano
aebce8a1d5 now is compiling and passing soltest...but I think there may be a few more things to do 2015-12-15 12:22:52 -06:00
RJ Catalano
5a462afd03 fixed case statements 2015-12-15 11:37:00 -06:00
RJ Catalano
767103be57 changing Tuple Constructor 2015-12-15 11:16:54 -06:00
RJ Catalano
84241804dc updated attempt...still a bit more work to do but here's what's current 2015-12-15 11:00:35 -06:00
RJ Catalano
574e48b0b5 Inline array declarations complete 2015-12-14 17:40:35 -06:00
chriseth
f8228e8ab1 Relative paths in import directives. 2015-12-09 19:21:02 +01:00
chriseth
7cb7818cea Source units are independent scopes. 2015-12-09 19:09:24 +01:00
chriseth
7f415da886 Code generation for calling bound methods. 2015-12-01 12:35:34 +01:00
chriseth
e9c7837c15 Merge pull request #251 from chriseth/bind2
Bind library functions to types.
2015-11-30 16:06:44 +01:00
chriseth
f9e52c9db1 Also check the object type for bound functions. 2015-11-29 00:16:07 +01:00
chriseth
93b3237c6a Add bound functions to types. 2015-11-29 00:16:07 +01:00
chriseth
b97bb086de Introduce selfdestruct alias for suicide. 2015-11-29 00:10:07 +01:00
chriseth
d71cd3aa2b Added the using x for y directive. 2015-11-26 17:49:39 +01:00
chriseth
4aaa150674 Convert filter to template function. 2015-11-26 17:28:44 +01:00
chriseth
cc2df5f9f2 Invalidate cached members if scope changes. 2015-11-26 15:37:55 +01:00
chriseth
b47d593252 Do not store elements of a contract by AST node type. 2015-11-26 15:37:55 +01:00
chriseth
86495dfc57 Make members context-sensitive. 2015-11-26 15:37:55 +01:00
chriseth
bf55aa6ae2 Type checking for creating new arrays. 2015-11-26 13:10:12 +01:00
chriseth
30b325fdc1 Allow "new expressions" also for general type names.
Breaking change: If you want to send value with a contract creation, you
have to use parentheses now:

`(new ContractName).value(2 ether)(arg1, arg2)`
2015-11-26 13:10:12 +01:00
chriseth
68f1da1e3a Fixed string inside struct allocation bug. 2015-11-24 14:54:37 +01:00
chriseth
0cf8d022ae Addmod and mulmod. 2015-11-18 17:12:39 +01:00
chriseth
34829ae764 Fix problems with statement blocks. 2015-11-11 15:21:01 +01:00
chriseth
8fb49d85f9 Allow docstrings for statements. 2015-10-26 19:47:25 +01:00
chriseth
b4f561680a Store docstrings in AST annotations. 2015-10-26 15:24:36 +01:00
chriseth
e3dffb611f File reorganisation. 2015-10-21 00:46:01 +02:00