Index: pkg/front_end/lib/src/fasta/builder/procedure_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/builder/procedure_builder.dart b/pkg/front_end/lib/src/fasta/builder/procedure_builder.dart |
index 446ed241ed96d2a8aa04bba0daee99a4b3511835..27b96a0e5a72739f265026056c9faca6e81ac9de 100644 |
--- a/pkg/front_end/lib/src/fasta/builder/procedure_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/builder/procedure_builder.dart |
@@ -75,6 +75,30 @@ abstract class ProcedureBuilder<T extends TypeBuilder> extends MemberBuilder { |
return new Scope(local, null, parent, isModifiable: false); |
} |
+ Scope computeFormalParameterInitializerScope(Scope parent) { |
+ // From |
+ // [dartLangSpec.tex](../../../../../../docs/language/dartLangSpec.tex) at |
+ // revision 94b23d3b125e9d246e07a2b43b61740759a0dace: |
+ // |
+ // When the formal parameter list of a non-redirecting generative |
+ // constructor contains any initializing formals, a new scope is |
+ // introduced, the _formal parameter initializer scope_, which is the |
+ // current scope of the initializer list of the constructor, and which is |
+ // enclosed in the scope where the constructor is declared. Each |
+ // initializing formal in the formal parameter list introduces a final |
+ // local variable into the formal parameter initializer scope, but not into |
+ // the formal parameter scope; every other formal parameter introduces a |
+ // local variable into both the formal parameter scope and the formal |
+ // parameter initializer scope. |
+ |
+ if (formals == null) return parent; |
+ Map<String, Builder> local = <String, Builder>{}; |
+ for (FormalParameterBuilder formal in formals) { |
+ local[formal.name] = formal.forFormalParameterInitializerScope(); |
+ } |
+ return new Scope(local, null, parent, isModifiable: false); |
+ } |
+ |
/// This scope doesn't correspond to any scope specified in the Dart |
/// Programming Language Specifiction, 4th ed. It's an unspecified extension |
/// to support generic methods. |
@@ -86,4 +110,11 @@ abstract class ProcedureBuilder<T extends TypeBuilder> extends MemberBuilder { |
} |
return new Scope(local, null, parent, isModifiable: false); |
} |
+ |
+ FormalParameterBuilder getFormal(String name) { |
+ for (FormalParameterBuilder formal in formals) { |
+ if (formal.name == name) return formal; |
+ } |
+ return null; |
+ } |
} |