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

Unified Diff: pkg/kernel/lib/transformations/closure/rewriter.dart

Issue 2998803002: [kernel] Support for top-level generic functions. (Closed)
Patch Set: Review comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/lib/transformations/closure/converter.dart ('k') | pkg/kernel/test/closures/closures.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/transformations/closure/rewriter.dart
diff --git a/pkg/kernel/lib/transformations/closure/rewriter.dart b/pkg/kernel/lib/transformations/closure/rewriter.dart
index 3f4d0d3910623b206461687963df5426f2df342a..ea272605ea11bc3d4637701e4f004404ce355ef5 100644
--- a/pkg/kernel/lib/transformations/closure/rewriter.dart
+++ b/pkg/kernel/lib/transformations/closure/rewriter.dart
@@ -30,9 +30,10 @@ abstract class AstRewriter {
void _createDeclaration() {
assert(contextDeclaration == null && vectorCreation == null);
- // Context size is set to 1 initially, because the 0-th element of it works
- // as a link to the parent context.
- vectorCreation = new VectorCreation(1);
+ // Context size is set to 2 initially, because the 0-th element of it holds
+ // the vector of type arguments that the VM creates, and the 1-st element
+ // works as a link to the parent context.
+ vectorCreation = new VectorCreation(2);
contextDeclaration = new VariableDeclaration.forValue(vectorCreation,
type: new VectorType());
contextDeclaration.name = "#context";
@@ -74,9 +75,9 @@ class BlockRewriter extends AstRewriter {
_createDeclaration();
_insertStatement(contextDeclaration);
if (accessParent is! NullLiteral) {
- // Index 0 of a context always points to the parent.
+ // Index 1 of a context always points to the parent.
_insertStatement(new ExpressionStatement(
- new VectorSet(new VariableGet(contextDeclaration), 0, accessParent)));
+ new VectorSet(new VariableGet(contextDeclaration), 1, accessParent)));
}
}
« no previous file with comments | « pkg/kernel/lib/transformations/closure/converter.dart ('k') | pkg/kernel/test/closures/closures.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698