Commit graph

34 commits

Author SHA1 Message Date
Martok
b0d9f0e2ed Issue #2298 - Carry private-ness of names through ParseNodeHandler 2023-08-31 22:38:30 +08:00
Brian Smith
dc23241afb Issue #1240 - Part 4 - Implement parser support for BigInt literals. https://bugzilla.mozilla.org/show_bug.cgi?id=1505849 Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1456568 Un-result-ified the BigInt XDR code, so we can enable it. https://bugzilla.mozilla.org/show_bug.cgi?id=1419094 Uninitialised memory read with BigInt right-shift https://bugzilla.mozilla.org/show_bug.cgi?id=1679003 2023-07-25 09:09:57 +08:00
Martok
1fac189aea Issue #2142 - Implement class static block
Based-on: m-c 1712138/{2,3}, 1713155/2
2023-05-01 13:27:03 +08:00
Martok
c3b19191f3 Issue #2142 - Parse and process static class fields
Based-on: m-c 1535804/{6,7}
2023-05-01 13:27:03 +08:00
Martok
bcb6203e4f Issue #2142 - Fix several scoping issues in field initializers
Based-on: m-c 1540789, 1547130, 1547467
2023-05-01 13:27:02 +08:00
Martok
51db22ff2f Issue #2142 - Implement syntax for public/private fields and computed field names
This state still has the initializers scoped on .initializers local variable, which will be changed later.

Based-on: m-c 1499448, 1530084, 1530832, 1529448 (partial), 1532921, 1528039, 1528038, 1535166, 1550628,
              1535166, 1550628, 1541641, 1547133, 1540787, 1535804/9
2023-05-01 13:26:43 +08:00
Martok
6f56a494e6 Issue #2142 - Extend newSuperCall for JSOP_SPREADSUPERCALL
Based-on: m-c 1537936
2023-05-01 06:54:43 +08:00
Brian Smith
a8ab41b4c6 Issue #1691 - Part 2: Implement call import and import meta in the parser. https://bugzilla.mozilla.org/show_bug.cgi?id=1427610 https://bugzilla.mozilla.org/show_bug.cgi?id=1484948
(cherry picked from commit 6be083187f49e444de1bb116bb5930b20125190b)
2023-04-30 21:16:43 +08:00
Martok
0132ae2101 Issue #2173 - Introduce FunctionNode::syntaxKind instead of JSOPs
This moves some "implementation details" to later in the emitter,
and also keeps syntax information available for later use.

Based-on: 1518391/{3+4}
2023-04-05 07:18:59 +08:00
Martok
0dac791851 Issue #2173 - Separate CodeNode into FunctionNode and ModuleNode
ModuleNode only has a body and FunctionNode has many more attributes,
and will get more in the following commit.

Based-on: 1518391/2
2023-04-05 07:18:42 +08:00
Martok
3bd300e263 Issue #2173 - Add accessors to LexicalScopeNode
Based-on: m-c 1479659/7
2023-04-05 07:17:05 +08:00
Martok
a49f4d0483 Issue #2173 - Add accessors to NullaryNode and change LoopControlStatement arity to PN_LOOP
Based-on: m-c 1479659/6
2023-04-05 07:16:45 +08:00
Martok
ba730c488f Issue #2173 - Add accessors to NameNode, CodeNode, RegExpLiteral, and add NumericLiteral
Based-on: m-c 1479659/{5,9,10}, m-c 1491147
2023-04-05 07:16:27 +08:00
Martok
68a407c935 Issue #2173 - Add accessors to UnaryNode and subclasses
Based-on: m-c 1479659/4
2023-04-05 07:16:07 +08:00
Martok
662419c507 Issue #2173 - Add accessors to BinaryNode and subclasses
Based-on: m-c 1479659/3
2023-04-05 07:15:49 +08:00
Martok
4726d96fd2 Issue #2173 - Add accessors to TernaryNode
Based-on: m-c 1479659/2
2023-04-05 07:15:31 +08:00
Martok
9c17ec0533 Issue #2173 - Add accessors to ListNode
Based-on: m-c 1479659/{1,12}
2023-04-05 07:15:09 +08:00
Martok
36b5a56242 Issue #2173 - Store the info about the existence of the default case into the switch ParseNode
Based-on: m-c 1477157
2023-04-05 07:14:31 +08:00
Martok
fa1193b8c9 Issue #2173 - Add a new PNK_PROPERTYNAME to hold location information about property access name
Based-on: m-c 1378808/2
2023-04-05 07:14:09 +08:00
Martok
924140d400 Issue #2173 - Add a new PNK_ARGUMENTS node type for call argument lists
Also change PNK_GENEXP (not supported by upstream) to a PN_BINARY node

Based-on: m-c 1378808/1
2023-04-05 07:13:48 +08:00
FranklinDM
a350d51223 Issue #1658 - Part 4: Fix optional chaining assertions and remove unreachable code
This includes the following:

Bug 1611777 - Part 1: Report syntax error for optional property access in self-hosting code. r=yulia!
Bug 1611777 - Part 2: Merge same blocks in emitDeleteOptionalChain(). r=yulia!
Bug 1611777 - Part 3: N/A
Bug 1611777 - Part 4: `super` can't occur on the left-hand side of an optional chain
Bug 1611777 - Part 5: Remove unnecessary super-handling in optional delete. r=yulia!
The child node of a DeleteOptionalChainExpr node can't be a super-property
accessor, so we can remove this code.

Bug 1611777 - Part 6: Crash for unexpected super-base in optional call. r=yulia!
Bug 1611777 - Part 7: Add missing entries to list of valid optional chain start expressions. r=yulia!
Bug 1611777 - Part 8: Add missing emitGet in emitOptionalElemExpression. r=yulia!
Aligns emitOptionalElemExpression() with emitOptionalDotExpression(), so it's
easier to compare both methods against each other.

Bug 1611777 - Part 9: Replace an if-statement with an assertion. r=yulia!
Bug 1611777 - Part 10: N/A
Bug 1611777 - Part 11: Support optional chaining in class heritage expression. r=yulia!
Bug 1611777 - Part 12: Use optionalExpr() for update expressions to match spec grammar. r=yulia!

Using optionalExpr matches the spec grammar more closely. This change also
modifies the reported error message. ++a?.b reported before this change
"unexpected token: '?.'", but now reports "invalid increment/decrement operand".

Bug 1611777 - Part 13: N/A
Bug 1611777 - Part 14: Simplify two lines in optionalExpr(). r=yulia!

We don't need to test for tt == TokenKind::Eof when we return for tt != TokenKind::OptionalChain anyway. Omit local variable for the result value and instead use a tail-call. This matches the local style in the parser more closely.

Bug 1611777 - Part 15: Support FunCall/FunApply optimisations for optional chaining. r=yulia!
Bug 1611777 - Part 16: Pass through ValueUsage in optional chains. r=yulia
2022-05-05 09:04:49 +08:00
FranklinDM
e04a23ff98 Issue #1658 - Part 1: Implement support for optional chaining in the JS Parser
Partially based on: https://bugzilla.mozilla.org/show_bug.cgi?id=1566143
2022-05-05 09:04:36 +08:00
Moonchild
dabd32f955 Issue #1656 - Part 7: Nuke vim config lines in JS 2020-09-25 22:04:24 +08:00
Gaming4JC
c1bdfa62fc Bug 1343481 - Part 7: Add BytecodeEmitter::emitDotGenerator and make yield/await nodes unary.
Tag #1287
2019-12-18 09:15:59 +08:00
Gaming4JC
85350c0655 1339395 - Part 2: Add parser support for rest and spread object properties. 2019-07-22 19:52:35 +08:00
Gaming4JC
51183e0be2 1303703 - Part 3: Syntax parse destructuring assignment patterns. 2019-07-22 19:52:16 +08:00
Gaming4JC
f79ee2fd83 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.
2019-07-22 19:51:38 +08:00
Gaming4JC
942760e3c4 1339963 - Part 1: Split Parser::exportDeclaration. 2019-07-22 19:51:08 +08:00
Gaming4JC
ee1e2aba19 1317375 - Implement "Template Literals Revision / Lifting Template Literal Restriction" ECMAScript proposal 2019-07-22 19:47:00 +08:00
Gaming4JC
578e96b2cc 1315815 - Don't treat async or await as a keyword when they contain escapes. 2019-07-22 19:45:53 +08:00
wolfbeast
da1cb60dc3 Move the Parser::checkFunctionDefinition call into its callers. 2019-04-13 07:01:23 +08:00
wolfbeast
1f00dc49d4 Specify an explicit offset when warning about "use asm" found in the
directive prologue of a script (rather than a function body).
2019-04-13 07:01:16 +08:00
janekptacijarabaci
748c69d7fd Part 1: Implement ES6 function name property semantics
Issue #78
2019-02-15 23:38:44 +08:00
Roy Tam
dcd9973243 import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo 2018-01-19 03:59:58 +08:00