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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ScopedVisitor.java

Issue 24823002: The scope of a function's signature is the function's enclosing scope, not the formal parameters sc… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ScopedVisitor.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ScopedVisitor.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ScopedVisitor.java
index fb4bd2b5159dec3b11c4f29232841ae0da55835f..1fc004eae72e8b993ea0f241c245fb2abf56559f 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ScopedVisitor.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ScopedVisitor.java
@@ -24,6 +24,7 @@ import com.google.dart.engine.ast.DoStatement;
import com.google.dart.engine.ast.FieldDeclaration;
import com.google.dart.engine.ast.ForEachStatement;
import com.google.dart.engine.ast.ForStatement;
+import com.google.dart.engine.ast.FormalParameterList;
import com.google.dart.engine.ast.FunctionDeclaration;
import com.google.dart.engine.ast.FunctionDeclarationStatement;
import com.google.dart.engine.ast.FunctionExpression;
@@ -274,6 +275,19 @@ public abstract class ScopedVisitor extends GeneralizingASTVisitor<Void> {
}
@Override
+ public Void visitFormalParameterList(FormalParameterList node) {
+ super.visitFormalParameterList(node);
+ // We finished resolving function signature, now include formal parameters scope.
+ if (nameScope instanceof FunctionScope) {
+ ((FunctionScope) nameScope).defineParameters();
+ }
+ if (nameScope instanceof FunctionTypeScope) {
+ ((FunctionTypeScope) nameScope).defineParameters();
+ }
+ return null;
+ }
+
+ @Override
public Void visitForStatement(ForStatement node) {
Scope outerNameScope = nameScope;
LabelScope outerLabelScope = labelScope;

Powered by Google App Engine
This is Rietveld 408576698