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

Side by Side Diff: test/mjsunit/harmony/module-linking.js

Issue 749633002: harmony-scoping: make assignment to 'const' a late error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment update Created 6 years 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 | « test/mjsunit/harmony/classes.js ('k') | test/mjsunit/harmony/regress/regress-2243.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 assertEquals(-1, v = -1) 102 assertEquals(-1, v = -1)
103 assertEquals(-2, R.v = -2) 103 assertEquals(-2, R.v = -2)
104 assertEquals(-2, v) 104 assertEquals(-2, v)
105 assertEquals(-2, R.v) 105 assertEquals(-2, R.v)
106 106
107 assertThrows(function() { l = -1 }, ReferenceError) 107 assertThrows(function() { l = -1 }, ReferenceError)
108 assertThrows(function() { R.l = -2 }, ReferenceError) 108 assertThrows(function() { R.l = -2 }, ReferenceError)
109 assertThrows(function() { l }, ReferenceError) 109 assertThrows(function() { l }, ReferenceError)
110 assertThrows(function() { R.l }, ReferenceError) 110 assertThrows(function() { R.l }, ReferenceError)
111 111
112 assertThrows(function() { eval("c = -1") }, SyntaxError) 112 assertThrows(function() { eval("c = -1") }, TypeError)
113 assertThrows(function() { R.c = -2 }, TypeError) 113 assertThrows(function() { R.c = -2 }, TypeError)
114 114
115 // Initialize first bunch of variables. 115 // Initialize first bunch of variables.
116 export var v = 1 116 export var v = 1
117 export let l = 2 117 export let l = 2
118 export const c = 3 118 export const c = 3
119 export function f() { return 4 } 119 export function f() { return 4 }
120 120
121 assertEquals(1, v) 121 assertEquals(1, v)
122 assertEquals(1, R.v) 122 assertEquals(1, R.v)
123 assertEquals(2, l) 123 assertEquals(2, l)
124 assertEquals(2, R.l) 124 assertEquals(2, R.l)
125 assertEquals(3, c) 125 assertEquals(3, c)
126 assertEquals(3, R.c) 126 assertEquals(3, R.c)
127 127
128 assertEquals(-3, v = -3) 128 assertEquals(-3, v = -3)
129 assertEquals(-4, R.v = -4) 129 assertEquals(-4, R.v = -4)
130 assertEquals(-3, l = -3) 130 assertEquals(-3, l = -3)
131 assertEquals(-4, R.l = -4) 131 assertEquals(-4, R.l = -4)
132 assertThrows(function() { eval("c = -3") }, SyntaxError) 132 assertThrows(function() { eval("c = -3") }, TypeError)
133 assertThrows(function() { R.c = -4 }, TypeError) 133 assertThrows(function() { R.c = -4 }, TypeError)
134 134
135 assertEquals(-4, v) 135 assertEquals(-4, v)
136 assertEquals(-4, R.v) 136 assertEquals(-4, R.v)
137 assertEquals(-4, l) 137 assertEquals(-4, l)
138 assertEquals(-4, R.l) 138 assertEquals(-4, R.l)
139 assertEquals(3, c) 139 assertEquals(3, c)
140 assertEquals(3, R.c) 140 assertEquals(3, R.c)
141 141
142 // Initialize nested module. 142 // Initialize nested module.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 assertSame(B, A.C.D); 289 assertSame(B, A.C.D);
290 assertSame(A.C, A.C.C); 290 assertSame(A.C, A.C.C);
291 assertFalse(A.D === A.C.D); 291 assertFalse(A.D === A.C.D);
292 292
293 assertSame(M1, M2.A1); 293 assertSame(M1, M2.A1);
294 assertSame(M2, M1.A2); 294 assertSame(M2, M1.A2);
295 assertSame(M1, M1.A2.A1); 295 assertSame(M1, M1.A2.A1);
296 assertSame(M2, M2.A1.A2); 296 assertSame(M2, M2.A1.A2);
297 297
298 assertEquals("1234567890", log); 298 assertEquals("1234567890", log);
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/classes.js ('k') | test/mjsunit/harmony/regress/regress-2243.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698