| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 /// Returns the [JumpTarget] defined by the for-in statement [node] or `null` | 428 /// Returns the [JumpTarget] defined by the for-in statement [node] or `null` |
| 429 /// if [node] is not a jump target. | 429 /// if [node] is not a jump target. |
| 430 JumpTarget getJumpTargetForForIn(ir.ForInStatement node); | 430 JumpTarget getJumpTargetForForIn(ir.ForInStatement node); |
| 431 | 431 |
| 432 /// Returns the [JumpTarget] defined by the while statement [node] or `null` | 432 /// Returns the [JumpTarget] defined by the while statement [node] or `null` |
| 433 /// if [node] is not a jump target. | 433 /// if [node] is not a jump target. |
| 434 JumpTarget getJumpTargetForWhile(ir.WhileStatement node); | 434 JumpTarget getJumpTargetForWhile(ir.WhileStatement node); |
| 435 | 435 |
| 436 /// Returns the [CapturedLoopScope] for the loop [node] in | 436 /// Returns the [CapturedLoopScope] for the loop [node] in |
| 437 /// [closureClassMaps]. | 437 /// [closureLookup]. |
| 438 // TODO(johnniwinther): Remove this when [KernelAstAdapter] is deleted. |
| 438 CapturedLoopScope getCapturedLoopScope( | 439 CapturedLoopScope getCapturedLoopScope( |
| 439 ClosureDataLookup closureLookup, ir.TreeNode node); | 440 ClosureDataLookup closureLookup, ir.TreeNode node); |
| 441 |
| 442 /// Returns the [ClosureRepresentationInfo] for the local function [node] in |
| 443 /// [closureLookup]. |
| 444 // TODO(johnniwinther): Remove this when [KernelAstAdapter] is deleted. |
| 445 ClosureRepresentationInfo getClosureRepresentationInfo( |
| 446 ClosureDataLookup closureLookup, ir.TreeNode node); |
| 440 } | 447 } |
| 441 | 448 |
| 442 /// Comparator for the canonical order or named arguments. | 449 /// Comparator for the canonical order or named arguments. |
| 443 // TODO(johnniwinther): Remove this when named parameters are sorted in dill. | 450 // TODO(johnniwinther): Remove this when named parameters are sorted in dill. |
| 444 int namedOrdering(ir.VariableDeclaration a, ir.VariableDeclaration b) { | 451 int namedOrdering(ir.VariableDeclaration a, ir.VariableDeclaration b) { |
| 445 return a.name.compareTo(b.name); | 452 return a.name.compareTo(b.name); |
| 446 } | 453 } |
| 447 | 454 |
| 448 SourceSpan computeSourceSpanFromTreeNode(ir.TreeNode node) { | 455 SourceSpan computeSourceSpanFromTreeNode(ir.TreeNode node) { |
| 449 // TODO(johnniwinther): Use [ir.Location] directly as a [SourceSpan]. | 456 // TODO(johnniwinther): Use [ir.Location] directly as a [SourceSpan]. |
| 450 Uri uri; | 457 Uri uri; |
| 451 int offset; | 458 int offset; |
| 452 while (node != null) { | 459 while (node != null) { |
| 453 if (node.fileOffset != ir.TreeNode.noOffset) { | 460 if (node.fileOffset != ir.TreeNode.noOffset) { |
| 454 offset = node.fileOffset; | 461 offset = node.fileOffset; |
| 455 uri = Uri.parse(node.location.file); | 462 uri = Uri.parse(node.location.file); |
| 456 break; | 463 break; |
| 457 } | 464 } |
| 458 node = node.parent; | 465 node = node.parent; |
| 459 } | 466 } |
| 460 if (uri != null) { | 467 if (uri != null) { |
| 461 return new SourceSpan(uri, offset, offset + 1); | 468 return new SourceSpan(uri, offset, offset + 1); |
| 462 } | 469 } |
| 463 return null; | 470 return null; |
| 464 } | 471 } |
| OLD | NEW |