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

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

Issue 2995353002: Test the CapturedScope for 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
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 areCapturedScopesEquivalent(CapturedScope a, CapturedScope 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.box, b.box)) {
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, 'CapturedScope.boxedVariables', areLocalsEquivalent, 268 checkMaps(aBoxed, bBoxed, 'CapturedScope.boxedVariables', areLocalsEquivalent,
(...skipping 24 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

Powered by Google App Engine
This is Rietveld 408576698