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

Unified Diff: runtime/vm/scopes.cc

Issue 293013005: Fix issue 18435 (2nd attempt). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | « runtime/vm/scopes.h ('k') | tests/language/regress_18435_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scopes.cc
===================================================================
--- runtime/vm/scopes.cc (revision 36398)
+++ runtime/vm/scopes.cc (working copy)
@@ -66,6 +66,19 @@
}
+bool LocalScope::InsertParameterAt(intptr_t pos, LocalVariable* parameter) {
+ ASSERT(parameter != NULL);
+ if (LocalLookupVariable(parameter->name()) != NULL) {
+ return false;
+ }
+ variables_.InsertAt(pos, parameter);
+ // InsertParameterAt is not used to add aliases of parameters.
+ ASSERT(parameter->owner() == NULL);
+ parameter->set_owner(this);
+ return true;
+}
+
+
bool LocalScope::AddLabel(SourceLabel* label) {
if (LocalLookupLabel(label->name()) != NULL) {
return false;
@@ -171,6 +184,10 @@
while (pos < num_parameters) {
LocalVariable* parameter = VariableAt(pos);
pos++;
+ // Parsing formal parameter default values may add local variable aliases
+ // to the local scope before the formal parameters are added. However,
+ // the parameters get inserted in front of the aliases, therefore, no
+ // aliases can be encountered among the first num_parameters variables.
ASSERT(parameter->owner() == this);
if (parameter->is_captured()) {
// A captured parameter has a slot allocated in the frame and one in the
« no previous file with comments | « runtime/vm/scopes.h ('k') | tests/language/regress_18435_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698