Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for Bug 783507 ("Implement ES.next quasi-literals (Rhino)") #81

Closed
wants to merge 4 commits into from

Conversation

anba
Copy link
Contributor

@anba anba commented Aug 17, 2012

This is a first stab at implementing quasi-literals (resp. the new official name "string templates"), it's still kind of rough and could need some clean-up, but should be sufficient as a starting point. I've used the current ES6 draft (July 8, 2012 Draft) for this patch.

There are four individual patches:
[Patch 1] fixes two bugs in the current code base which prevented the test cases to succeed
[Patch 2] contains the majority of the changes (frontend as well as backend)
[Patch 3] adds the new "String.raw" function
[Patch 4] adds some test cases for quasi-literals and String.raw

Initial clean-up / bug-fixing so the test cases will pass

NativeArray:
- support changing attributes for dense arrays

ScriptRuntime:
- call [[DefaultValue]] when appending objects and strings

JsTestsBase:
- close file handle
Token, ast/QuasiCall, ast/QuasiCharacters, ast/QuasiLiteral:
- new AST nodes for quasi literals resp. tagged quasis resp. quasi literal sections

TokenStream, Parser:
- tokenize and parse quasi literals
- some extra code was necessary to ensure "\r\n" sequences aren't reduced to "\n"

IRFactory, Decompiler, ScriptNode, Node:
- desugar default quasis to simple string concatenation
- desugar tagged quasis to call expressions
- collect each functions tagged quasis in ScriptNode

ScriptRuntime:
- implement the abstract operation GetQuasiCallSite

CodeGenerator, Icode, Interpreter, InterpreterData:
- added new opcode for the call to GetQuasiCallSite
- record cooked and raw quasi literal sections for later construction of the call site object

optimizer/Block, optimizer/Codegen:
- record cooked and raw quasi literal sections for later construction of the call site object
- same approach as for RegExp literals, could be optimized if necessary
Add implementation for String.raw [15.5.3.4]
Add test cases for:
- default quasis
- tagged quasis
- String.raw
p-bakker added a commit to p-bakker/rhino that referenced this pull request Sep 18, 2020
manual rebase of Patch 2 & 3 for
mozilla#81
p-bakker added a commit to p-bakker/rhino that referenced this pull request Sep 21, 2020
tonygermano added a commit to tonygermano/rhino that referenced this pull request May 2, 2021
Fixed merge conflict and bugs from 3rd commit of mozilla#81

Co-authored-by: André Bargull <[email protected]>
@tonygermano tonygermano mentioned this pull request May 2, 2021
p-bakker added a commit to p-bakker/rhino that referenced this pull request May 19, 2021
manual rebase of Patch 2 & 3 for
mozilla#81
p-bakker added a commit to p-bakker/rhino that referenced this pull request May 19, 2021
p-bakker added a commit to p-bakker/rhino that referenced this pull request May 21, 2021
manual rebase of Patch 2 & 3 for
mozilla#81
p-bakker added a commit to p-bakker/rhino that referenced this pull request May 21, 2021
p-bakker added a commit to p-bakker/rhino that referenced this pull request Jun 1, 2021
manual rebase of Patch 2 & 3 for
mozilla#81
p-bakker added a commit to p-bakker/rhino that referenced this pull request Jun 1, 2021
p-bakker added a commit to p-bakker/rhino that referenced this pull request Jun 8, 2021
manual rebase of Patch 2 & 3 for
mozilla#81
p-bakker added a commit to p-bakker/rhino that referenced this pull request Jun 8, 2021
gbrail pushed a commit that referenced this pull request Jun 10, 2021
manual rebase of Patch 2 & 3 for
#81
gbrail pushed a commit that referenced this pull request Jun 10, 2021
@tonygermano
Copy link
Contributor

I think this can finally be closed since #879 and #904 have been merged.

@p-bakker
Copy link
Collaborator

Merged via #904

@p-bakker p-bakker closed this Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants