Skip to content

Commit

Permalink
Normative: Add missing GetValue() to TemplateLiteral evaluation
Browse files Browse the repository at this point in the history
As currently spec'd, it is an undefined behavior when an Expression that
evaluates to a Reference is present in a TemplateLiteral, as the
Reference value would be directly passed into ToString which expects an
ECMAScript language value.

Fixes #935.
  • Loading branch information
TimothyGu authored and ljharb committed Sep 6, 2018
1 parent f3e73e7 commit 44e8058
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -12041,8 +12041,8 @@ <h1>Runtime Semantics: Evaluation</h1>
<emu-grammar>SubstitutionTemplate : TemplateHead Expression TemplateSpans</emu-grammar>
<emu-alg>
1. Let _head_ be the TV of |TemplateHead| as defined in <emu-xref href="#sec-template-literal-lexical-components"></emu-xref>.
1. Let _sub_ be the result of evaluating |Expression|.
1. ReturnIfAbrupt(_sub_).
1. Let _subRef_ be the result of evaluating |Expression|.
1. Let _sub_ be ? GetValue(_subRef_).
1. Let _middle_ be ? ToString(_sub_).
1. Let _tail_ be the result of evaluating |TemplateSpans|.
1. ReturnIfAbrupt(_tail_).
Expand All @@ -12066,8 +12066,8 @@ <h1>Runtime Semantics: Evaluation</h1>
<emu-grammar>TemplateMiddleList : TemplateMiddle Expression</emu-grammar>
<emu-alg>
1. Let _head_ be the TV of |TemplateMiddle| as defined in <emu-xref href="#sec-template-literal-lexical-components"></emu-xref>.
1. Let _sub_ be the result of evaluating |Expression|.
1. ReturnIfAbrupt(_sub_).
1. Let _subRef_ be the result of evaluating |Expression|.
1. Let _sub_ be ? GetValue(_subRef_).
1. Let _middle_ be ? ToString(_sub_).
1. Return the sequence of code units consisting of the code units of _head_ followed by the elements of _middle_.
</emu-alg>
Expand All @@ -12079,8 +12079,8 @@ <h1>Runtime Semantics: Evaluation</h1>
1. Let _rest_ be the result of evaluating |TemplateMiddleList|.
1. ReturnIfAbrupt(_rest_).
1. Let _middle_ be the TV of |TemplateMiddle| as defined in <emu-xref href="#sec-template-literal-lexical-components"></emu-xref>.
1. Let _sub_ be the result of evaluating |Expression|.
1. ReturnIfAbrupt(_sub_).
1. Let _subRef_ be the result of evaluating |Expression|.
1. Let _sub_ be ? GetValue(_subRef_).
1. Let _last_ be ? ToString(_sub_).
1. Return the sequence of code units consisting of the elements of _rest_ followed by the code units of _middle_ followed by the elements of _last_.
</emu-alg>
Expand Down

0 comments on commit 44e8058

Please sign in to comment.