Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: test/mjsunit/es6/templates.js

Issue 1580463003: Stop treating scopes containing template strings tagged with 'eval' specially (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var num = 5; 5 var num = 5;
6 var str = "str"; 6 var str = "str";
7 function fn() { return "result"; } 7 function fn() { return "result"; }
8 var obj = { 8 var obj = {
9 num: num, 9 num: num,
10 str: str, 10 str: str,
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 assertEquals("-1-2-3-", tag`-${subs[0]}-${subs[1]}-${subs[2]}-`); 690 assertEquals("-1-2-3-", tag`-${subs[0]}-${subs[1]}-${subs[2]}-`);
691 assertArrayEquals(["get0", "get1", "get2"], log); 691 assertArrayEquals(["get0", "get1", "get2"], log);
692 assertArrayEquals([1, 2, 3], tagged); 692 assertArrayEquals([1, 2, 3], tagged);
693 693
694 tagged.length = 0; 694 tagged.length = 0;
695 log.length = 0; 695 log.length = 0;
696 assertEquals("-1-", tag`-${subs[0]}-`); 696 assertEquals("-1-", tag`-${subs[0]}-`);
697 assertArrayEquals(["get0"], log); 697 assertArrayEquals(["get0"], log);
698 assertArrayEquals([1], tagged); 698 assertArrayEquals([1], tagged);
699 })(); 699 })();
700
701
702 // Since the first argument to the tag function is always an array,
703 // eval calls will always just return that array.
704 (function testEvalTagStrict() {
705 "use strict";
706 var f = (x) => eval`a${x}b`;
707 var result = f();
708 assertEquals(["a", "b"], result);
709 assertSame(result, f());
710 })();
711
712
713 (function testEvalTagSloppy() {
714 var f = (x) => eval`a${x}b`;
715 var result = f();
716 assertEquals(["a", "b"], result);
717 assertSame(result, f());
718 })();
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698