Index: pkg/compiler/lib/src/typechecker.dart |
diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart |
index 85710b11d3da5cbf9d040e3dd29402925f1cfc42..b7fa5de07f72431bfc5fe075cc7694276c91329e 100644 |
--- a/pkg/compiler/lib/src/typechecker.dart |
+++ b/pkg/compiler/lib/src/typechecker.dart |
@@ -681,7 +681,12 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
assert(invariant(node, element != null, |
message: 'Missing element for identifier')); |
assert(invariant( |
- node, element.isVariable || element.isParameter || element.isField, |
+ node, |
+ element.isVariable || |
+ element.isParameter || |
+ element.isField || |
+ (element.isInitializingFormal && |
+ compiler.options.enableInitializingFormalAccess), |
message: 'Unexpected context element ${element}')); |
return element.computeType(resolution); |
} |
@@ -762,7 +767,9 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
return access; |
} |
if (receiverElement != null && |
- (receiverElement.isVariable || receiverElement.isParameter)) { |
+ (receiverElement.isVariable || receiverElement.isParameter || |
+ (receiverElement.isInitializingFormal && |
+ compiler.options.enableInitializingFormalAccess))) { |
Link<TypePromotion> typePromotions = typePromotionsMap[receiverElement]; |
if (typePromotions != null) { |
while (!typePromotions.isEmpty) { |
@@ -1078,7 +1085,9 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
} |
ElementAccess createPromotedAccess(Element element) { |
- if (element.isVariable || element.isParameter) { |
+ if (element.isVariable || element.isParameter || |
+ (element.isInitializingFormal && |
+ compiler.options.enableInitializingFormalAccess)) { |
TypePromotion typePromotion = getKnownTypePromotion(element); |
if (typePromotion != null) { |
return new PromotedAccess(element, typePromotion.type); |
@@ -1213,7 +1222,11 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
} |
} |
- if (variable != null && (variable.isVariable || variable.isParameter)) { |
+ if (variable != null && |
+ (variable.isVariable || |
+ variable.isParameter || |
+ (variable.isInitializingFormal && |
+ compiler.options.enableInitializingFormalAccess))) { |
DartType knownType = getKnownType(variable); |
if (!knownType.isDynamic) { |
DartType shownType = elements.getType(node.arguments.head); |