Commit cb01cbf2 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[parsing] Provide location for function redeclaration error.

Bug: v8:7387
Change-Id: I831bf8f580d4112d7e0f48d90bbe2f44eff73225
Reviewed-on: https://chromium-review.googlesource.com/897326Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51047}
parent e0a76104
......@@ -1532,8 +1532,7 @@ Statement* Parser::DeclareFunction(const AstRawString* variable_name,
ZoneList<const AstRawString*>* names,
bool* ok) {
VariableProxy* proxy =
factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE);
factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE, pos);
Declaration* declaration =
factory()->NewFunctionDeclaration(proxy, function, pos);
Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized,
......
// 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.
"use strict";
{
function foo() {}
function foo() {}
}
*%(basename)s:9: SyntaxError: Identifier 'foo' has already been declared
function foo() {}
^
SyntaxError: Identifier 'foo' has already been declared
// 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.
// MODULE
function foo() {}
function foo() {}
*%(basename)s:8: SyntaxError: Identifier 'foo' has already been declared
function foo() {}
^
SyntaxError: Identifier 'foo' has already been declared
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