OLD | NEW |
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 385 |
386 /// Returns the [Local] for [node]. If [isClosureCallMethod] is true, this | 386 /// Returns the [Local] for [node]. If [isClosureCallMethod] is true, this |
387 /// gives the locals map permission to also look one scope higher within the | 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 | 388 /// class for the corresponding local. This can happen in the case of free |
389 /// variables involved with a closure class. | 389 /// variables involved with a closure class. |
390 // TODO(efortuna, johnniwinther): convey this information without a boolean | 390 // TODO(efortuna, johnniwinther): convey this information without a boolean |
391 // parameter. | 391 // parameter. |
392 Local getLocalVariable(ir.VariableDeclaration node, | 392 Local getLocalVariable(ir.VariableDeclaration node, |
393 {bool isClosureCallMethod = false}); | 393 {bool isClosureCallMethod = false}); |
394 | 394 |
395 /// Returns the [Local] corresponding to the [node]. The node must be either | |
396 /// a [ir.FunctionDeclaration] or [ir.FunctionExpression]. | |
397 Local getLocalFunction(ir.TreeNode node); | |
398 | |
399 /// Returns the [JumpTarget] for the break statement [node]. | 395 /// Returns the [JumpTarget] for the break statement [node]. |
400 JumpTarget getJumpTargetForBreak(ir.BreakStatement node); | 396 JumpTarget getJumpTargetForBreak(ir.BreakStatement node); |
401 | 397 |
402 /// Returns `true` if [node] should generate a `continue` to its [JumpTarget]. | 398 /// Returns `true` if [node] should generate a `continue` to its [JumpTarget]. |
403 bool generateContinueForBreak(ir.BreakStatement node); | 399 bool generateContinueForBreak(ir.BreakStatement node); |
404 | 400 |
405 /// Returns the [JumpTarget] defined by the labelled statement [node] or | 401 /// Returns the [JumpTarget] defined by the labelled statement [node] or |
406 /// `null` if [node] is not a jump target. | 402 /// `null` if [node] is not a jump target. |
407 JumpTarget getJumpTargetForLabel(ir.LabeledStatement node); | 403 JumpTarget getJumpTargetForLabel(ir.LabeledStatement node); |
408 | 404 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 uri = Uri.parse(node.location.file); | 458 uri = Uri.parse(node.location.file); |
463 break; | 459 break; |
464 } | 460 } |
465 node = node.parent; | 461 node = node.parent; |
466 } | 462 } |
467 if (uri != null) { | 463 if (uri != null) { |
468 return new SourceSpan(uri, offset, offset + 1); | 464 return new SourceSpan(uri, offset, offset + 1); |
469 } | 465 } |
470 return null; | 466 return null; |
471 } | 467 } |
OLD | NEW |