Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8019398 nashorn-dev spec corner, review bugs
  3. JDK-8019473

Parser issues related to functions and blocks

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • None
    • 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
      >>

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

              Created:
              Updated:
              Resolved: