Commit graph

17 commits

Author SHA1 Message Date
Roman Khimov
299a7ea614 compiler: use CALLT for native contract calls, fix #2257 2021-12-10 11:58:50 +03:00
Evgenii Stratonikov
ec58bec803 compiler: fix global constant traversal
There can be no global variables, but some global constants.
Introduced in 0b44a430.
2020-12-10 13:45:10 +03:00
Evgenii Stratonikov
18369c489e compiler: do not allocate slotes for unused "_" vars 2020-09-06 15:27:46 +03:00
Evgenii Stratonikov
0b44a43043 compiler: do not allocate static slot for constants
Their value is known at compile time.
2020-09-06 15:20:17 +03:00
Evgenii Stratonikov
b18a7f200c compiler: calculate local variables properly
In case when right-hand side of an assignment is a function,
left-hand side should be used.
2020-08-27 10:28:50 +03:00
Evgenii Stratonikov
057e1c6e3c compiler: provide filename to Compile() 2020-08-11 11:10:45 +03:00
Evgenii Stratonikov
a781d299e0 compiler: use fully-qualified names for tracking functions
Function name now consists of 3 parts:
1) full package path
2) method receiver type (if any)
3) function name itself .

Fix #1150.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 12:07:06 +03:00
Evgenii Stratonikov
528c184f00 compiler: allow to use exported constants
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 12:06:42 +03:00
Evgenii Stratonikov
6df019913d compiler: allow to use exported variables
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 12:06:42 +03:00
Evgenii Stratonikov
7009417325 compiler: allow to declare global variables in multiple files
Traverse and count globals across all used files.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 12:06:42 +03:00
Evgenii Stratonikov
685d44dbc1 *: support _initialize method in contracts
Invoke `_initialize` method on every call if present.
In NEO3 there is no entrypoint and methods are invoked by offset,
thus `Main` function is no longer required.
We still have special `Main` method in tests to simplify them.
2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
4f64bf86e5 compiler: add test for argument shadowing
Thanks @roman-khimov.
2020-06-30 10:41:48 +03:00
Evgenii Stratonikov
26cfae7c9a compiler: support shadowing via Block statements 2020-06-30 10:31:52 +03:00
Evgenii Stratonikov
40bacc6775 compiler: support variable shadowing
Closes #1131.
2020-06-30 10:31:52 +03:00
Evgenii Stratonikov
2cc58c3c9e compiler: allow to declare multiple compound types in a var decl 2020-05-19 16:57:02 +03:00
Evgenii Stratonikov
b4bad11699 compiler: count the number of variables correctly 2020-05-19 16:47:43 +03:00
Evgenii Stratonikov
e21015233b compiler: implement shadowing of global variables
Before introducing slots it was hard to change global variables
preserving changes across multiple function calls.
This commit implements such possibility.
Closes #638.
2020-05-12 16:23:09 +03:00