Open fyrchik opened 2 years ago
Do we have build tags anywhere in the package data? Do we want to parse comments? Constant conditions seem to be simple enough to try optimizing them, but conditional compilation (hi #ifdef
) for contracts in Go? SCs are relatively simple and they should be simple enough for audit.
Do we have build tags anywhere in the package data? Do we want to parse comments?
Part of the task is to figure it out, but it seems like we could just pass through the build flags to the go command https://github.com/golang/tools/blob/master/go/packages/packages_test.go#L497
SCs are relatively simple and they should be simple enough for audit.
I see your point, but IMO code can be simpler with build tags: for every single scenario (with/without notary) you can see what is actually compiled and used. Also go:build
isn't comparable to #ifdef
in terms of possible complexity, because tags can only be provided on a per-file basis.
There are 2 cases for the build tags:
Notary
is enabled or disabled. This makes our contracts bigger, it would be nice to have the same code base and specify what we need during compilation.debugLog
function declared non empty and removed from the release version.I am hoping this could be done without touching compiler at all, this is just about the files we want to include.
As a consequence, it would be nice to support 2 basic DCE cases:
if debug { }
).I don't want to complicate our compiler, but these cases (at least the second) seems simple enough.