kovidgoyal / kovidgoyal/rapydscript-ng
uglify option broken
- Dominant language
- C
- Stars
- 206
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
If using the `-u` option, the output is broken. I didn't check it all but there's a few places where a semicolon is missing between statements.
**To reproduce ** :
```
$ rapydscript --version
rapydscript-ng 0.7.19
$ rapydscript <(echo 'print("Hello world")') | node
Hello world
$ rapydscript -u <(echo 'print("Hello world")') | node
[stdin]:1
(function(){"use strict";var ρσ_iterator_symbol=(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol")?Symbol.iterator:"iterator-Symbol-5d0927e5554349048cf0e3762a228256";var ρσ_kwargs_symbol=(typeof Symbol==="function")?Symbol("kwargs-object"):"kwargs-object-Symbol-5d0927e5554349048cf0e3762a228256";var ρσ_cond_temp,ρσ_expr_temp,ρσ_last_exception;var ρσ_object_counter=0;var ρσ_len;function ρσ_bool(val){return!!val};if(!ρσ_bool.__argnames__)Object.defineProperties(ρσ_bool,{__argnames__:{value:["val"]}});function ρσ_print(){var parts;if(typeof console==="object"){parts=[];for(var i = 0; i < arguments.length; i++){parts.push(ρσ_str(arguments[(typeof i==="number"&&i<0)?arguments.length+i:i]))}console.log(parts.join(" "))}};function ρσ_int(val,base){var ans;if(typeof val==="number"){ans=val|0}else{ans=parseInt(val,base||10)}if(isNaN(ans)){throw new ValueError("Invalid literal for int with base "+(base||10)+": "+val)}return ans};if(!ρσ_int.__argnames__)Object.definePr
SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Object. ([stdin]-wrapper:6:22)
at Module._compile (module.js:652:30)
at evalScript (bootstrap_node.js:466:27)
at Socket. (bootstrap_node.js:237:15)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
```
In the resulting file, I see this for example :
`hasattr = ρσ_hasattrfunction `
and
```
Object.defineProperty(ZeroDivisionError.prototype, "__bases__", {
value: [Exception]
}) var ρσ_in, ρσ_desugar_kwargs, ρσ_exists;
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the `rapydscript -u` command from the issue and compare its output with the non-uglified command under Node. Trace the CLI entry point for `-u` and the generated JavaScript around the reported missing semicolons. Done means uglified output parses and prints `Hello world` successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100