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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionScope.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/scope/FunctionScope.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionScope.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionScope.java
index ac23190cb5134bf58386b9a60554957144af783f..3f13a81b8e8cc03c8f9aaffa8ac7317597a4ac8d 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionScope.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionScope.java
@@ -22,6 +22,9 @@ import com.google.dart.engine.element.ParameterElement;
* @coverage dart.engine.resolver
*/
public class FunctionScope extends EnclosedScope {
+ private final ExecutableElement functionElement;
+ private boolean parametersDefined;
+
/**
* Initialize a newly created scope enclosed within another scope.
*
@@ -30,15 +33,17 @@ public class FunctionScope extends EnclosedScope {
*/
public FunctionScope(Scope enclosingScope, ExecutableElement functionElement) {
super(new EnclosedScope(enclosingScope));
- defineParameters(functionElement);
+ this.functionElement = functionElement;
}
/**
* Define the parameters for the given function in the scope that encloses this function.
- *
- * @param functionElement the element representing the function represented by this scope
*/
- private void defineParameters(ExecutableElement functionElement) {
+ public void defineParameters() {
+ if (parametersDefined) {
Brian Wilkerson 2013/09/27 12:26:10 Just out of curiosity, why are we invoking this me
scheglov 2013/09/27 23:40:07 It seems that ResolverVisitor redirects to two oth
+ return;
+ }
+ parametersDefined = true;
Scope parameterScope = getEnclosingScope();
if (functionElement.getEnclosingElement() instanceof ExecutableElement) {
String name = functionElement.getName();

Powered by Google App Engine
This is Rietveld 408576698