Closed Bug 1501541 Opened 6 years ago Closed 2 years ago

[BinAST] Function's displayName algorithm depends on the existence of parenthesis, which cannot be represented in current BinAST spec

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED WONTFIX
Tracking Status
firefox65 --- disabled

People

(Reporter: arai, Unassigned)

References

Details

code:

var Foo = function (){
    return function(){};
}();
print(displayName(Foo));


the result with plain JS
  Foo</<

the result with BinAST
  Foo
looks like something related to eager/lazy compilation.

code:
  var Foo = (function (){
      return function(){};
  })();
  print(displayName(Foo));



the result with plain JS
  Foo

the result with BinAST
  Foo
Summary: [BinAST] Function's displayName is wrong → [BinAST] Function's displayName algorithm depends on the existence of parenthesis, which cannot be represented in BinAST
This depends on the spec, which currently doesn't support have interface for parenthesis.
(and also the JS parser in binjs-ref)

We should think about whether it makes sense to introduce parenthesis interface into the AST or not.

Some parenthesis are already implicitly represented in the AST, because of operator precedence,
but redundant parenthesis are just omitted.

Representing all parenthesis in the AST will make the file bigger, and also decode longer.

Introducing only redundant parenthesis will be nice to keep the AST small, but encoder (and possibly decoder) will become complicated.
Summary: [BinAST] Function's displayName algorithm depends on the existence of parenthesis, which cannot be represented in BinAST → [BinAST] Function's displayName algorithm depends on the existence of parenthesis, which cannot be represented in current BinAST spec
Assignee: arai.unmht → nobody
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.