Opened 12 years ago

Closed 12 years ago

#3990 closed defect (fixed)

[patch]custom_rhino.diff - Invalid parser

Reported by: guest Owned by: alex
Priority: blocker Milestone: 0.9
Component: BuildTools Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by alex)

When trying to build the following code:

                cb = function(){
                    this.hideAction();
                    if(c){
                        c();
                    }
                }.createDelegate(this);

The dojo optimizer (Shrinksafe) will replace the last line with:

};.createDelegate(this);
                cb = function(){
                    this.hideAction();
                    if(c){
                        c();
                    }
                };.createDelegate(this);

This ends up being invalid javascript. After going through rhino, here's the needed fix:

>                      case FUNCTION_END:
>                         if (
>                             (getNext(encodedSource, length, i+1) != Token.SEMI) &&
>                             (getNext(encodedSource, length, i+1) != Token.LP) &&
>                             (getNext(encodedSource, length, i+1) != Token.RP) &&
>                             (getNext(encodedSource, length, i+1) != Token.RC) &&
>                             (getNext(encodedSource, length, i+1) != Token.COMMA) &&
>                             (getNext(encodedSource, length, i+1) != Token.DOT) &&
>                             (getNext(encodedSource, length, i+1) != Token.COLON) &&

So adding the line:

>                             (getNext(encodedSource, length, i+1) != Token.DOT) &&

Change History (6)

comment:1 Changed 12 years ago by Adam Peller

Owner: changed from James Burke to alex
severity: blockercritical
Summary: custom_rhino.diff - Invalid parser[patch]custom_rhino.diff - Invalid parser

comment:2 Changed 12 years ago by guest

Btw my CLA is on file, Jonathan Bond-Caron

comment:3 Changed 12 years ago by James Burke

Milestone: 0.9

Adding a milestone, but Alex may reprioritize.

comment:4 Changed 12 years ago by alex

Status: newassigned

comment:5 Changed 12 years ago by alex

Description: modified (diff)

comment:6 Changed 12 years ago by alex

Resolution: fixed
Status: assignedclosed

(In [10040]) ensuring that we don't step on the intrinsic return value of functions. Fixes #3990. Thanks to Jonathan Bond-Caron for the bug report and patch.

Note: See TracTickets for help on using tickets.