Bug 1437004 - ParseNode::dump() now displays names for ObjectPropertyNames;r?arai,jorendorff
By opposition to the built-in SpiderMonkey parser, the out of tree parser used as part of the BinAST encoder does not make a difference between
```js
{
foo: 1
}
```
and
```js
{
"foo": 1
}
```
SpiderMonkey considers that the former example has a literal property name, while the latter has a computed property name. By opposition,
the BinAST encoder considers that both are literal property names.
While the runtime behavior is identical, this caused SpiderMonkey to print different ASTs when text-parsing both source files,
but the same AST when bin-parsing both source files.
This patch addresses the issue by changing the behavior of ParseNode::dump() to display names for ObjectPropertyNames instead of
the string `ObjectPropertyName`.
MozReview-Commit-ID: IPZBl5eglIJ
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -686,16 +686,17 @@ NullaryNode::dump(GenericPrinter& out)
if (cstr)
out.printf("%s", cstr);
else
out.printf("%g", pn_dval);
break;
}
case ParseNodeKind::String:
+ case ParseNodeKind::ObjectPropertyName:
pn_atom->dumpCharsNoNewline(out);
break;
default:
out.printf("(%s)", parseNodeNames[size_t(getKind())]);
}
}