OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.serialization_model_test; | 5 library dart2js.serialization_model_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 areNodesEquivalent, | 175 areNodesEquivalent, |
176 areClosureScopesEquivalent, | 176 areClosureScopesEquivalent, |
177 verbose: verbose, | 177 verbose: verbose, |
178 keyToString: nodeToString); | 178 keyToString: nodeToString); |
179 checkSets( | 179 checkSets( |
180 closureData1.variablesUsedInTryOrGenerator, | 180 closureData1.variablesUsedInTryOrGenerator, |
181 closureData2.variablesUsedInTryOrGenerator, | 181 closureData2.variablesUsedInTryOrGenerator, |
182 "$element1.variablesUsedInTryOrGenerator", | 182 "$element1.variablesUsedInTryOrGenerator", |
183 areLocalsEquivalent, | 183 areLocalsEquivalent, |
184 verbose: verbose); | 184 verbose: verbose); |
| 185 if (element1 is MemberElement && element2 is MemberElement) { |
| 186 MemberElement member1 = element1.implementation; |
| 187 MemberElement member2 = element2.implementation; |
| 188 checkSets( |
| 189 member1.nestedClosures, |
| 190 member2.nestedClosures, |
| 191 "$member1.nestedClosures", |
| 192 areElementsEquivalent, |
| 193 verbose: verbose, |
| 194 onSameElement: (a, b) { |
| 195 LocalFunctionElement localFunction1 = a.expression; |
| 196 LocalFunctionElement localFunction2 = b.expression; |
| 197 checkElementIdentities( |
| 198 localFunction1, localFunction2, |
| 199 'enclosingClass', |
| 200 localFunction1.enclosingClass, localFunction2.enclosingClass); |
| 201 }); |
| 202 } |
185 } | 203 } |
186 JavaScriptBackend backend1 = compiler1.backend; | 204 JavaScriptBackend backend1 = compiler1.backend; |
187 JavaScriptBackend backend2 = compiler2.backend; | 205 JavaScriptBackend backend2 = compiler2.backend; |
188 Expect.equals( | 206 Expect.equals( |
189 backend1.inlineCache.getCurrentCacheDecisionForTesting(element1), | 207 backend1.inlineCache.getCurrentCacheDecisionForTesting(element1), |
190 backend2.inlineCache.getCurrentCacheDecisionForTesting(element2), | 208 backend2.inlineCache.getCurrentCacheDecisionForTesting(element2), |
191 "Inline cache decision mismatch for $element1 vs $element2"); | 209 "Inline cache decision mismatch for $element1 vs $element2"); |
192 } | 210 } |
193 | 211 |
194 void checkMixinUses( | 212 void checkMixinUses( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 return true; | 314 return true; |
297 } | 315 } |
298 | 316 |
299 String nodeToString(Node node) { | 317 String nodeToString(Node node) { |
300 String text = '$node'; | 318 String text = '$node'; |
301 if (text.length > 40) { | 319 if (text.length > 40) { |
302 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; | 320 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; |
303 } | 321 } |
304 return '(${node.runtimeType}) $text'; | 322 return '(${node.runtimeType}) $text'; |
305 } | 323 } |
OLD | NEW |