Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map.dart

Issue 2994363002: Fix the local variable lookup in the locals handler. (Closed)
Patch Set: stephen comments Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../closure.dart'; 7 import '../closure.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../common_elements.dart'; 10 import '../common_elements.dart';
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 MemberEntity get currentMember; 376 MemberEntity get currentMember;
377 377
378 // TODO(johnniwinther): Make these return the [KernelToLocalsMap] to use from 378 // TODO(johnniwinther): Make these return the [KernelToLocalsMap] to use from
379 // now on. 379 // now on.
380 /// Call to notify that [member] is currently being inlined. 380 /// Call to notify that [member] is currently being inlined.
381 void enterInlinedMember(covariant MemberEntity member); 381 void enterInlinedMember(covariant MemberEntity member);
382 382
383 /// Call to notify that [member] is no longer being inlined. 383 /// Call to notify that [member] is no longer being inlined.
384 void leaveInlinedMember(covariant MemberEntity member); 384 void leaveInlinedMember(covariant MemberEntity member);
385 385
386 /// Returns the [Local] for [node]. 386 /// Returns the [Local] for [node]. If [isClosureCallMethod] is true, this
387 Local getLocalVariable(ir.VariableDeclaration node); 387 /// gives the locals map permission to also look one scope higher within the
388 /// class for the corresponding local. This can happen in the case of free
389 /// variables involved with a closure class.
390 // TODO(efortuna, johnniwinther): convey this information without a boolean
391 // parameter.
392 Local getLocalVariable(ir.VariableDeclaration node,
393 {bool isClosureCallMethod = false});
388 394
389 /// Returns the [Local] corresponding to the [node]. The node must be either 395 /// Returns the [Local] corresponding to the [node]. The node must be either
390 /// a [ir.FunctionDeclaration] or [ir.FunctionExpression]. 396 /// a [ir.FunctionDeclaration] or [ir.FunctionExpression].
391 Local getLocalFunction(ir.TreeNode node); 397 Local getLocalFunction(ir.TreeNode node);
392 398
393 /// Returns the [JumpTarget] for the break statement [node]. 399 /// Returns the [JumpTarget] for the break statement [node].
394 JumpTarget getJumpTargetForBreak(ir.BreakStatement node); 400 JumpTarget getJumpTargetForBreak(ir.BreakStatement node);
395 401
396 /// Returns `true` if [node] should generate a `continue` to its [JumpTarget]. 402 /// Returns `true` if [node] should generate a `continue` to its [JumpTarget].
397 bool generateContinueForBreak(ir.BreakStatement node); 403 bool generateContinueForBreak(ir.BreakStatement node);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 uri = Uri.parse(node.location.file); 455 uri = Uri.parse(node.location.file);
450 break; 456 break;
451 } 457 }
452 node = node.parent; 458 node = node.parent;
453 } 459 }
454 if (uri != null) { 460 if (uri != null) {
455 return new SourceSpan(uri, offset, offset + 1); 461 return new SourceSpan(uri, offset, offset + 1);
456 } 462 }
457 return null; 463 return null;
458 } 464 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_model/locals.dart ('k') | pkg/compiler/lib/src/kernel/element_map_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698