From 8d7bc4bef5340efd489f4c8dc148ff89ed43d42e Mon Sep 17 00:00:00 2001 From: "regis@google.com" Date: Tue, 20 May 2014 17:03:10 +0000 Subject: [PATCH] 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 --- runtime/vm/parser.cc | 7 ------- runtime/vm/scopes.cc | 5 ----- runtime/vm/scopes.h | 3 --- tests/language/regress_18435_test.dart | 24 ------------------------ 4 files changed, 39 deletions(-) delete mode 100644 tests/language/regress_18435_test.dart diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc index 859547b0488..66018e5894c 100644 --- a/runtime/vm/parser.cc +++ b/runtime/vm/parser.cc @@ -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()); diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc index 4f49fd3ea25..b6a6064610e 100644 --- a/runtime/vm/scopes.cc +++ b/runtime/vm/scopes.cc @@ -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) { diff --git a/runtime/vm/scopes.h b/runtime/vm/scopes.h index 61aab5acf25..6bd93ac1d56 100644 --- a/runtime/vm/scopes.h +++ b/runtime/vm/scopes.h @@ -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); diff --git a/tests/language/regress_18435_test.dart b/tests/language/regress_18435_test.dart deleted file mode 100644 index 267562f0d4e..00000000000 --- a/tests/language/regress_18435_test.dart +++ /dev/null @@ -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"); -}