Commit 15eb10b5 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[parser] Fix: disallow "export default ()".

BUG=chromium:797581

Change-Id: I08f880a907f122480a014763975ecc07e2c49f7d
Reviewed-on: https://chromium-review.googlesource.com/856937Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50471}
parent b131cc35
......@@ -1299,6 +1299,7 @@ Statement* Parser::ParseExportDefault(bool* ok) {
int pos = position();
ExpressionClassifier classifier(this);
Expression* value = ParseAssignmentExpression(true, CHECK_OK);
ValidateExpression(CHECK_OK);
SetFunctionName(value, ast_value_factory()->default_string());
const AstRawString* local_name =
......
......@@ -31,6 +31,7 @@
# tested standalone.
'modules-skip*': [SKIP],
'harmony/modules-skip*': [SKIP],
'regress/modules-skip*': [SKIP],
# All tests in the bug directory are expected to fail.
'bugs/*': [FAIL],
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export default ()
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export default (...)
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export default (a, ...b)
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export default 1, 2;
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
let x;
export default x = 0;
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-dynamic-import
function TryToLoadModule(filename, expect_error, token) {
let caught_error;
function SetError(e) {
caught_error = e;
}
import(filename).catch(SetError);
%RunMicrotasks();
if (expect_error) {
assertTrue(caught_error instanceof SyntaxError);
assertEquals("Unexpected token " + token, caught_error.message);
} else {
assertEquals(undefined, caught_error);
}
}
TryToLoadModule("modules-skip-regress-797581-1.js", true, ")");
TryToLoadModule("modules-skip-regress-797581-2.js", true, ")");
TryToLoadModule("modules-skip-regress-797581-3.js", true, "...");
TryToLoadModule("modules-skip-regress-797581-4.js", true, ",");
TryToLoadModule("modules-skip-regress-797581-5.js", false);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment