Revert bad fix.
Review URL: https://codereview.chromium.org//288343005 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36365 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -5387,13 +5387,6 @@ void Parser::AddFormalParamsToScope(const ParamList* params,
|
||||
ASSERT((params != NULL) && (params->parameters != NULL));
|
||||
ASSERT(scope != NULL);
|
||||
const int num_parameters = params->parameters->length();
|
||||
// Formal parameters should always be the first variables of the scope.
|
||||
if (scope->num_variables() > 0) {
|
||||
// Any local variables already present in the scope were entered as a side
|
||||
// effect of parsing formal parameter default values. They are aliases of
|
||||
// variables in outer scopes.
|
||||
scope->Clear();
|
||||
}
|
||||
for (int i = 0; i < num_parameters; i++) {
|
||||
ParamDesc& param_desc = (*params->parameters)[i];
|
||||
ASSERT(!is_top_level_ || param_desc.type->IsResolved());
|
||||
|
||||
@@ -51,11 +51,6 @@ bool LocalScope::IsNestedWithin(LocalScope* scope) const {
|
||||
}
|
||||
|
||||
|
||||
void LocalScope::Clear() {
|
||||
variables_.Clear();
|
||||
}
|
||||
|
||||
|
||||
bool LocalScope::AddVariable(LocalVariable* variable) {
|
||||
ASSERT(variable != NULL);
|
||||
if (LocalLookupVariable(variable->name()) != NULL) {
|
||||
|
||||
@@ -230,9 +230,6 @@ class LocalScope : public ZoneAllocated {
|
||||
// scope and to its children at the same loop level.
|
||||
int num_context_variables() const { return num_context_variables_; }
|
||||
|
||||
// Forget all the variables in the scope.
|
||||
void Clear();
|
||||
|
||||
// Add a variable to the scope. Returns false if a variable with the
|
||||
// same name is already present.
|
||||
bool AddVariable(LocalVariable* variable);
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Regression test for issue 18435.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
main() {
|
||||
const MISSING_VALUE = "MISSING_VALUE";
|
||||
|
||||
void foo([var p1 = MISSING_VALUE, var p2 = MISSING_VALUE]) {
|
||||
Expect.equals("P1", p1);
|
||||
Expect.equals("P2", p2);
|
||||
}
|
||||
|
||||
void bar([var p1 = "MISSING_VALUE", var p2 = "MISSING_VALUE"]) {
|
||||
Expect.equals("P1", p1);
|
||||
Expect.equals("P2", p2);
|
||||
}
|
||||
|
||||
foo("P1", "P2");
|
||||
bar("P1", "P2");
|
||||
}
|
||||
Reference in New Issue
Block a user