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

Unified Diff: test/mjsunit/harmony/block-const-assign.js

Issue 1007783002: Remove --harmony-scoping flag. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CR feedback Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/harmony/block-conflicts.js ('k') | test/mjsunit/harmony/block-early-errors.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/block-const-assign.js
diff --git a/test/mjsunit/harmony/block-const-assign.js b/test/mjsunit/harmony/block-const-assign.js
deleted file mode 100644
index 5efe42c56bbc39603be40b89f933afa455ba859d..0000000000000000000000000000000000000000
--- a/test/mjsunit/harmony/block-const-assign.js
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Flags: --harmony-scoping --harmony-computed-property-names
-
-// Test that we throw early syntax errors in harmony mode
-// when using an immutable binding in an assigment or with
-// prefix/postfix decrement/increment operators.
-
-"use strict";
-
-const decls = [
- // Const declaration.
- function(use) { return "const c = 1; " + use + ";" }, TypeError,
- function(use) { return "const x = 0, c = 1; " + use + ";" }, TypeError,
- function(use) { return "const c = 1, x = (" + use + ");" }, TypeError,
- function(use) { return use + "; const c = 1;" }, ReferenceError,
- function(use) { return use + "; const x = 0, c = 1;" }, ReferenceError,
- function(use) { return "const x = (" + use + "), c = 1;" }, ReferenceError,
- function(use) { return "const c = (" + use + ");" }, ReferenceError,
-
- // Function expression.
- function(use) { return "(function c() { " + use + "; })();"; }, TypeError,
- // TODO(rossberg): Once we have default parameters, test using 'c' there.
-
- // Class expression.
- function(use) {
- return "new class c { constructor() { " + use + " } };";
- }, TypeError,
- function(use) {
- return "(new class c { m() { " + use + " } }).m();";
- }, TypeError,
- function(use) {
- return "(new class c { get a() { " + use + " } }).a;";
- }, TypeError,
- function(use) {
- return "(new class c { set a(x) { " + use + " } }).a = 0;";
- }, TypeError,
- function(use) {
- return "(class c { static m() { " + use + " } }).s();";
- }, TypeError,
- function(use) {
- return "(class c extends (" + use + ") {});";
- }, ReferenceError,
- function(use) {
- return "(class c { [" + use + "]() {} });";
- }, ReferenceError,
- function(use) {
- return "(class c { get [" + use + "]() {} });";
- }, ReferenceError,
- function(use) {
- return "(class c { set [" + use + "](x) {} });";
- }, ReferenceError,
- function(use) {
- return "(class c { static [" + use + "]() {} });";
- }, ReferenceError,
-
- // For loop.
- function(use) {
- return "for (const c = 0; " + use + ";) {}"
- }, TypeError,
- function(use) {
- return "for (const x = 0, c = 0; " + use + ";) {}"
- }, TypeError,
- function(use) {
- return "for (const c = 0; ; " + use + ") {}"
- }, TypeError,
- function(use) {
- return "for (const x = 0, c = 0; ; " + use + ") {}"
- }, TypeError,
- function(use) {
- return "for (const c = 0; ;) { " + use + "; }"
- }, TypeError,
- function(use) {
- return "for (const x = 0, c = 0; ;) { " + use + "; }"
- }, TypeError,
- function(use) {
- return "for (const c in {a: 1}) { " + use + "; }"
- }, TypeError,
- function(use) {
- return "for (const c of [1]) { " + use + "; }"
- }, TypeError,
- function(use) {
- return "for (const x = (" + use + "), c = 0; ;) {}"
- }, ReferenceError,
- function(use) {
- return "for (const c = (" + use + "); ;) {}"
- }, ReferenceError,
-]
-
-let uses = [
- 'c = 1',
- 'c += 1',
- '++c',
- 'c--',
-];
-
-let declcontexts = [
- function(decl) { return decl; },
- function(decl) { return "eval(\'" + decl + "\')"; },
- function(decl) { return "{ " + decl + " }"; },
- function(decl) { return "(function() { " + decl + " })()"; },
-];
-
-let usecontexts = [
- function(use) { return use; },
- function(use) { return "eval(\"" + use + "\")"; },
- function(use) { return "(function() { " + use + " })()"; },
- function(use) { return "(function() { eval(\"" + use + "\"); })()"; },
- function(use) { return "eval(\"(function() { " + use + "; })\")()"; },
-];
-
-function Test(program, error) {
- program = "'use strict'; " + program;
- try {
- print(program, " // throw " + error.name);
- eval(program);
- } catch (e) {
- assertInstanceof(e, error);
- if (e === TypeError) {
- assertTrue(e.toString().indexOf("Assignment to constant variable") >= 0);
- }
- return;
- }
- assertUnreachable();
-}
-
-for (var d = 0; d < decls.length; d += 2) {
- for (var u = 0; u < uses.length; ++u) {
- for (var o = 0; o < declcontexts.length; ++o) {
- for (var i = 0; i < usecontexts.length; ++i) {
- Test(declcontexts[o](decls[d](usecontexts[i](uses[u]))), decls[d + 1]);
- }
- }
- }
-}
« no previous file with comments | « test/mjsunit/harmony/block-conflicts.js ('k') | test/mjsunit/harmony/block-early-errors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698