From c1db6b5336abfe47e357cfbfcd71efe356d792f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20von=20der=20Ahe=CC=81?= Date: Mon, 12 Nov 2018 11:38:22 +0000 Subject: [PATCH] Only track type promotion of locals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib576bc70128a5b0b045d5083f06a19e822c302b4 Reviewed-on: https://dart-review.googlesource.com/c/84026 Commit-Queue: Peter von der Ahé Commit-Queue: Kevin Millikin Auto-Submit: Peter von der Ahé Reviewed-by: Kevin Millikin --- .../fasta/source/type_promotion_look_ahead_listener.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/front_end/lib/src/fasta/source/type_promotion_look_ahead_listener.dart b/pkg/front_end/lib/src/fasta/source/type_promotion_look_ahead_listener.dart index a5075bc1858..3b6013950d0 100644 --- a/pkg/front_end/lib/src/fasta/source/type_promotion_look_ahead_listener.dart +++ b/pkg/front_end/lib/src/fasta/source/type_promotion_look_ahead_listener.dart @@ -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) {