| 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:compiler/src/elements/elements.dart'; | 5 import 'package:compiler/src/elements/elements.dart'; |
| 6 import 'package:compiler/src/resolution/access_semantics.dart'; | 6 import 'package:compiler/src/resolution/access_semantics.dart'; |
| 7 import 'package:compiler/src/resolution/send_structure.dart'; | 7 import 'package:compiler/src/resolution/send_structure.dart'; |
| 8 import 'package:compiler/src/resolution/tree_elements.dart'; | 8 import 'package:compiler/src/resolution/tree_elements.dart'; |
| 9 import 'package:compiler/src/tree/nodes.dart' as ast; | 9 import 'package:compiler/src/tree/nodes.dart' as ast; |
| 10 import 'package:kernel/ast.dart' as ir; | 10 import 'package:kernel/ast.dart' as ir; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 Id computeNodeId(ir.TreeNode node) { | 206 Id computeNodeId(ir.TreeNode node) { |
| 207 if (node is ir.MethodInvocation) { | 207 if (node is ir.MethodInvocation) { |
| 208 assert(node.fileOffset != ir.TreeNode.noOffset); | 208 assert(node.fileOffset != ir.TreeNode.noOffset); |
| 209 return new NodeId(node.fileOffset); | 209 return new NodeId(node.fileOffset); |
| 210 } else if (node is ir.PropertyGet) { | 210 } else if (node is ir.PropertyGet) { |
| 211 assert(node.fileOffset != ir.TreeNode.noOffset); | 211 assert(node.fileOffset != ir.TreeNode.noOffset); |
| 212 return new NodeId(node.fileOffset); | 212 return new NodeId(node.fileOffset); |
| 213 } else if (node is ir.VariableDeclaration) { | 213 } else if (node is ir.VariableDeclaration) { |
| 214 assert(node.fileOffset != ir.TreeNode.noOffset); | 214 assert(node.fileOffset != ir.TreeNode.noOffset); |
| 215 return new NodeId(node.fileOffset); | 215 return new NodeId(node.fileOffset); |
| 216 // TODO(johnniwinther): Enable when function expressions have offsets. |
| 217 /*} else if (node is ir.FunctionExpression) { |
| 218 assert(node.fileOffset != ir.TreeNode.noOffset); |
| 219 return new NodeId(node.fileOffset);*/ |
| 216 } else if (node is ir.FunctionDeclaration) { | 220 } else if (node is ir.FunctionDeclaration) { |
| 217 assert(node.fileOffset != ir.TreeNode.noOffset); | 221 assert(node.fileOffset != ir.TreeNode.noOffset); |
| 218 return new NodeId(node.fileOffset); | 222 return new NodeId(node.fileOffset); |
| 219 } | 223 } |
| 220 return null; | 224 return null; |
| 221 } | 225 } |
| 222 } | 226 } |
| 223 | 227 |
| 224 /// Visitor that finds the IR node corresponding to an [Id]. | 228 /// Visitor that finds the IR node corresponding to an [Id]. |
| 225 class IrIdFinder extends ir.Visitor with IrEnumeratorMixin { | 229 class IrIdFinder extends ir.Visitor with IrEnumeratorMixin { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 250 if (found == null) { | 254 if (found == null) { |
| 251 Id id = computeElementId(node); | 255 Id id = computeElementId(node); |
| 252 if (id == soughtId) { | 256 if (id == soughtId) { |
| 253 found = node; | 257 found = node; |
| 254 return; | 258 return; |
| 255 } | 259 } |
| 256 defaultTreeNode(node); | 260 defaultTreeNode(node); |
| 257 } | 261 } |
| 258 } | 262 } |
| 259 } | 263 } |
| OLD | NEW |