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: tests/compiler/dart2js/equivalence/id_equivalence.dart

Issue 2996053002: Test closure data on anonymous local functions (Closed)
Patch Set: 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
« no previous file with comments | « tests/compiler/dart2js/closure/data/captured_variable.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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: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
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. 216 } else if (node is ir.FunctionExpression) {
217 /*} else if (node is ir.FunctionExpression) {
218 assert(node.fileOffset != ir.TreeNode.noOffset); 217 assert(node.fileOffset != ir.TreeNode.noOffset);
219 return new NodeId(node.fileOffset);*/ 218 return new NodeId(node.fileOffset);
220 } else if (node is ir.FunctionDeclaration) { 219 } else if (node is ir.FunctionDeclaration) {
221 assert(node.fileOffset != ir.TreeNode.noOffset); 220 assert(node.fileOffset != ir.TreeNode.noOffset);
222 return new NodeId(node.fileOffset); 221 return new NodeId(node.fileOffset);
223 } 222 }
224 return null; 223 return null;
225 } 224 }
226 } 225 }
227 226
228 /// Visitor that finds the IR node corresponding to an [Id]. 227 /// Visitor that finds the IR node corresponding to an [Id].
229 class IrIdFinder extends ir.Visitor with IrEnumeratorMixin { 228 class IrIdFinder extends ir.Visitor with IrEnumeratorMixin {
(...skipping 24 matching lines...) Expand all
254 if (found == null) { 253 if (found == null) {
255 Id id = computeElementId(node); 254 Id id = computeElementId(node);
256 if (id == soughtId) { 255 if (id == soughtId) {
257 found = node; 256 found = node;
258 return; 257 return;
259 } 258 }
260 defaultTreeNode(node); 259 defaultTreeNode(node);
261 } 260 }
262 } 261 }
263 } 262 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/closure/data/captured_variable.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698