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

Side by Side Diff: pkg/kernel/lib/ast.dart

Issue 2989563002: Preserve type variables in closure conversion. (Closed)
Patch Set: Update binary.md. Created 3 years, 5 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /// ----------------------------------------------------------------------- 5 /// -----------------------------------------------------------------------
6 /// ERROR HANDLING 6 /// ERROR HANDLING
7 /// ----------------------------------------------------------------------- 7 /// -----------------------------------------------------------------------
8 /// 8 ///
9 /// As a rule of thumb, errors that can be detected statically are handled by 9 /// As a rule of thumb, errors that can be detected statically are handled by
10 /// the frontend, typically by translating the erroneous code into a 'throw' or 10 /// the frontend, typically by translating the erroneous code into a 'throw' or
(...skipping 3058 matching lines...) Expand 10 before | Expand all | Expand 10 after
3069 } 3069 }
3070 } 3070 }
3071 3071
3072 /// Expression of the form `MakeClosure(f, c, t)` where `f` is a name of a 3072 /// Expression of the form `MakeClosure(f, c, t)` where `f` is a name of a
3073 /// closed top-level function, `c` is a Vector representing closure context, and 3073 /// closed top-level function, `c` is a Vector representing closure context, and
3074 /// `t` is the type of the resulting closure. 3074 /// `t` is the type of the resulting closure.
3075 class ClosureCreation extends Expression { 3075 class ClosureCreation extends Expression {
3076 Reference topLevelFunctionReference; 3076 Reference topLevelFunctionReference;
3077 Expression contextVector; 3077 Expression contextVector;
3078 FunctionType functionType; 3078 FunctionType functionType;
3079 List<DartType> typeArgs;
3079 3080
3080 ClosureCreation(Member topLevelFunction, Expression contextVector, 3081 ClosureCreation(Member topLevelFunction, Expression contextVector,
3081 FunctionType functionType) 3082 FunctionType functionType, List<DartType> typeArgs)
3082 : this.byReference( 3083 : this.byReference(getMemberReference(topLevelFunction), contextVector,
3083 getMemberReference(topLevelFunction), contextVector, functionType); 3084 functionType, typeArgs);
3084 3085
3085 ClosureCreation.byReference( 3086 ClosureCreation.byReference(this.topLevelFunctionReference,
3086 this.topLevelFunctionReference, this.contextVector, this.functionType) { 3087 this.contextVector, this.functionType, this.typeArgs) {
3087 contextVector?.parent = this; 3088 contextVector?.parent = this;
3088 } 3089 }
3089 3090
3090 Procedure get topLevelFunction => topLevelFunctionReference?.asProcedure; 3091 Procedure get topLevelFunction => topLevelFunctionReference?.asProcedure;
3091 3092
3092 void set topLevelFunction(Member topLevelFunction) { 3093 void set topLevelFunction(Member topLevelFunction) {
3093 topLevelFunctionReference = getMemberReference(topLevelFunction); 3094 topLevelFunctionReference = getMemberReference(topLevelFunction);
3094 } 3095 }
3095 3096
3096 accept(ExpressionVisitor v) => v.visitClosureCreation(this); 3097 accept(ExpressionVisitor v) => v.visitClosureCreation(this);
3097 accept1(ExpressionVisitor1 v, arg) => v.visitClosureCreation(this, arg); 3098 accept1(ExpressionVisitor1 v, arg) => v.visitClosureCreation(this, arg);
3098 3099
3099 visitChildren(Visitor v) { 3100 visitChildren(Visitor v) {
3100 contextVector?.accept(v); 3101 contextVector?.accept(v);
karlklose 2017/07/25 09:38:23 I think this method should call visitList(typeArgu
sjindel 2017/07/25 13:11:48 I added visitList and functionType ones. But why t
3101 } 3102 }
3102 3103
3103 transformChildren(Transformer v) { 3104 transformChildren(Transformer v) {
3104 if (contextVector != null) { 3105 if (contextVector != null) {
3105 contextVector = contextVector.accept(v); 3106 contextVector = contextVector.accept(v);
3106 contextVector?.parent = this; 3107 contextVector?.parent = this;
3107 } 3108 }
3108 } 3109 }
3109 3110
3110 DartType getStaticType(TypeEnvironment types) { 3111 DartType getStaticType(TypeEnvironment types) {
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
4667 if (typedef_.canonicalName == null) { 4668 if (typedef_.canonicalName == null) {
4668 throw '$typedef_ has no canonical name'; 4669 throw '$typedef_ has no canonical name';
4669 } 4670 }
4670 return typedef_.canonicalName; 4671 return typedef_.canonicalName;
4671 } 4672 }
4672 4673
4673 /// Annotation describing information which is not part of Dart semantics; in 4674 /// Annotation describing information which is not part of Dart semantics; in
4674 /// other words, if this information (or any information it refers to) changes, 4675 /// other words, if this information (or any information it refers to) changes,
4675 /// static analysis and runtime behavior of the library are unaffected. 4676 /// static analysis and runtime behavior of the library are unaffected.
4676 const informative = null; 4677 const informative = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698