Only track type promotion of locals

Change-Id: Ib576bc70128a5b0b045d5083f06a19e822c302b4
Reviewed-on: https://dart-review.googlesource.com/c/84026
Commit-Queue: Peter von der Ahé <ahe@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
This commit is contained in:
Peter von der Ahé
2018-11-12 11:38:22 +00:00
committed by commit-bot@chromium.org
parent afe3e68841
commit c1db6b5336
@@ -643,11 +643,16 @@ class TypePromotionLookAheadListener extends Listener {
@override
void handleIdentifier(Token token, IdentifierContext context) {
debugEvent("Identifier", token);
debugEvent("Identifier ${context}", token);
if (context.inSymbol) {
// Do nothing.
} else if (context.inDeclaration) {
state.declareIdentifier(token);
if (identical(IdentifierContext.localVariableDeclaration, context) ||
identical(IdentifierContext.formalParameterDeclaration, context)) {
state.declareIdentifier(token);
} else {
state.pushNull(token.lexeme, token);
}
} else if (context.isContinuation) {
state.pushNull(token.lexeme, token);
} else if (context.isScopeReference) {