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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionTypeScope.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/FunctionTypeScope.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionTypeScope.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionTypeScope.java
index 41a350c530e881e137155b93b1ab92e2a9e6cd75..a7e5a36d3d3cbd550b4dd5e2fa073abc0b5e805e 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionTypeScope.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/FunctionTypeScope.java
@@ -24,6 +24,9 @@ import com.google.dart.engine.element.TypeParameterElement;
* @coverage dart.engine.resolver
*/
public class FunctionTypeScope extends EnclosedScope {
+ private final FunctionTypeAliasElement typeElement;
+ private boolean parametersDefined;
+
/**
* Initialize a newly created scope enclosed within another scope.
*
@@ -32,8 +35,8 @@ public class FunctionTypeScope extends EnclosedScope {
*/
public FunctionTypeScope(Scope enclosingScope, FunctionTypeAliasElement typeElement) {
super(new EnclosedScope(enclosingScope));
- defineTypeParameters(typeElement);
- defineParameters(typeElement);
+ this.typeElement = typeElement;
+ defineTypeParameters();
}
/**
@@ -41,7 +44,11 @@ public class FunctionTypeScope extends EnclosedScope {
*
* @param typeElement the element representing the type represented by this scope
*/
- private void defineParameters(FunctionTypeAliasElement typeElement) {
+ public void defineParameters() {
+ if (parametersDefined) {
+ return;
+ }
+ parametersDefined = true;
for (ParameterElement parameter : typeElement.getParameters()) {
define(parameter);
}
@@ -52,7 +59,7 @@ public class FunctionTypeScope extends EnclosedScope {
*
* @param typeElement the element representing the type represented by this scope
*/
- private void defineTypeParameters(FunctionTypeAliasElement typeElement) {
+ private void defineTypeParameters() {
Scope typeParameterScope = getEnclosingScope();
for (TypeParameterElement typeParameter : typeElement.getTypeParameters()) {
typeParameterScope.define(typeParameter);

Powered by Google App Engine
This is Rietveld 408576698