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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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:collection'; 5 import 'dart:collection';
6 6
7 import 'package:js_runtime/shared/embedded_names.dart'; 7 import 'package:js_runtime/shared/embedded_names.dart';
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 // last parameter. So no need to directly pass it. 1375 // last parameter. So no need to directly pass it.
1376 if (!localsHandler.isBoxed(parameter)) { 1376 if (!localsHandler.isBoxed(parameter)) {
1377 bodyCallInputs.add(localsHandler.readLocal(parameter)); 1377 bodyCallInputs.add(localsHandler.readLocal(parameter));
1378 } 1378 }
1379 }); 1379 });
1380 1380
1381 // If there are locals that escape (ie mutated in closures), we 1381 // If there are locals that escape (ie mutated in closures), we
1382 // pass the box to the constructor. 1382 // pass the box to the constructor.
1383 // The box must be passed before any type variable. 1383 // The box must be passed before any type variable.
1384 CapturedScope scopeData = closureDataLookup.getCapturedScope(constructor); 1384 CapturedScope scopeData = closureDataLookup.getCapturedScope(constructor);
1385 if (scopeData.requiresContextBox) { 1385 if (scopeData.hasBox) {
1386 bodyCallInputs.add(localsHandler.readLocal(scopeData.context)); 1386 bodyCallInputs.add(localsHandler.readLocal(scopeData.box));
1387 } 1387 }
1388 1388
1389 // Type variables arguments must come after the box (if there is one). 1389 // Type variables arguments must come after the box (if there is one).
1390 ClassElement currentClass = constructor.enclosingClass; 1390 ClassElement currentClass = constructor.enclosingClass;
1391 if (rtiNeed.classNeedsRti(currentClass)) { 1391 if (rtiNeed.classNeedsRti(currentClass)) {
1392 // If [currentClass] needs RTI, we add the type variables as 1392 // If [currentClass] needs RTI, we add the type variables as
1393 // parameters of the generative constructor body. 1393 // parameters of the generative constructor body.
1394 currentClass.typeVariables.forEach((_argument) { 1394 currentClass.typeVariables.forEach((_argument) {
1395 ResolutionTypeVariableType argument = _argument; 1395 ResolutionTypeVariableType argument = _argument;
1396 // TODO(johnniwinther): Substitute [argument] with 1396 // TODO(johnniwinther): Substitute [argument] with
(...skipping 5457 matching lines...) Expand 10 before | Expand all | Expand 10 after
6854 this.oldReturnLocal, 6854 this.oldReturnLocal,
6855 this.oldReturnType, 6855 this.oldReturnType,
6856 this.oldResolvedAst, 6856 this.oldResolvedAst,
6857 this.oldStack, 6857 this.oldStack,
6858 this.oldLocalsHandler, 6858 this.oldLocalsHandler,
6859 this.inTryStatement, 6859 this.inTryStatement,
6860 this.allFunctionsCalledOnce, 6860 this.allFunctionsCalledOnce,
6861 this.oldElementInferenceResults) 6861 this.oldElementInferenceResults)
6862 : super(function); 6862 : super(function);
6863 } 6863 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698