Parser issues related to functions and blocks

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Fixed
    • Priority: P3
    • 8
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b98
    • generic
    • generic
    • Verified


      * block statement parsing is wrong - accepts function end "}" for missing blocks of if, while, case statements

      * function closure expressions should be assignmentExpressions

      * Implicit new line at EOF is not accepted for 'return', 'yield', 'continue' and 'break'

      >> [Parser code review]:
      >>
      >> jjs> (function(){case0:})()
      >> jjs> (function(){if(0)})()
      >> jjs> (function(){if(0);else})()
      >> jjs> (function(){while(0)})()
      >> => should throw SyntaxError exceptions
      >>
      >> jjs> function sq(x) x,x*x
      >> function sq(x) x,x*x
      >> => should be restricted to AssignmentExpression instead of Expression (to match SpiderMonkey and most likely Rhino, but haven't checked the latter)
      >>
      >> jjs> Function("return")
      >> jjs> Function("yield")
      >> jjs> Function("for(;;)continue")
      >> jjs> Function("for(;;)break")
      >> => should not throw SyntaxError exceptions
      >>

            Assignee:
            Sundararajan Athijegannathan
            Reporter:
            Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: