Skip to content

uglify option broken #142

Description

@kakaroto

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.<anonymous> ([stdin]-wrapper:6:22)
    at Module._compile (module.js:652:30)
    at evalScript (bootstrap_node.js:466:27)
    at Socket.<anonymous> (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;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions