Commit Graph

1125 Commits

Author SHA1 Message Date
chriseth
72fdf755c9 Register functions. 2017-04-25 16:49:03 +02:00
chriseth
c3b839ca75 Merge pull request #2164 from ethereum/jsonio-catch-internal-exceptions
JSON IO catch internal exceptions
2017-04-25 10:45:59 +02:00
Alex Beregszaszi
5e7a643051 Catch jsoncpp exceptions 2017-04-24 22:49:50 +01:00
Alex Beregszaszi
2f66c69bd1 Do not crash on invalid JSON input 2017-04-24 22:38:03 +01:00
chriseth
4d111e3366 Merge pull request #2152 from ethereum/warnRevert
Warn about side-effect free statements.
2017-04-24 19:25:45 +02:00
chriseth
d3b8d5f049 Merge pull request #2161 from ethereum/jsonio-cleanup
Small cleanups to JSON IO
2017-04-24 17:12:37 +02:00
chriseth
2c3fea55df Merge pull request #2159 from ethereum/jsonio-source-verify
Verify supplied hash in JSON I/O
2017-04-24 16:15:32 +02:00
Alex Beregszaszi
4a9ba5b952 Verify supplied hash in JSON I/O 2017-04-24 14:34:29 +01:00
Alex Beregszaszi
43eb839871 Do not fail if parsing failed in StandardCompiler 2017-04-24 11:44:33 +01:00
Alex Beregszaszi
3cd02ca148 Change error type names to not include spaces 2017-04-24 11:34:02 +01:00
Alex Beregszaszi
e24c35bce0 Be a bit more verbose and capture Boost exceptions in StandardCompiler 2017-04-24 11:34:02 +01:00
Alex Beregszaszi
c82a203206 Document that the ReadFileCallback should not emit exceptions 2017-04-22 14:08:28 +01:00
chriseth
c76e0a5872 Changed const reference to value. 2017-04-22 01:12:38 +02:00
Alex Beregszaszi
8de02c7778 Support URL sources in StandardCompiler 2017-04-21 16:44:15 +01:00
chriseth
937695bfdc Change error message. 2017-04-21 15:04:03 +02:00
chriseth
9bc9fe6af7 Warn about side-effect free statements. 2017-04-21 11:36:38 +02:00
Alex Beregszaszi
6ae7a87b78 Rename ast to legacyAST in StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
f71b465eb7 Ensure the language field is present in the JSON 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
6d13260232 Pull out collectEVMObject 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
413c146edd Enclose local functions in a namespace 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
aa0776d5e8 Support Why3 in StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
b513db74a0 Support gas estimates in StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
77d5148f0d Reject import URLs for now 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
df7e703925 Support the metadata.useLiteralContent setting 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
ef559de84f Properly split contract filename and name 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
ad1fe86508 Support linkReferences 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
2df52edfbd Support new assembly output 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
a87dd17d0f Move opcodes inside the bytecode section 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
63b6d0099f Support methodIdentifiers 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
f25efceaf8 Support proper error reporting in StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
b3c6b1e936 Refactor formatError 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
2c15e2b541 Fail if no sources are given 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
5aec120da3 Support the AST output 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
50bb24af5e Include source mapping identifier 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
115458c50e Output legacyAssembly in StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
4eaee772b3 Capture error messages from the JSON parser 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
f8cb0766d4 Add formatFatalError() to StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
ce87984cc1 Parse remappings in StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
81775b2df6 Parse libraries in StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
13fa440d37 Parse optimizer settings in StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
418759ece0 Catch exceptions of StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
985db17e1e Initial implementation of StandardCompiler 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
5754b13b47 Add StandardCompiler skeleton 2017-04-20 19:38:00 +01:00
Alex Beregszaszi
bf074f3f41 Fix source index allocation in CompilerStack. Depending on compiler(optimisations) this could be off-by-one. 2017-04-20 19:20:14 +01:00
Yoichi Hirai
3cacea74c9 Merge pull request #2117 from ethereum/implementAsmOut
Implement missing assembly output functions and do not use PushString for assembly.
2017-04-18 18:11:25 +02:00
Alex Beregszaszi
54dcb0e11b Keep gas values as a string in CompilerStack::gasEstimate 2017-04-13 02:18:29 +01:00
Alex Beregszaszi
3fbb48bd46 Exclude fallback function from the internal functions in estimateGas 2017-04-13 02:17:40 +01:00
Alex Beregszaszi
e6221108b6 Move gasEstimate into CompilerStack 2017-04-13 02:17:37 +01:00
chriseth
4d715e9055 Implement missing assembly output functions and do not use PushString for assembly. 2017-04-11 19:54:44 +02:00
Alex Beregszaszi
bd48f181b5 Merge pull request #2098 from ethereum/sourceformatter
Introduce formatExceptionInformation
2017-04-10 14:46:59 +01:00
Alex Beregszaszi
b1db6eac8b Introduce formatExceptionInformation 2017-04-10 14:07:36 +01:00
Alex Beregszaszi
623b8eb107 Pull out ReadFile from CompilerStack 2017-04-10 12:49:47 +01:00
Federico Bond
e6f13353f2 Fix PostTypeChecker retaining state across contracts 2017-04-08 18:45:15 -03:00
chriseth
4792806b99 Fix: Contract inheriting from base with unimplemented constructor is abstract. 2017-03-21 18:12:08 +01:00
chriseth
5ced3af3a0 Visit structs only once. 2017-03-21 15:05:59 +01:00
Alex Beregszaszi
96c09fcbcd Simplify interface checks for FunctionDefinition 2017-03-17 17:07:20 +00:00
Alex Beregszaszi
2067a00f22 Disallow private or internal functions in interfaces 2017-03-17 17:07:18 +00:00
Alex Beregszaszi
d5102c1db7 Disallow constructor in interfaces 2017-03-17 17:06:52 +00:00
Alex Beregszaszi
2c4bce2d62 Disallow enums in interfaces 2017-03-17 17:06:52 +00:00
Alex Beregszaszi
16a91ef90a Use declared instead of defined 2017-03-17 17:06:52 +00:00
Alex Beregszaszi
f8da9a8fd5 Factor out tokenToContractKind 2017-03-17 17:06:52 +00:00
Alex Beregszaszi
4693aed177 Reject invalid definitions for interface contracts 2017-03-17 16:27:04 +00:00
Alex Beregszaszi
54230d2d5d Support interface (contract) keyword in the parser 2017-03-17 16:27:04 +00:00
Alex Beregszaszi
6d4628ace4 Add ContractKind to ContractDefinition 2017-03-17 16:27:04 +00:00
chriseth
c37397c178 Merge pull request #1773 from ethereum/ASTEntry
Ast entry
2017-03-17 17:24:58 +01:00
chriseth
44a0329921 Comment. 2017-03-17 14:44:44 +01:00
chriseth
245c8914cf Merge pull request #1792 from ethereum/function-kind
Rename FunctionType::Location to Kind
2017-03-17 10:25:58 +01:00
Alex Beregszaszi
e0ff70778a Rename ErrorMesage to ErrorMessage 2017-03-16 23:59:36 +00:00
djudjuu
616a9854e9 AST entry for VariableDeclaration 2017-03-16 16:56:44 +01:00
Alex Beregszaszi
3ae88377d6 Change references to FunctionType::Location 2017-03-16 12:49:52 +00:00
Alex Beregszaszi
7123f25210 Rename FunctionType::Location to FunctionType::Kind 2017-03-16 12:49:17 +00:00
chriseth
0c8a766146 Merge pull request #1698 from ethereum/exp-notation
Fix scientific notation in number literals
2017-03-15 14:55:45 +01:00
Alex Beregszaszi
e923f27ea8 Split out parseRational from isValidLiteral 2017-03-15 13:06:27 +00:00
Alex Beregszaszi
dde87de4cf Rename x to value 2017-03-15 13:06:27 +00:00
Alex Beregszaszi
a2b9f52ca4 Disallow radix points in hex literals 2017-03-15 13:06:27 +00:00
Alex Beregszaszi
07045d492f Do not try parsing hex numbers as scientific notation 2017-03-15 13:06:27 +00:00
Alex Beregszaszi
dfc8f890bf Support older version of boost 2017-03-15 13:06:27 +00:00
Alex Beregszaszi
1083e6da68 Support negative exponent 2017-03-15 13:06:26 +00:00
Alex Beregszaszi
924a8fff6b Fix exponentional notation in number literals 2017-03-15 13:06:24 +00:00
chriseth
ab178b8bac Mention 'transfer' in warning about unchecked 'send'. 2017-03-15 11:10:24 +01:00
Yoichi Hirai
d134fda0c0 Merge pull request #1729 from ethereum/constantvariables
Only allow pure expressions for constant state variables.
2017-03-15 10:03:35 +01:00
chriseth
9f328ff749 Turn non-constant constants error into warning. 2017-03-14 19:25:16 +01:00
chriseth
47cd8964b8 Require and Assert. 2017-03-14 14:21:33 +01:00
chriseth
592cec7e90 Disallow constants that are neither value types nor strings. 2017-03-13 13:30:23 +01:00
chriseth
14948e514d Allow enum values for constants. 2017-03-13 13:30:23 +01:00
chriseth
f39763e91c Type checking for pure expressions. 2017-03-13 13:30:21 +01:00
Yoichi Hirai
ef8b56a058 Merge pull request #1751 from ethereum/warnLiteralExpBase
Warn if base of exponentiation operation is a literal.
2017-03-10 19:25:47 +01:00
Ryan Casey
fe8d09a3c1 Fix 'ambiguous overload for operator==' Boost error. 2017-03-09 17:04:26 -08:00
Ryan Casey
797e05ba08 Resolve build-stopping error about 'minor' and 'major' being defined in <sys/types.h> 2017-03-09 17:03:19 -08:00
Yoichi Hirai
e364909e06 Merge pull request #1747 from ethereum/fixICEInternalConstructor
Move privateness of constructor into AST itself.
2017-03-08 17:49:14 +01:00
chriseth
3f9a775834 Merge pull request #1748 from ethereum/singletonArray
Use mobile type for singleton array.
2017-03-08 16:11:03 +01:00
chriseth
93ef7fd260 Disallow compound assignment for tuples. 2017-03-08 12:42:07 +01:00
Yoichi Hirai
78f7dd2344 Merge pull request #1750 from ethereum/asmoctal
Disallow octal numbers in parser.
2017-03-08 12:24:22 +01:00
Yoichi Hirai
a1e350a4ae Merge pull request #1699 from ethereum/asmlabels
Assembly labels with stack information
2017-03-08 11:56:44 +01:00
chriseth
1324ebc4bf Warn about literal constant base in exponentiation. 2017-03-07 13:44:11 +01:00
chriseth
bb06569dc6 Disallow octal literals. 2017-03-07 12:34:32 +01:00
chriseth
a2ac05e1a2 Merge pull request #1733 from ethereum/selfReferentialConstant
Detect cyclic dependencies between constants.
2017-03-06 17:18:39 +01:00
chriseth
2fcccb97d3 Merge pull request #1737 from ethereum/localmappings
Disallow uninitialized mapping variables.
2017-03-06 15:05:58 +01:00
chriseth
5c5d83fd70 Check for circular references in constant variables. 2017-03-06 15:05:09 +01:00
chriseth
c500d9f717 Convert to mobile type for array type. 2017-03-06 14:42:28 +01:00
chriseth
c126edc6ea Disallow uninitialized mapping variables. 2017-03-06 14:27:18 +01:00
chriseth
960b5fa032 Error constructor. 2017-03-06 14:27:18 +01:00
chriseth
f300bdb020 Move public constructor property into AST itself. 2017-03-06 14:12:42 +01:00
chriseth
ca4e2933dd Strict checking for AST annotation types. 2017-03-06 14:12:42 +01:00
chriseth
f521fd7b19 Mention way to remove warning. 2017-03-06 13:37:57 +01:00
Yoichi Hirai
cfbbd89daf Merge pull request #1702 from ethereum/assertError
Change effect of assert to invalid opcode.
2017-03-03 18:25:50 +01:00
chriseth
f8ce32f2a6 Fix error message. 2017-03-03 15:41:02 +01:00
chriseth
369005fc03 Remove stack annotations again. 2017-03-03 15:41:02 +01:00
chriseth
13fd569f76 First reset stack height, then register variables. 2017-03-03 15:41:02 +01:00
chriseth
455e8a4ef8 Move lambda. 2017-03-03 15:41:02 +01:00
chriseth
41236cd08c Slightly cleaner label ids. 2017-03-03 15:41:02 +01:00
chriseth
e963405a19 Partially add functions. 2017-03-03 15:41:02 +01:00
chriseth
647473cf01 Generic visitor. 2017-03-03 15:41:02 +01:00
chriseth
caa3761dc9 Refactor variable access. 2017-03-03 15:41:02 +01:00
chriseth
25dcfa3480 Refactor CodeGen to recurse on blocks. 2017-03-03 15:41:01 +01:00
chriseth
7f2def8971 Analysis refactoring. 2017-03-03 15:41:01 +01:00
chriseth
98e343b3fc Parsing of labels with stack info. 2017-03-03 15:41:01 +01:00
chriseth
cc01d870ff Disallow variable declaration with inferred empty tuple type. 2017-03-02 14:33:58 +01:00
chriseth
5c411b472b Merge pull request #1728 from ethereum/externalfunctiontypes
Convert reference types to pointers in member function conversion.
2017-03-02 12:08:17 +01:00
chriseth
a689152c4b Convert reference types to pointers in member function conversion. 2017-03-01 16:02:36 +01:00
chriseth
7a24a5764e Add line info to serious exceptions. 2017-02-24 19:32:41 +01:00
chriseth
d2c79bf8e9 Merge pull request #1700 from ethereum/fixNoMobile
Some checks for the existence of mobile type.
2017-02-24 15:50:45 +01:00
chriseth
92bf5154fd Merge branch 'develop' into fixNoMobile 2017-02-24 10:39:55 +01:00
Alex Beregszaszi
4d290e551c Disallow setting .gas() on .transfer() 2017-02-24 00:27:36 +00:00
Alex Beregszaszi
c674155e58 Do not keep the gas stipend if sending non-zero value 2017-02-24 00:18:18 +00:00
Alex Beregszaszi
81006dae98 Support gas modifier on addr.transfer() 2017-02-24 00:18:18 +00:00
Alex Beregszaszi
4264625c69 Implement address.transfer() 2017-02-24 00:17:45 +00:00
chriseth
4b1e8111cc Remove assert for now. 2017-02-23 19:43:40 +01:00
chriseth
c0961664f9 Deposit one stack item for non-value types in inline assembly type checking. 2017-02-20 12:33:22 +01:00
chriseth
7bdc4ddab2 Merge pull request #1627 from ethereum/asmfunctions
Parsing assembly function definitions and calls.
2017-02-16 20:12:31 +01:00
chriseth
811bb770c5 Change effect of assert to invalid opcode. 2017-02-16 15:54:17 +01:00
chriseth
c3c3cccbec Fix early exist for fatal errors. 2017-02-16 14:57:00 +01:00
chriseth
dcc16c81e2 Some checks for the existence of mobile type. 2017-02-16 11:46:27 +01:00
chriseth
a5ce81100e Assembly printer for functions. 2017-02-16 10:18:12 +01:00
chriseth
49a919b3e0 Parsing function calls. 2017-02-16 10:15:22 +01:00
chriseth
5d584aded8 Parsing function definitions. 2017-02-16 10:15:22 +01:00
chriseth
24197a2b3f Assembly printing fixes. 2017-02-14 15:41:25 +01:00
chriseth
ca71b7624d Review changes. 2017-02-14 15:41:25 +01:00
chriseth
80f7243786 Assembly printer. 2017-02-14 15:41:25 +01:00
chriseth
a791ec75e2 Review comments. 2017-02-14 13:32:48 +01:00
chriseth
b1bb228ab3 Allow different entry scope for registerDeclarations. 2017-02-14 13:23:44 +01:00
chriseth
e67faa9839 Extract scopes into compiler stack. 2017-02-14 13:23:44 +01:00
chriseth
c87bafd2ed Refactor type system to allow multiple entry points. 2017-02-14 13:23:44 +01:00
chriseth
fc8e50f688 Refactor NameAndTypeResolver and SyntaxChecker to allow other entry points. 2017-02-14 13:23:44 +01:00
Alex Beregszaszi
c8ec79548b Use the revert opcode in assert() 2017-02-10 22:53:32 +00:00
Alex Beregszaszi
586d156f33 Use the REVERT opcode for throw; 2017-02-10 22:41:09 +00:00
Alex Beregszaszi
f3158f92d6 Support revert() 2017-02-10 22:40:42 +00:00
Alex Beregszaszi
8a3d4a0500 Cleanup is not needed for assert() 2017-02-10 13:32:36 +00:00
Alex Beregszaszi
f8461e9e31 Implement assert as a global function 2017-02-10 13:29:17 +00:00
Alex Beregszaszi
693226b1ab Rename SUICIDE opcode to SELFDESTRUCT in libevmasm 2017-02-06 20:17:52 +00:00
Alex Beregszaszi
ba0015cf25 Warn early when exhausting stack 2017-02-02 11:39:29 +00:00
Alex Beregszaszi
697db80b48 Disallow arrays with negative length 2017-02-02 00:24:45 +00:00
Alex Beregszaszi
c01f5699e6 Add isNegative to RationalNumberType 2017-02-02 00:16:50 +00:00
Alex Beregszaszi
4361797ddc Only capture function type to address conversion 2017-02-01 12:23:47 +00:00
Alex Beregszaszi
ce62c7c01c Be more verbose on the stack-mismatch errors 2017-02-01 12:23:47 +00:00
Alex Beregszaszi
767ec1d670 Support explicit conversion of external function type to address 2017-02-01 12:23:47 +00:00
chriseth
b2c35fb41a Merge pull request #1598 from wuestholz/develop
Change translation of implicit throws
2017-01-27 14:10:22 +01:00
chriseth
636e480156 Merge pull request #1451 from LefterisJP/fix_build
Accept any kind of whitespace after natspec tags
2017-01-27 14:09:39 +01:00
chriseth
0e021e76a5 Minor changes. 2017-01-27 11:19:48 +01:00
chriseth
bff8fc23e6 Changelog and review suggestions. 2017-01-27 10:18:53 +01:00
Lefteris Karapetsas
98b51b378e
More verbose function naming 2017-01-27 00:09:00 +01:00
Lefteris Karapetsas
cc7834f2a9
Doc tags followed by newline are now parsed properly 2017-01-27 00:00:05 +01:00
chriseth
a9c6ff4ac8 Refactor json return type generation. 2017-01-26 18:21:19 +01:00
chriseth
a98fa41897 Uninitialized internal function should call INVALID. 2017-01-26 16:39:07 +01:00
chriseth
d9fbb83861 Allow inserting low-level functions without calling them. 2017-01-26 16:39:07 +01:00
chriseth
390bebaaf9 Split line. 2017-01-26 16:39:07 +01:00
Valentin Wüstholz
5b7cc018f0 Address feedback from code review. 2017-01-26 16:39:07 +01:00
Valentin Wüstholz
9bcbd93ac5 Change translation of implicit throws (issue #1589).
This adds a new invalid instruction that is used for encoding
implicit throws that are emitted by the compiler. This makes it
possible to distinguish such runtime errors from user-provided,
explicit throws.
2017-01-26 16:39:07 +01:00
Alex Beregszaszi
102fd7ee5d Merge pull request #1604 from ethereum/checksums
Warn about invalid checksums of addresses.
2017-01-26 14:42:34 +00:00
Alex Beregszaszi
fcf483ee6b Add option to store literal sources in metadata 2017-01-26 13:16:26 +00:00
chriseth
873f2dddd6 Update error message. 2017-01-26 13:52:02 +01:00
chriseth
525758a130 Disallow assignment to non-identifiers. 2017-01-26 13:40:40 +01:00
chriseth
f62e269115 Disallow instructions in assignment. 2017-01-25 17:29:06 +01:00
chriseth
a5696e1f0a Renamed function. 2017-01-25 17:26:11 +01:00
chriseth
27ba665694 Moved test. 2017-01-25 17:24:43 +01:00
Alex Beregszaszi
900c56d996 Do not allow shadowing inline assembly instructions with variables 2017-01-25 11:28:09 +00:00
Lefteris Karapetsas
9ca0fde853 Fix and better output for tests 2017-01-25 11:01:52 +01:00
Lefteris Karapetsas
5738e865d5 Accept any kind of whitespace after natspec tags 2017-01-25 11:01:52 +01:00
chriseth
3949624a61 Also check library addresses. 2017-01-24 23:37:48 +01:00
chriseth
1316bb7565 Warn about invalid checksums of addresses. 2017-01-24 23:37:48 +01:00
chriseth
ead1a3b33f Include creation code only once. 2017-01-24 17:41:31 +01:00
chriseth
7e6f1b3f00 Use int arithmetics for stack adjustment. 2017-01-24 12:07:09 +01:00
chriseth
23eca813f5 Change clearStorageLoop to TypePointer. 2017-01-24 12:07:09 +01:00
chriseth
82a00e7dc5 Use shared_ptrs to enable shared_from_this. 2017-01-24 12:06:41 +01:00
chriseth
cea020b89e Convert ArrayUtils routines into low-level functions. 2017-01-24 12:06:40 +01:00
chriseth
b60623521f Move some util functions to low-level functions. 2017-01-24 12:06:40 +01:00
chriseth
d0e8d340a5 Low level named functions for CompilerContext. 2017-01-24 12:06:40 +01:00
chriseth
b52a60402d Merge pull request #1245 from ethereum/1215
Allow multiple events of the same name
2017-01-24 11:52:21 +01:00
Yoichi Hirai
4e1fd68b38
analysis: disallow overloading functions with events 2017-01-23 15:25:13 +01:00
Yoichi Hirai
399b7b695a
analysis: fix format 2017-01-23 15:25:13 +01:00
Yoichi Hirai
846f7dc3ea
analysis: Resolve event overloading 2017-01-23 15:25:13 +01:00
Yoichi Hirai
08015590f2
analysis: Allow multiple events of the same name
Fixes #1215
2017-01-23 15:25:13 +01:00
Yoichi Hirai
9c278448c8 Merge pull request #1591 from ethereum/stackTooDeepLocation
Report source location on "stack too deep" errors.
2017-01-23 15:02:22 +01:00
chriseth
0ef460461a Check if constructor is public or not. 2017-01-20 19:22:39 +01:00
chriseth
2536bdd6d0 Report source location on "stack too deep" errors. 2017-01-20 19:01:19 +01:00
Yoichi Hirai
12b002b3b8 Merge pull request #1576 from ethereum/typeIdentifiers
Type identifiers.
2017-01-20 16:18:57 +01:00
chriseth
07b0a0a560 Make m_id const. 2017-01-20 15:56:56 +01:00
chriseth
7159944f0f Reset AST node IDs between compilation runs. 2017-01-20 12:00:16 +01:00
chriseth
da178d967f Properly escape user strings and lists. 2017-01-19 13:23:58 +01:00
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
Alex Beregszaszi
4675599170 Include SOL_VERSION_COMMIT/SOL_VERSION_PLATFORM in buildinfo.h 2017-01-17 12:54:58 +00:00
Alex Beregszaszi
350c7e7e2c Store strict version number in metadata (exclude the platform) 2017-01-17 12:54:58 +00:00
chriseth
99eaadd2cd Deterministic AST node identifiers. 2017-01-17 10:45:45 +01:00
Rhett Aultman
94b092d87c Provide fall-back method for contract lookup
Properly, contracts are now looked up via <source>:<contract> identifiers
called "fully qualified names."  As a modicum of backward-compatibility,
failure on a lookup is now backed up by seeing if the ":" exists at all,
and if it doesn't, then the known contracts are scanned for any matching
contract name.
2017-01-16 23:47:04 -05:00
Rhett Aultman
5a2331a9f6 Remove checkLibraryNameClashes()
The library name clash checker throws errors when two libraries of the
same name are spotted.  In a previous commit, this function was
rewritten to use fully-qualified names instead, which makes it redundant
to the checker for multiply-declared identifiers.  Since it no longer
serves a clear purpose, the function is being dropped.
2017-01-16 12:32:58 -05:00
Rhett Aultman
1f30982ab5 Use fully-qualified names for linking, too
Using libraries leaves behind a library link reference in the binary
which the linker must later resolve.  These link references were still
being generated by name and not by fully-qualified name.  This would
lead to a link-time collision between two libraries having the same
name but in different source units.

This change changes linker symbols over to fully-qualified names,
which resolves that issue.  This does potentially introduce a new
problem, which is that linker symbols appear to be limited to 36
characters and are truncated.  Storing paths extends the average
symbol size, and it would be great if truncation was from the tail
rather than the head.
2017-01-16 12:32:57 -05:00
Rhett Aultman
85c55c796a Remove unique error for contract collision
Because contracts are uniquely identified by their source unit, there
is no need for a unique error for this; it's actually covered by the
checker for double-declaration of identifiers.
2017-01-16 12:32:57 -05: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
e3b0827721 Push the error instead of throwing it
Throwing a CompilerError on multiple contract definition violates the
expectations of the test suite, which thinks that compile() will
return false if the code can't compile.  This brings contract
collision reporting in line with most of the other errors.
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
Rhett Aultman
9e88f1eebe Tab whitespace cleanup (again) 2017-01-16 12:32:57 -05:00
Rhett Aultman
ce3082dec2 Tidy up the error message 2017-01-16 12:32:57 -05:00
Rhett Aultman
b24ca4fa23 Fix tab, drop stupid '!!!', change error message. 2017-01-16 12:32:57 -05:00
Rhett Aultman
f3a84eab91 Error out when contracts collide on name
The previous behaviour, courtesy of the [] operator in std::map, would
uncritically store a new ContractDefinition in m_contracts even when a
ContractDefinition already existed.  This "resolved" collissions on contract
names by clobbering the original one with the new one, and could lead to
scenarios where the clobber would only be discovered when the original
ContractDefinition could not be found or referred to, which was an unhelpful
InternalCompilerError.

This change checks the m_contracts map for a collision first and will not let
the ContractDefinition be changed to a new one once it's set, throwing a
CompilerError with information about the conflict.
2017-01-16 12:32:57 -05:00
chriseth
bde0b40634 Merge pull request #1479 from ethereum/function_variable_mixin
Disallow mixin of functions and attributes under the same name
2017-01-13 09:36:00 +01:00
Yoichi Hirai
abc24420a7
ast: events have FunctionType too 2017-01-11 20:06:59 +01:00
Yoichi Hirai
7fea4b7360
analysis: use Declaration::functionType() in another location 2017-01-11 19:55:55 +01:00
Yoichi Hirai
eda147f47b
ast: add Declaration::functionType() 2017-01-11 19:55:50 +01:00
VoR0220
b6508ca992
fixed
Signed-off-by: VoR0220 <rj@erisindustries.com>
2017-01-11 12:03:54 -06:00
VoR0220
4542f459f1
added fix and a test for order independence of nested prefixing
Signed-off-by: VoR0220 <rj@erisindustries.com>
2017-01-11 11:45:14 -06:00
Yoichi Hirai
0216f34010
analysis: avoid emscripten build failure 2017-01-11 18:28:11 +01:00
Yoichi Hirai
91d4e8e0ba
analysis: changes necessary to compile std/StandardToken.sol 2017-01-11 18:28:11 +01:00
Yoichi Hirai
42b6726173
analysis: allow some shadowings explicitly 2017-01-11 18:28:11 +01:00
Yoichi Hirai
bff76c1ca0
analysis: report errors when inheritance causes collision 2017-01-11 18:28:11 +01:00
VoR0220
4585bfdce7
cleanup
Signed-off-by: VoR0220 <rj@erisindustries.com>

fixup

Signed-off-by: VoR0220 <rj@erisindustries.com>
2017-01-11 11:03:02 -06:00
VoR0220
e02270bbb4
fixed unused filepath bug
Signed-off-by: VoR0220 <rj@erisindustries.com>
2017-01-11 09:03:41 -06:00
VoR0220
8ace851831
much smaller helper function
Signed-off-by: VoR0220 <rj@erisindustries.com>
2017-01-10 07:17:11 -06:00
VoR0220
79dbd40096
can do this purely on length. Also made prefix filesystem string for more accurate readings.
Signed-off-by: VoR0220 <rj@erisindustries.com>
2017-01-08 22:53:57 -06:00
VoR0220
6d9020b3b8
fixed test and added solution
Signed-off-by: VoR0220 <rj@erisindustries.com>
2017-01-08 22:53:54 -06:00
chriseth
a4d7a590ea Merge pull request #1537 from ethereum/absolute-path
absolute path detection is not confused by ".dir"
2017-01-06 17:11:10 +01:00
chriseth
0031e6a530 Merge pull request #1545 from federicobond/refactor-rename
Rename contractName to typeName when parsing new expression
2017-01-05 10:53:08 +01:00
Federico Bond
584356e7f6 Rename contractName to typeName when parsing new expression 2017-01-04 23:09:10 -03:00
Yoichi Hirai
41fe412389
interface: change absolutePath() so that ".dir" is considered as an absolute path
fixes #1534
2017-01-03 18:18:22 +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
chriseth
e97ba77a45 Merge pull request #1508 from ethereum/multiurls
Use multiple URLs for metadata.
2016-12-14 17:22:25 +01:00
Yoichi Hirai
18f8f29c0a Merge pull request #1487 from ethereum/shift-ops
Shift operators
2016-12-14 16:31:27 +01:00
Yoichi Hirai
e53d125571 Merge pull request #1507 from ethereum/memcopystyle
Renamed padToWordBoundaries -> padToWords
2016-12-14 14:20:27 +01:00
chriseth
e9d3327ad6 Use correct type for storing. 2016-12-13 16:50:50 +01:00
chriseth
56a027bedc Use multiple URLs for metadata. 2016-12-13 16:37:48 +01:00
Federico Bond
de720e643d Improve error message when trying to modify constant variables 2016-12-13 00:32:37 -03:00
chriseth
0e0d5d47c0 Renamed padToWordBoundaries -> padToWords 2016-12-12 23:43:21 +01:00
Yoichi Hirai
1c3605362d Merge pull request #1468 from ethereum/memcpy-assembly
Implement memcpy without the identity precompile
2016-12-12 22:39:47 +01:00