review and merge zahary's work (#5849)

* proper indentation for the generated JS code
* improved dead-code elimination for JavaScript
* test the JS dead-code elimination

A new test spec has been added - "maxcodesize". It specifies the
maximum size of the generated code in bytes.
This commit is contained in:
zah 2017-06-03 13:45:10 +03:00 • committed by Andreas Rumpf
commit 39aef12446
7 changed files with 308 additions and 187 deletions

View file

@ -52,6 +52,7 @@ type
exitCode*: int
msg*: string
ccodeCheck*: string
maxCodeSize*: int
err*: TResultEnum
substr*, sortoutput*: bool
targets*: set[TTarget]
@ -109,6 +110,7 @@ proc specDefaults*(result: var TSpec) =
result.tfile = ""
result.tline = 0
result.tcolumn = 0
result.maxCodeSize = 0
proc parseTargets*(value: string): set[TTarget] =
for v in value.normalize.split:
@ -180,6 +182,7 @@ proc parseSpec*(filename: string): TSpec =
else:
result.cmd = e.value
of "ccodecheck": result.ccodeCheck = e.value
of "maxcodesize": discard parseInt(e.value, result.maxCodeSize)
of "target", "targets":
for v in e.value.normalize.split:
case v