Commit graph

7 commits

Author SHA1 Message Date
Anna Shaleva
91b36657d6 compiler: do not emit code for unnamed unused variables
If variable is unnamed and does not contain function call then it's
treated as unused and code generation may be omitted for it
initialization/declaration.
2022-09-01 09:18:56 +03:00
Evgenii Stratonikov
6701e8cda0 compiler: allow to use local variables in init()
Because body of multiple `init()` functions constitute single
method in contract, we initialize slot with maximum amount of
locals encounterered in any of `init()` functions and clear them
before emitting body of each instance of `init()`.
2020-10-06 19:08:32 +03:00
Evgenii Stratonikov
931dc6c64f compiler: remove debug PrintOps() from tests 2020-08-25 08:53:29 +03:00
Evgenii Stratonikov
4488f61777 compiler: compile init even if there are no globals
`init` can be useful even if no globals are present,
e.g. we can use some syscall inside.
2020-08-05 12:59:53 +03:00
Evgenii Stratonikov
439d9ff94d compiler: initialize packages according to go spec
`init()` functions should be called during package initialization,
after global variables were processed.
2020-08-05 11:15:07 +03:00
Evgenii Stratonikov
6f2759be3a compiler: process packages in deterministic order 2020-08-05 11:00:25 +03:00
Evgenii Stratonikov
b771d2d024 compiler: allow to use init function
Process `init()` functions after global variables has been processed.
It's body is saved into the `_initialize` method where all
initialization is performed.
2020-08-05 11:00:25 +03:00