Index: pkg/compiler/lib/src/resolution/resolution.dart |
diff --git a/pkg/compiler/lib/src/resolution/resolution.dart b/pkg/compiler/lib/src/resolution/resolution.dart |
index f1ca6d02630b1314b5480dbdf9430ed0556a8a0b..81848d267bc65dfa7226af6bc5b575c1d1b3e17c 100644 |
--- a/pkg/compiler/lib/src/resolution/resolution.dart |
+++ b/pkg/compiler/lib/src/resolution/resolution.dart |
@@ -53,6 +53,7 @@ import 'class_members.dart' show MembersCreator; |
import 'constructors.dart'; |
import 'members.dart'; |
import 'registry.dart'; |
+import 'scope.dart' show MutableScope; |
import 'signatures.dart'; |
import 'tree_elements.dart'; |
import 'typedefs.dart'; |
@@ -248,6 +249,22 @@ class ResolverTask extends CompilerTask { |
if (redirection != null) { |
resolveRedirectingConstructor(resolver, tree, element, redirection); |
} |
+ if (compiler.options.enableInitializingFormalAccess) { |
Johnni Winther
2016/06/13 08:56:48
There is a better approach:
1. Create a subscope
eernst
2016/06/14 15:01:51
That sounds like a much better idea, but there are
|
+ // Ensure that the initializing formal parameters will not be in scope |
+ // when the body of the constructor is resolved. |
+ // TODO(eernst): The following is a temporary solution. An acceptable |
+ // solution requires some more thinking & refactoring: We don't |
+ // otherwise delete from scopes, it introduces ordering dependencies, |
+ // etc.etc.etc. |
+ assert(visitor.scope is MutableScope); |
+ MutableScope mutableScope = visitor.scope; |
+ List<String> names = mutableScope.elements.keys.toList(); |
+ for (String name in names) { |
+ if (mutableScope.elements[name] is InitializingFormalElement) { |
+ mutableScope.elements.remove(name); |
+ } |
+ } |
+ } |
} else if (tree.initializers != null) { |
reporter.reportErrorMessage( |
tree, MessageKind.FUNCTION_WITH_INITIALIZER); |