Commit Graph

613 Commits

Author SHA1 Message Date
Alex Beregszaszi
cd5d93da2a Rename CompilerStack.metadata to CompilerStack.natspec 2017-05-19 16:11:04 +01:00
Alex Beregszaszi
81877cc594 Rename InterfaceHandler to Natspec 2017-05-19 16:11:04 +01:00
Alex Beregszaszi
12328b7848 Split ABI out of InterfaceHandler 2017-05-19 16:11:03 +01:00
Alex Beregszaszi
4bf3cbb09a Use CompilerStack.contractABI directly 2017-05-19 15:57:36 +01:00
Alex Beregszaszi
8169e149c9 Rename CompilerStack.interface to CompilerStack.contractABI 2017-05-19 15:57:36 +01:00
Alex Beregszaszi
f2a6331ffb Support the new AST in StandardCompiler 2017-05-17 11:14:33 +02:00
chriseth
dea7b864e6 Compact format for AST-Json with backwards compatibility 2017-05-17 11:14:33 +02:00
Alex Beregszaszi
c0f31e4c1b Ensure proper checks are in CompilerStack 2017-05-11 08:02:03 +01:00
Alex Beregszaszi
5b4b620d8b Do not crash on AST if parsing failed 2017-05-11 08:02:03 +01:00
Alex Beregszaszi
c09f071ff6 Merge pull request #2211 from ethereum/jsonio-fixes
Follow the JSON I/O spec closely
2017-05-02 16:47:14 +01:00
Alex Beregszaszi
ed3ab3506a Follow the JSON I/O spec closely 2017-05-02 16:52:38 +02:00
Alex Beregszaszi
2871663cad Remove why3 from standard compiler 2017-05-02 14:49:13 +01:00
djuju
e9954eb325 conditional reset of compilerState-Enum 2017-04-28 18:46:27 +02:00
chriseth
f33614e1f7 Merge pull request #2171 from ethereum/splitParseAndAnalyze
refactoring parse() into two separate functions
2017-04-28 17:19:31 +02:00
djuju
a6306a1d44 error fixed 2017-04-28 16:20:32 +02:00
djuju
45f8c5aa88 enumchecks not working 2017-04-28 15:24:59 +02:00
Alex Beregszaszi
b0485e327b Make assembler errors fatal 2017-04-27 16:34:57 +01:00
Alex Beregszaszi
16276ab10b Catch assembler exceptions and throw readable Solidity exceptions 2017-04-27 16:06:49 +01:00
djuju
5fd7942173 documentation, checks and renaming 2017-04-27 12:56:56 +02:00
djuju
99a7aefb75 refactoring parse() into two separate functions 2017-04-27 12:38:24 +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
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
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
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
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
Alex Beregszaszi
e0ff70778a Rename ErrorMesage to ErrorMessage 2017-03-16 23:59:36 +00: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
Yoichi Hirai
a1e350a4ae Merge pull request #1699 from ethereum/asmlabels
Assembly labels with stack information
2017-03-08 11:56:44 +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
5c5d83fd70 Check for circular references in constant variables. 2017-03-06 15:05:09 +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
7f2def8971 Analysis refactoring. 2017-03-03 15:41:01 +01:00
chriseth
7a24a5764e Add line info to serious exceptions. 2017-02-24 19:32:41 +01:00
chriseth
e67faa9839 Extract scopes into compiler stack. 2017-02-14 13:23:44 +01:00
chriseth
a9c6ff4ac8 Refactor json return type generation. 2017-01-26 18:21:19 +01:00
Alex Beregszaszi
fcf483ee6b Add option to store literal sources in metadata 2017-01-26 13:16:26 +00:00
chriseth
0ef460461a Check if constructor is public or not. 2017-01-20 19:22:39 +01:00
chriseth
7159944f0f Reset AST node IDs between compilation runs. 2017-01-20 12:00:16 +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
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
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
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
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
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
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
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
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
chriseth
56a027bedc Use multiple URLs for metadata. 2016-12-13 16:37:48 +01:00
chriseth
c111d6e27e Merge pull request #1491 from ameten/refactoring
Just refactored some code
2016-12-12 21:43:04 +01: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
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
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
VoR0220
3f9f725737 Fix licensing headers
Signed-off-by: VoR0220 <rj@erisindustries.com>
2016-11-23 12:22:33 +01:00
Alex Beregszaszi
60e9c901e9 Include payable for the constructor in the ABI 2016-11-17 17:23:35 +00:00
chriseth
ec31d08775 Change encoding to address-funid and add "function" as ABI type. 2016-11-16 14:37:19 +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
Alex Beregszaszi
9719cf38e6 Move InterfaceHandler from string to JSON 2016-11-15 15:55:25 +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
762f7ac250 Suggest correct version for pragma and complain about pre-release version. 2016-10-25 13:45:50 +02:00
Alex Beregszaszi
aefb6e5fcf Rename dev::sha3 to dev::keccak256 2016-10-06 14:53:40 +01:00
chriseth
6a55405160 Fix problem with release version string. 2016-09-08 17:56:28 +02:00
Alex Beregszaszi
6ec40b3cde Reject constant modifier on the fallback function 2016-09-06 11:40:00 +01:00
chriseth
dff9633084 Test and fixes for payable fallback in ABI. 2016-09-06 10:59:13 +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
chriseth
24ffc38575 Do not use internal types for event parameters. 2016-09-02 00:39:30 +02:00
Dimitry
061aee2e97 fix CompilerStack::absolutePath 2016-08-31 22:10:20 +03: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
54ab787b83 Make versioning semver compatible and force commit hash availability. 2016-08-26 10:14:44 +02:00
Denton Liu
e00f802f72 Remove standard contracts 2016-08-19 10:34:50 -04:00
Dimitry
e5e2597702 remove solidity --interface 2016-08-17 12:39:10 +03:00
chriseth
c55584d3e2 Source location as part of AST. 2016-07-20 19:45:43 +02:00
chriseth
9a9a815fc9 Provide formal version in json output. 2016-07-18 18:26:56 +02:00
chriseth
3150ab2bcf Allow remappings to change depending on the context. 2016-06-08 18:16:46 +02:00
chriseth
f227050c20 Make solidity independent from ethcore. 2016-04-06 20:56:00 +02:00
Dimitry
d2cee6f9c6 reduce unnecessary solidity:: namespace 2016-04-04 15:41:35 +04:00
Dimitry
858c41260d rename namespace for instruction.h/cpp in libevmasm 2016-04-02 15:56:43 +03:00
chriseth
ea7325d2d2 Remove code duplication in source references formatter. 2016-04-01 00:54:12 +02:00
chriseth
e31ecc8f77 Do not use source reference if it is empty. 2016-03-31 13:05:41 +02:00
chriseth
949b00ed59 Parsing for inline assembly. 2016-03-30 02:37:00 +02: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
chriseth
67c855c583 Merge pull request #356 from guanqun/break-not-in-loop
check whether break/continue is in the loop
2016-01-20 19:23:23 +01:00
chriseth
d21c4276b3 Merge pull request #351 from chriseth/autoload
Automatically load imported files in solc.
2016-01-19 13:14:25 +01:00
Lu Guanqun
c8886ed5cf code changes according to Chris's comments 2016-01-19 02:16:13 +00:00
Lu Guanqun
e130bc7e7c check whether break/continue is in the loop 2016-01-15 15:12:23 +08:00
chriseth
8f7c4e0cc2 Build fix for MacOS. 2016-01-14 14:47:32 +01:00
chriseth
17199edb4f Set error flag to true. 2016-01-14 11:36:13 +01:00
chriseth
2364c55735 Detect library name clashes. 2016-01-14 11:36:13 +01:00
chriseth
287f0a2ddf Autoload files in solc. 2016-01-12 01:05:05 +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
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
86495dfc57 Make members context-sensitive. 2015-11-26 15:37:55 +01:00
chriseth
907cf28f49 Fix: Cope with non-existing commit hash. 2015-11-02 18:03:04 +01:00
chriseth
56f5d58850 Rename error type. 2015-10-27 17:45:58 +01:00
chriseth
a957322fd7 Preliminary why3 code output. 2015-10-27 00:49:27 +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