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 'dart:io'; | 5 import 'dart:io'; |
6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
7 import 'package:compiler/src/compiler.dart'; | 7 import 'package:compiler/src/compiler.dart'; |
8 import 'package:compiler/src/commandline_options.dart'; | 8 import 'package:compiler/src/commandline_options.dart'; |
9 import 'package:compiler/src/elements/elements.dart'; | 9 import 'package:compiler/src/elements/elements.dart'; |
10 import 'package:compiler/src/kernel/kernel.dart'; | 10 import 'package:compiler/src/kernel/kernel.dart'; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 Map<Id, ir.Node> irMap = <Id, ir.Node>{}; | 48 Map<Id, ir.Node> irMap = <Id, ir.Node>{}; |
49 ir.Node node = kernel.elementToIr(member); | 49 ir.Node node = kernel.elementToIr(member); |
50 IrIdFinder irFinder = new IrIdFinder(); | 50 IrIdFinder irFinder = new IrIdFinder(); |
51 for (Id id in expectedMap.keys.toList()) { | 51 for (Id id in expectedMap.keys.toList()) { |
52 ir.Node result = irFinder.find(node, id); | 52 ir.Node result = irFinder.find(node, id); |
53 if (result != null) { | 53 if (result != null) { |
54 irMap[id] = result; | 54 irMap[id] = result; |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 elementMap.forEach((Id id, AstElement element) { | 58 elementMap.forEach((Id id, _element) { |
| 59 AstElement element = _element; |
59 ir.Node irNode = irMap[id]; | 60 ir.Node irNode = irMap[id]; |
60 Expect.equals(kernel.elementToIr(element), irNode, | 61 Expect.equals(kernel.elementToIr(element), irNode, |
61 "Element mismatch on $id = $element"); | 62 "Element mismatch on $id = $element"); |
62 expectedMap.remove(id); | 63 expectedMap.remove(id); |
63 irMap.remove(id); | 64 irMap.remove(id); |
64 }); | 65 }); |
65 astMap.forEach((Id id, ast.Node astNode) { | 66 astMap.forEach((Id id, ast.Node astNode) { |
66 ir.Node irNode = irMap[id]; | 67 ir.Node irNode = irMap[id]; |
67 Expect.equals( | 68 Expect.equals( |
68 kernel.nodeToAst[irNode], astNode, "Node mismatch on $id = $astNode"); | 69 kernel.nodeToAst[irNode], astNode, "Node mismatch on $id = $astNode"); |
69 expectedMap.remove(id); | 70 expectedMap.remove(id); |
70 irMap.remove(id); | 71 irMap.remove(id); |
71 }); | 72 }); |
72 Expect.isTrue(irMap.isEmpty, "Extra IR ids: $irMap"); | 73 Expect.isTrue(irMap.isEmpty, "Extra IR ids: $irMap"); |
73 } | 74 } |
OLD | NEW |