 Chromium Code Reviews
 Chromium Code Reviews Issue 2998803002:
  [kernel] Support for top-level generic functions.  (Closed)
    
  
    Issue 2998803002:
  [kernel] Support for top-level generic functions.  (Closed) 
  | 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..a76a938fec40634d76e4522523dc3d6a1adf613f 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 1-st element of it holds | 
| + // the vector of type arguments that the VM creates, and the 0-th 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. | 
| 
jensj
2017/08/11 06:24:54
As I read it there's an inconsistency here: Here y
 
sjindel
2017/08/11 09:21:06
Good catch, I forgot to update the comment above.
 | 
| _insertStatement(new ExpressionStatement( | 
| - new VectorSet(new VariableGet(contextDeclaration), 0, accessParent))); | 
| + new VectorSet(new VariableGet(contextDeclaration), 1, accessParent))); | 
| } | 
| } |