Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: tests/compiler/dart2js/serialization/model_test_helper.dart

Issue 2975323002: Renamed some scoping classes to make their usage clearer. (Closed)
Patch Set: . Created 3 years, 5 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 | « pkg/compiler/lib/src/ssa/loop_handler.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) 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 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'package:compiler/src/closure.dart'; 10 import 'package:compiler/src/closure.dart';
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (a is ClosureFieldElement && b is ClosureFieldElement) { 245 if (a is ClosureFieldElement && b is ClosureFieldElement) {
246 return areElementsEquivalent(a.closureClass, b.closureClass) && 246 return areElementsEquivalent(a.closureClass, b.closureClass) &&
247 areLocalsEquivalent(a.local, b.local); 247 areLocalsEquivalent(a.local, b.local);
248 } else if (a is BoxFieldElement && b is BoxFieldElement) { 248 } else if (a is BoxFieldElement && b is BoxFieldElement) {
249 return areElementsEquivalent(a.variableElement, b.variableElement) && 249 return areElementsEquivalent(a.variableElement, b.variableElement) &&
250 areLocalsEquivalent(a.box, b.box); 250 areLocalsEquivalent(a.box, b.box);
251 } 251 }
252 return false; 252 return false;
253 } 253 }
254 254
255 bool areClosureScopesEquivalent(ClosureScope a, ClosureScope b) { 255 bool areCapturedScopesEquivalent(CapturedScope a, CapturedScope b) {
256 if (a == b) return true; 256 if (a == b) return true;
257 if (a == null || b == null) return false; 257 if (a == null || b == null) return false;
258 if (!areLocalsEquivalent(a.context, b.context)) { 258 if (!areLocalsEquivalent(a.context, b.context)) {
259 return false; 259 return false;
260 } 260 }
261 if (!areLocalsEquivalent(a.thisLocal, b.thisLocal)) { 261 if (!areLocalsEquivalent(a.thisLocal, b.thisLocal)) {
262 return false; 262 return false;
263 } 263 }
264 var aBoxed = {}; 264 var aBoxed = {};
265 a.forEachBoxedVariable((k, v) => aBoxed[k] = v); 265 a.forEachBoxedVariable((k, v) => aBoxed[k] = v);
266 var bBoxed = {}; 266 var bBoxed = {};
267 b.forEachBoxedVariable((k, v) => bBoxed[k] = v); 267 b.forEachBoxedVariable((k, v) => bBoxed[k] = v);
268 checkMaps(aBoxed, bBoxed, 'ClosureScope.boxedVariables', areLocalsEquivalent, 268 checkMaps(aBoxed, bBoxed, 'CapturedScope.boxedVariables', areLocalsEquivalent,
269 areElementsEquivalent); 269 areElementsEquivalent);
270 return true; 270 return true;
271 } 271 }
272 272
273 String nodeToString(Node node) { 273 String nodeToString(Node node) {
274 String text = '$node'; 274 String text = '$node';
275 if (text.length > 40) { 275 if (text.length > 40) {
276 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; 276 return '(${node.runtimeType}) ${text.substring(0, 37)}...';
277 } 277 }
278 return '(${node.runtimeType}) $text'; 278 return '(${node.runtimeType}) $text';
(...skipping 14 matching lines...) Expand all
293 check(outputUnit1, outputUnit2, 'OutputUnit.isMainOutput $message', 293 check(outputUnit1, outputUnit2, 'OutputUnit.isMainOutput $message',
294 outputUnit1.isMainOutput, outputUnit2.isMainOutput); 294 outputUnit1.isMainOutput, outputUnit2.isMainOutput);
295 checkSetEquivalence( 295 checkSetEquivalence(
296 outputUnit1, 296 outputUnit1,
297 outputUnit2, 297 outputUnit2,
298 'OutputUnit.imports $message', 298 'OutputUnit.imports $message',
299 outputUnit1.imports, 299 outputUnit1.imports,
300 outputUnit2.imports, 300 outputUnit2.imports,
301 (a, b) => areElementsEquivalent(a.declaration, b.declaration)); 301 (a, b) => areElementsEquivalent(a.declaration, b.declaration));
302 } 302 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/loop_handler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698