Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit78e1f43

Browse files
greghucGeoffreyBooth
authored andcommitted
CS1 tagged template literals (and CS2 interpolated strings as template literals) (#4352)
* Add initial support for template literals with nointerpolation* Change ‘unexpected string’ error message tests touse number not identifier prefix.Identifer prefixes are now valid as taggedtemplate literals* Test tagged template literals for non-interpolatedstrings and tag function.* Tagged template literals work for pure Strings.Pull tagged template definition up to Invocationlevel in grammar, enabling chained invocation calls.We can view a tagged template is a special formof function call.* Readying for StringWithInterpolations work.* Tweaks.* Fix style* Pass StringWithInterpolations parameter straightinto Call constructor.StringWithInterpolations will be output astemplate literal, so already in correct form foroutputting tagged template literal.* Strip down compileNode for StringWithInterpolations* Done StringLiteral case for interpolated Strings* Remove need for TemplateLiteral* Simplify code.* Small code tidy* Interpolated strings now outputting as template literals.Still needs comprehensive testing.* Move error message tests into error_messages.coffee; remove test that is testing for a Node runtime error* Split up tests that were testing multiple things per test, so that each test tests only one thing* Edge cases: tagged template literals containing interpolated strings or even internal tagged template literals* Make more concise, more idiomatic style* Pull back extreme indentation* Restore and fix commented-out tests* Edge case: tagged template literal with empty string* Only use new ES2015 interpolated string syntax if we’re inside a tagged template literal; this keeps this PR safe to merge into CoffeeScript 1.x. Remove the code from this commit to make all interpolated strings use ES2015 syntax, for CoffeeScript 2.* Compiler now _doesn’t_ use template literals.* Expand tagged template literal tests* Move ‘Unexpected string’ error message tests intotagged template literal section.‘Unexpected string’ is not reported in these testscenarios anymore. Instead, we error that theprefixing literal is not a function.* Don’t unwrap StringWithInterpolations.Saw bug with program consisting of “#{2}” notcompiling with template literals. Root cause wasthat Block.compileNode was unwrapping interpolatedstring and so didn’t use compileNode logic atStringWithInterpolations level.* No need to bracket interpolated strings any more.When interpolated string looks like `hello ${2}`,no extract brackets are needed, as the `s mark thebeginning and end.* Show html templating with tagged template literals* Multiline should match multiline* Comment out unnecessary `unwrap`, which is only needed for CoffeeScript 2 all-ES2015 syntax output
1 parenta49c5c5 commit78e1f43

File tree

7 files changed

+385
-137
lines changed

7 files changed

+385
-137
lines changed

‎lib/coffee-script/grammar.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎lib/coffee-script/nodes.js

Lines changed: 55 additions & 3 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp