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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1286113003: dart2js cps: Fix treatment of captured type variables. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Tests Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index 11b963494bb240bc832881090e7613cd6fb91fb0..80e18cd8bcbd8cb06b0d78f65dfc3d979cb7eba7 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -2368,11 +2368,17 @@ class IrBuilder {
SourceInformation sourceInformation) {
List<ir.Primitive> arguments = <ir.Primitive>[];
for (ClosureFieldElement field in classElement.closureFields) {
- // Captured 'this' is not available as a local in the current environment,
- // so treat that specially.
- ir.Primitive value = field.local is ThisLocal
- ? buildThis()
- : environment.lookup(field.local);
+ // Captured 'this' and type variables are not always available as locals
+ // in the environment, so treat those specially.
+ ir.Primitive value;
+ if (field.local is ThisLocal) {
+ value = buildThis();
+ } else if (field.local is TypeVariableLocal) {
+ TypeVariableLocal variable = field.local;
+ value = buildTypeVariableAccess(variable.typeVariable);
+ } else {
+ value = environment.lookup(field.local);
+ }
arguments.add(value);
}
return addPrimitive(new ir.CreateInstance(
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698