void operator should always evaluate to undefined

XMLWordPrintable

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

      void operator should always evaluate to undefined.

      See ECMA 11.4.2 The void Operator


      jjs> void +this
      >> NaN
      >> => undefined instead of NaN

      jjs> (function f(){return void +(void 0)})()
      >> NaN
      >> => undefined instead of NaN

      jjs> void function(){}
      >> Exception in thread "main" java.lang.AssertionError
      >> at jdk.nashorn.internal.codegen.Attr.enterFunctionBody(Attr.java:276)
      >> at jdk.nashorn.internal.codegen.Attr.enterBlock(Attr.java:297)
      >> ...

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

              Created:
              Updated:
              Resolved: