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

Side by Side Diff: test/mjsunit/es6/arrow-functions.js

Issue 1389313003: [parser] fix token end position for regexp literals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test Created 5 years, 2 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/scanner.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 // Arrow functions are like functions, except they throw when using the 5 // Arrow functions are like functions, except they throw when using the
6 // "new" operator on them. 6 // "new" operator on them.
7 assertEquals("function", typeof (() => {})); 7 assertEquals("function", typeof (() => {}));
8 assertEquals(Function.prototype, Object.getPrototypeOf(() => {})); 8 assertEquals(Function.prototype, Object.getPrototypeOf(() => {}));
9 assertThrows(function() { new (() => {}); }, TypeError); 9 assertThrows(function() { new (() => {}); }, TypeError);
10 assertFalse("prototype" in (() => {})); 10 assertFalse("prototype" in (() => {}));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 (function testRestrictedFunctionPropertiesSloppy() { 61 (function testRestrictedFunctionPropertiesSloppy() {
62 var arrowFn = () => {}; 62 var arrowFn = () => {};
63 assertFalse(arrowFn.hasOwnProperty("arguments")); 63 assertFalse(arrowFn.hasOwnProperty("arguments"));
64 assertThrows(function() { return arrowFn.arguments; }, TypeError); 64 assertThrows(function() { return arrowFn.arguments; }, TypeError);
65 assertThrows(function() { arrowFn.arguments = {}; }, TypeError); 65 assertThrows(function() { arrowFn.arguments = {}; }, TypeError);
66 66
67 assertFalse(arrowFn.hasOwnProperty("caller")); 67 assertFalse(arrowFn.hasOwnProperty("caller"));
68 assertThrows(function() { return arrowFn.caller; }, TypeError); 68 assertThrows(function() { return arrowFn.caller; }, TypeError);
69 assertThrows(function() { arrowFn.caller = {}; }, TypeError); 69 assertThrows(function() { arrowFn.caller = {}; }, TypeError);
70 })(); 70 })();
71
72
73 // v8:4474
74 (function testConciseBodyReturnsRegexp() {
75 var arrow1 = () => /foo/
76 var arrow2 = () => /foo/;
77 var arrow3 = () => /foo/i
78 var arrow4 = () => /foo/i;
79 assertEquals(arrow1.toString(), "() => /foo/");
80 assertEquals(arrow2.toString(), "() => /foo/");
81 assertEquals(arrow3.toString(), "() => /foo/i");
82 assertEquals(arrow4.toString(), "() => /foo/i");
83 });
OLDNEW
« no previous file with comments | « src/scanner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698