summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/SyntaxParseHandler.h
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-07-13 21:33:52 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:41 -0400
commit53e46b1e12ef01ccaabb3256738ea1eac74b7941 (patch)
treed6d90d717876c7c15b8d851ee9ffaa6fd394939e /js/src/frontend/SyntaxParseHandler.h
parentd1c146adf23e317facd03cd5c097f12a69947392 (diff)
downloadUXP-53e46b1e12ef01ccaabb3256738ea1eac74b7941.tar
UXP-53e46b1e12ef01ccaabb3256738ea1eac74b7941.tar.gz
UXP-53e46b1e12ef01ccaabb3256738ea1eac74b7941.tar.lz
UXP-53e46b1e12ef01ccaabb3256738ea1eac74b7941.tar.xz
UXP-53e46b1e12ef01ccaabb3256738ea1eac74b7941.zip
1216630 - Print class source when calling toString on the constructor.
This is accomplished in the following ways. LazyScripts and JSScripts now have 4 offsets: - Source begin and end for the actual source. This is used for lazy parsing. - toString begin and end for toString. Some kinds of functions, like async, only have a different begin offset. Class constructors have different offsets for both begin and end. For syntactically present (i.e. non-default) constructors, the class source span is remembered directly on the LazyScript or JSScript. The toString implementation then splices out the substring directly. For default constructors, a new SRC_CLASS SrcNote type is added. It's binary and has as its arguments the begin and end offsets of the class expression or statement. MakeDefaultConstructor reads the note and overrides the cloned self-hosted function's source object. This is probably the least intrusive way to accomplish this.
Diffstat (limited to 'js/src/frontend/SyntaxParseHandler.h')
-rw-r--r--js/src/frontend/SyntaxParseHandler.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseHandler.h
index f492bab66..895ba6416 100644
--- a/js/src/frontend/SyntaxParseHandler.h
+++ b/js/src/frontend/SyntaxParseHandler.h
@@ -289,7 +289,7 @@ class SyntaxParseHandler
Node newObjectLiteral(uint32_t begin) { return NodeUnparenthesizedObject; }
Node newClassMethodList(uint32_t begin) { return NodeGeneric; }
Node newClassNames(Node outer, Node inner, const TokenPos& pos) { return NodeGeneric; }
- Node newClass(Node name, Node heritage, Node methodBlock) { return NodeGeneric; }
+ Node newClass(Node name, Node heritage, Node methodBlock, const TokenPos& pos) { return NodeGeneric; }
Node newNewTarget(Node newHolder, Node targetHolder) { return NodeGeneric; }
Node newPosHolder(const TokenPos& pos) { return NodeGeneric; }