| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.semantics_visitor; | 5 library dart2js.semantics_visitor; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../dart2jslib.dart' show invariant; | 8 import '../dart2jslib.dart' show invariant; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| 11 import '../helpers/helpers.dart'; | 11 import '../helpers/helpers.dart'; |
| 12 import '../tree/tree.dart'; | 12 import '../tree/tree.dart'; |
| 13 import '../universe/universe.dart'; | 13 import '../universe/universe.dart'; |
| 14 import '../util/util.dart' show Spannable, SpannableAssertionFailure; | 14 import '../util/util.dart' show Spannable, SpannableAssertionFailure; |
| 15 import 'access_semantics.dart'; | 15 import 'access_semantics.dart'; |
| 16 import 'operators.dart'; | 16 import 'operators.dart'; |
| 17 import 'resolution.dart'; | 17 import 'resolution.dart'; |
| 18 import 'send_structure.dart'; | 18 import 'send_structure.dart'; |
| 19 | 19 |
| 20 part 'semantic_visitor_mixins.dart'; | 20 part 'semantic_visitor_mixins.dart'; |
| 21 part 'send_resolver.dart'; | 21 part 'send_resolver.dart'; |
| 22 | 22 |
| 23 abstract class SemanticVisitor<R, A> extends Visitor<R> | 23 /// Mixin that couples a [SendResolverMixin] to a [SemanticSendVisitor] in a |
| 24 with SendResolverMixin { | 24 /// [Visitor]. |
| 25 TreeElements elements; | 25 abstract class SemanticSendResolvedMixin<R, A> |
| 26 | 26 implements Visitor<R>, SendResolverMixin { |
| 27 SemanticVisitor(this.elements); | |
| 28 | 27 |
| 29 SemanticSendVisitor<R, A> get sendVisitor; | 28 SemanticSendVisitor<R, A> get sendVisitor; |
| 30 | 29 |
| 31 @override | 30 @override |
| 32 R visitIdentifier(Identifier node) { | 31 R visitIdentifier(Identifier node) { |
| 33 // TODO(johnniwinther): Support argument. | 32 // TODO(johnniwinther): Support argument. |
| 34 A arg = null; | 33 A arg = null; |
| 35 if (node.isThis()) { | 34 if (node.isThis()) { |
| 36 // TODO(johnniwinther): Parse `this` as a [Send] whose selector is `this` | 35 // TODO(johnniwinther): Parse `this` as a [Send] whose selector is `this` |
| 37 // to normalize with `this(...)`. | 36 // to normalize with `this(...)`. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 65 | 64 |
| 66 NewStructure structure = computeNewStructure(node); | 65 NewStructure structure = computeNewStructure(node); |
| 67 if (structure == null) { | 66 if (structure == null) { |
| 68 return internalError(node, 'No structure for $node'); | 67 return internalError(node, 'No structure for $node'); |
| 69 } else { | 68 } else { |
| 70 return structure.dispatch(sendVisitor, node, arg); | 69 return structure.dispatch(sendVisitor, node, arg); |
| 71 } | 70 } |
| 72 } | 71 } |
| 73 } | 72 } |
| 74 | 73 |
| 74 /// Mixin that couples a [DeclarationResolverMixin] to a |
| 75 /// [SemanticDeclarationVisitor] in a [Visitor]. |
| 76 abstract class SemanticDeclarationResolvedMixin<R, A> |
| 77 implements Visitor<R>, DeclarationResolverMixin { |
| 78 |
| 79 SemanticDeclarationVisitor<R, A> get declVisitor; |
| 80 |
| 81 @override |
| 82 R visitFunctionExpression(FunctionExpression node) { |
| 83 // TODO(johnniwinther): Support argument. |
| 84 A arg = null; |
| 85 |
| 86 DeclStructure structure = computeFunctionStructure(node); |
| 87 if (structure == null) { |
| 88 return internalError(node, 'No structure for $node'); |
| 89 } else { |
| 90 return structure.dispatch(declVisitor, node, arg); |
| 91 } |
| 92 } |
| 93 |
| 94 visitInitializers(NodeList initializers, A arg) { |
| 95 if (initializers != null) { |
| 96 for (Node node in initializers) { |
| 97 InitializerStructure structure = computeInitializerStructure(node); |
| 98 if (structure == null) { |
| 99 return internalError(node, 'No structure for $node'); |
| 100 } else { |
| 101 return structure.dispatch(declVisitor, node, arg); |
| 102 } |
| 103 } |
| 104 } |
| 105 } |
| 106 |
| 107 visitParameters(NodeList parameters, A arg) { |
| 108 List<ParameterStructure> structures = |
| 109 computeParameterStructures(parameters); |
| 110 for (ParameterStructure structure in structures) { |
| 111 structure.dispatch(declVisitor, arg); |
| 112 } |
| 113 } |
| 114 |
| 115 @override |
| 116 R visitVariableDefinitions(VariableDefinitions definitions) { |
| 117 // TODO(johnniwinther): Support argument. |
| 118 A arg = null; |
| 119 |
| 120 computeVariableStructures( |
| 121 definitions, |
| 122 (Node node, VariableStructure structure) { |
| 123 if (structure == null) { |
| 124 return internalError(node, 'No structure for $node'); |
| 125 } else { |
| 126 return structure.dispatch(declVisitor, node, arg); |
| 127 } |
| 128 }); |
| 129 return null; |
| 130 } |
| 131 } |
| 132 |
| 133 abstract class SemanticVisitor<R, A> extends Visitor<R> |
| 134 with SemanticSendResolvedMixin<R, A>, |
| 135 SendResolverMixin, |
| 136 SemanticDeclarationResolvedMixin<R, A>, |
| 137 DeclarationResolverMixin { |
| 138 TreeElements elements; |
| 139 |
| 140 SemanticVisitor(this.elements); |
| 141 } |
| 142 |
| 75 // TODO(johnniwinther): Add visits for [visitLocalConstantGet], | 143 // TODO(johnniwinther): Add visits for [visitLocalConstantGet], |
| 76 // [visitLocalConstantInvoke], [visitStaticConstantGet], etc. | 144 // [visitLocalConstantInvoke], [visitStaticConstantGet], etc. |
| 77 abstract class SemanticSendVisitor<R, A> { | 145 abstract class SemanticSendVisitor<R, A> { |
| 78 R apply(Node node, A arg); | 146 R apply(Node node, A arg); |
| 79 | 147 |
| 80 /// Read of the [parameter]. | 148 /// Read of the [parameter]. |
| 81 /// | 149 /// |
| 82 /// For instance: | 150 /// For instance: |
| 83 /// m(parameter) => parameter; | 151 /// m(parameter) => parameter; |
| 84 /// | 152 /// |
| (...skipping 2853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2938 /// m2() => new C.a(true, 42); | 3006 /// m2() => new C.a(true, 42); |
| 2939 /// | 3007 /// |
| 2940 R errorUnresolvedRedirectingFactoryConstructorInvoke( | 3008 R errorUnresolvedRedirectingFactoryConstructorInvoke( |
| 2941 NewExpression node, | 3009 NewExpression node, |
| 2942 ConstructorElement constructor, | 3010 ConstructorElement constructor, |
| 2943 InterfaceType type, | 3011 InterfaceType type, |
| 2944 NodeList arguments, | 3012 NodeList arguments, |
| 2945 Selector selector, | 3013 Selector selector, |
| 2946 A arg); | 3014 A arg); |
| 2947 } | 3015 } |
| 3016 |
| 3017 abstract class SemanticDeclarationVisitor<R, A> { |
| 3018 R apply(Node node, A arg); |
| 3019 |
| 3020 /// Apply this visitor to the [parameters]. |
| 3021 applyParameters(NodeList parameters, A arg); |
| 3022 |
| 3023 /// Apply this visitor to the constructor [initializers]. |
| 3024 applyInitializers(NodeList initializers, A arg); |
| 3025 |
| 3026 /// A declaration of a top level [getter]. |
| 3027 /// |
| 3028 /// For instance |
| 3029 /// get m => 42; |
| 3030 /// |
| 3031 R visitTopLevelGetterDeclaration( |
| 3032 FunctionExpression node, |
| 3033 MethodElement getter, |
| 3034 Node body, |
| 3035 A arg); |
| 3036 |
| 3037 /// A declaration of a top level [setter]. |
| 3038 /// |
| 3039 /// For instance |
| 3040 /// set m(a) {} |
| 3041 /// |
| 3042 R visitTopLevelSetterDeclaration( |
| 3043 FunctionExpression node, |
| 3044 MethodElement setter, |
| 3045 NodeList parameters, |
| 3046 Node body, |
| 3047 A arg); |
| 3048 |
| 3049 /// A declaration of a top level [function]. |
| 3050 /// |
| 3051 /// For instance |
| 3052 /// m(a) {} |
| 3053 /// |
| 3054 R visitTopLevelFunctionDeclaration( |
| 3055 FunctionExpression node, |
| 3056 MethodElement function, |
| 3057 NodeList parameters, |
| 3058 Node body, |
| 3059 A arg); |
| 3060 |
| 3061 /// A declaration of a static [getter]. |
| 3062 /// |
| 3063 /// For instance |
| 3064 /// class C { |
| 3065 /// static get m => 42; |
| 3066 /// } |
| 3067 /// |
| 3068 R visitStaticGetterDeclaration( |
| 3069 FunctionExpression node, |
| 3070 MethodElement getter, |
| 3071 Node body, |
| 3072 A arg); |
| 3073 |
| 3074 /// A declaration of a static [setter]. |
| 3075 /// |
| 3076 /// For instance |
| 3077 /// class C { |
| 3078 /// static set m(a) {} |
| 3079 /// } |
| 3080 /// |
| 3081 R visitStaticSetterDeclaration( |
| 3082 FunctionExpression node, |
| 3083 MethodElement setter, |
| 3084 NodeList parameters, |
| 3085 Node body, |
| 3086 A arg); |
| 3087 |
| 3088 /// A declaration of a static [function]. |
| 3089 /// |
| 3090 /// For instance |
| 3091 /// class C { |
| 3092 /// static m(a) {} |
| 3093 /// } |
| 3094 /// |
| 3095 R visitStaticFunctionDeclaration( |
| 3096 FunctionExpression node, |
| 3097 MethodElement function, |
| 3098 NodeList parameters, |
| 3099 Node body, |
| 3100 A arg); |
| 3101 |
| 3102 /// A declaration of an abstract instance [getter]. |
| 3103 /// |
| 3104 /// For instance |
| 3105 /// abstract class C { |
| 3106 /// get m; |
| 3107 /// } |
| 3108 /// |
| 3109 R visitAbstractGetterDeclaration( |
| 3110 FunctionExpression node, |
| 3111 MethodElement getter, |
| 3112 A arg); |
| 3113 |
| 3114 /// A declaration of an abstract instance [setter]. |
| 3115 /// |
| 3116 /// For instance |
| 3117 /// abstract class C { |
| 3118 /// set m(a); |
| 3119 /// } |
| 3120 /// |
| 3121 R visitAbstractSetterDeclaration( |
| 3122 FunctionExpression node, |
| 3123 MethodElement setter, |
| 3124 NodeList parameters, |
| 3125 A arg); |
| 3126 |
| 3127 /// A declaration of an abstract instance [method]. |
| 3128 /// |
| 3129 /// For instance |
| 3130 /// abstract class C { |
| 3131 /// m(a); |
| 3132 /// } |
| 3133 /// |
| 3134 R visitAbstractMethodDeclaration( |
| 3135 FunctionExpression node, |
| 3136 MethodElement method, |
| 3137 NodeList parameters, |
| 3138 A arg); |
| 3139 |
| 3140 /// A declaration of an instance [getter]. |
| 3141 /// |
| 3142 /// For instance |
| 3143 /// class C { |
| 3144 /// get m => 42; |
| 3145 /// } |
| 3146 /// |
| 3147 R visitInstanceGetterDeclaration( |
| 3148 FunctionExpression node, |
| 3149 MethodElement getter, |
| 3150 Node body, |
| 3151 A arg); |
| 3152 |
| 3153 /// A declaration of an instance [setter]. |
| 3154 /// |
| 3155 /// For instance |
| 3156 /// class C { |
| 3157 /// set m(a) {} |
| 3158 /// } |
| 3159 /// |
| 3160 R visitInstanceSetterDeclaration( |
| 3161 FunctionExpression node, |
| 3162 MethodElement setter, |
| 3163 NodeList parameters, |
| 3164 Node body, |
| 3165 A arg); |
| 3166 |
| 3167 /// A declaration of an instance [method]. |
| 3168 /// |
| 3169 /// For instance |
| 3170 /// class C { |
| 3171 /// m(a) {} |
| 3172 /// } |
| 3173 /// |
| 3174 R visitInstanceMethodDeclaration( |
| 3175 FunctionExpression node, |
| 3176 MethodElement method, |
| 3177 NodeList parameters, |
| 3178 Node body, |
| 3179 A arg); |
| 3180 |
| 3181 /// A declaration of a local [function]. |
| 3182 /// |
| 3183 /// For instance `local` in |
| 3184 /// m() { |
| 3185 /// local(a) {} |
| 3186 /// } |
| 3187 /// |
| 3188 R visitLocalFunctionDeclaration( |
| 3189 FunctionExpression node, |
| 3190 LocalFunctionElement function, |
| 3191 NodeList parameters, |
| 3192 Node body, |
| 3193 A arg); |
| 3194 |
| 3195 /// A declaration of a [closure]. |
| 3196 /// |
| 3197 /// For instance `(a) {}` in |
| 3198 /// m() { |
| 3199 /// var closure = (a) {}; |
| 3200 /// } |
| 3201 /// |
| 3202 R visitClosureDeclaration( |
| 3203 FunctionExpression node, |
| 3204 LocalFunctionElement closure, |
| 3205 NodeList parameters, |
| 3206 Node body, |
| 3207 A arg); |
| 3208 |
| 3209 /// A declaration of the [index]th [parameter] in a constructor, setter, |
| 3210 /// method or function. |
| 3211 /// |
| 3212 /// For instance `a` in |
| 3213 /// m(a) {} |
| 3214 /// |
| 3215 R visitParameterDeclaration( |
| 3216 VariableDefinitions node, |
| 3217 Node definition, |
| 3218 ParameterElement parameter, |
| 3219 int index, |
| 3220 A arg); |
| 3221 |
| 3222 /// A declaration of the [index]th optional [parameter] in a constructor, |
| 3223 /// method or function with the explicit [defaultValue]. If no default value |
| 3224 /// is declared, [defaultValue] is `null`. |
| 3225 /// |
| 3226 /// For instance `a` in |
| 3227 /// m([a = 42]) {} |
| 3228 /// |
| 3229 R visitOptionalParameterDeclaration( |
| 3230 VariableDefinitions node, |
| 3231 Node definition, |
| 3232 ParameterElement parameter, |
| 3233 ConstantExpression defaultValue, |
| 3234 int index, |
| 3235 A arg); |
| 3236 |
| 3237 /// A declaration of a named [parameter] in a constructor, method or function |
| 3238 /// with the explicit [defaultValue]. If no default value is declared, |
| 3239 /// [defaultValue] is `null`. |
| 3240 /// |
| 3241 /// For instance `a` in |
| 3242 /// m({a: 42}) {} |
| 3243 /// |
| 3244 R visitNamedParameterDeclaration( |
| 3245 VariableDefinitions node, |
| 3246 Node definition, |
| 3247 ParameterElement parameter, |
| 3248 ConstantExpression defaultValue, |
| 3249 A arg); |
| 3250 |
| 3251 /// A declaration of the [index]th [parameter] as an initializing formal in a |
| 3252 /// constructor. |
| 3253 /// |
| 3254 /// For instance `a` in |
| 3255 /// class C { |
| 3256 /// var a; |
| 3257 /// C(this.a); |
| 3258 /// } |
| 3259 /// |
| 3260 R visitInitializingFormalDeclaration( |
| 3261 VariableDefinitions node, |
| 3262 Node definition, |
| 3263 InitializingFormalElement parameter, |
| 3264 int index, |
| 3265 A arg); |
| 3266 |
| 3267 /// A declaration of the [index]th optional [parameter] as an initializing |
| 3268 /// formal in a constructor with the explicit [defaultValue]. If no default |
| 3269 /// value is declared, [defaultValue] is `null`. |
| 3270 /// |
| 3271 /// For instance `a` in |
| 3272 /// class C { |
| 3273 /// var a; |
| 3274 /// C([this.a = 42]); |
| 3275 /// } |
| 3276 /// |
| 3277 R visitOptionalInitializingFormalDeclaration( |
| 3278 VariableDefinitions node, |
| 3279 Node definition, |
| 3280 InitializingFormalElement parameter, |
| 3281 ConstantExpression defaultValue, |
| 3282 int index, |
| 3283 A arg); |
| 3284 |
| 3285 /// A declaration of a named [parameter] as an initializing formal in a |
| 3286 /// constructor with the explicit [defaultValue]. If no default value is |
| 3287 /// declared, [defaultValue] is `null`. |
| 3288 /// |
| 3289 /// For instance `a` in |
| 3290 /// class C { |
| 3291 /// var a; |
| 3292 /// C({this.a: 42}); |
| 3293 /// } |
| 3294 /// |
| 3295 R visitNamedInitializingFormalDeclaration( |
| 3296 VariableDefinitions node, |
| 3297 Node definition, |
| 3298 InitializingFormalElement parameter, |
| 3299 ConstantExpression defaultValue, |
| 3300 A arg); |
| 3301 |
| 3302 /// A declaration of a local [variable] with the explicit [initializer]. If |
| 3303 /// no initializer is declared, [initializer] is `null`. |
| 3304 /// |
| 3305 /// For instance `a` in |
| 3306 /// m() { |
| 3307 /// var a = 42; |
| 3308 /// } |
| 3309 /// |
| 3310 R visitLocalVariableDeclaration( |
| 3311 VariableDefinitions node, |
| 3312 Node definition, |
| 3313 LocalVariableElement variable, |
| 3314 Node initializer, |
| 3315 A arg); |
| 3316 |
| 3317 /// A declaration of a local constant [variable] initialized to [constant]. |
| 3318 /// |
| 3319 /// For instance `a` in |
| 3320 /// m() { |
| 3321 /// const a = 42; |
| 3322 /// } |
| 3323 /// |
| 3324 R visitLocalConstantDeclaration( |
| 3325 VariableDefinitions node, |
| 3326 Node definition, |
| 3327 LocalVariableElement variable, |
| 3328 ConstantExpression constant, |
| 3329 A arg); |
| 3330 |
| 3331 /// A declaration of a top level [field] with the explicit [initializer]. |
| 3332 /// If no initializer is declared, [initializer] is `null`. |
| 3333 /// |
| 3334 /// For instance `a` in |
| 3335 /// var a = 42; |
| 3336 /// |
| 3337 R visitTopLevelFieldDeclaration( |
| 3338 VariableDefinitions node, |
| 3339 Node definition, |
| 3340 FieldElement field, |
| 3341 Node initializer, |
| 3342 A arg); |
| 3343 |
| 3344 /// A declaration of a top level constant [field] initialized to [constant]. |
| 3345 /// |
| 3346 /// For instance `a` in |
| 3347 /// const a = 42; |
| 3348 /// |
| 3349 R visitTopLevelConstantDeclaration( |
| 3350 VariableDefinitions node, |
| 3351 Node definition, |
| 3352 FieldElement field, |
| 3353 ConstantExpression constant, |
| 3354 A arg); |
| 3355 |
| 3356 /// A declaration of a static [field] with the explicit [initializer]. |
| 3357 /// If no initializer is declared, [initializer] is `null`. |
| 3358 /// |
| 3359 /// For instance `a` in |
| 3360 /// class C { |
| 3361 /// static var a = 42; |
| 3362 /// } |
| 3363 /// |
| 3364 R visitStaticFieldDeclaration( |
| 3365 VariableDefinitions node, |
| 3366 Node definition, |
| 3367 FieldElement field, |
| 3368 Node initializer, |
| 3369 A arg); |
| 3370 |
| 3371 /// A declaration of a static constant [field] initialized to [constant]. |
| 3372 /// |
| 3373 /// For instance `a` in |
| 3374 /// class C { |
| 3375 /// static const a = 42; |
| 3376 /// } |
| 3377 /// |
| 3378 R visitStaticConstantDeclaration( |
| 3379 VariableDefinitions node, |
| 3380 Node definition, |
| 3381 FieldElement field, |
| 3382 ConstantExpression constant, |
| 3383 A arg); |
| 3384 |
| 3385 /// A declaration of an instance [field] with the explicit [initializer]. |
| 3386 /// If no initializer is declared, [initializer] is `null`. |
| 3387 /// |
| 3388 /// For instance `a` in |
| 3389 /// class C { |
| 3390 /// var a = 42; |
| 3391 /// } |
| 3392 /// |
| 3393 R visitInstanceFieldDeclaration( |
| 3394 VariableDefinitions node, |
| 3395 Node definition, |
| 3396 FieldElement field, |
| 3397 Node initializer, |
| 3398 A arg); |
| 3399 |
| 3400 /// A declaration of a generative [constructor] with the explicit constructor |
| 3401 /// [initializers]. |
| 3402 /// |
| 3403 /// For instance `C` in |
| 3404 /// class C { |
| 3405 /// var a; |
| 3406 /// C(a) : this.a = a, super(); |
| 3407 /// } |
| 3408 /// |
| 3409 R visitGenerativeConstructorDeclaration( |
| 3410 FunctionExpression node, |
| 3411 ConstructorElement constructor, |
| 3412 NodeList parameters, |
| 3413 NodeList initializers, |
| 3414 Node body, |
| 3415 A arg); |
| 3416 |
| 3417 /// A declaration of a redirecting generative [constructor] with |
| 3418 /// [initializers] containing the redirecting constructor invocation. |
| 3419 /// |
| 3420 /// For instance `C` in |
| 3421 /// class C { |
| 3422 /// C() : this._(); |
| 3423 /// C._(); |
| 3424 /// } |
| 3425 /// |
| 3426 R visitRedirectingGenerativeConstructorDeclaration( |
| 3427 FunctionExpression node, |
| 3428 ConstructorElement constructor, |
| 3429 NodeList parameters, |
| 3430 NodeList initializers, |
| 3431 A arg); |
| 3432 |
| 3433 /// A declaration of a factory [constructor]. |
| 3434 /// |
| 3435 /// For instance `C` in |
| 3436 /// class C { |
| 3437 /// factory C(a) => null; |
| 3438 /// } |
| 3439 /// |
| 3440 R visitFactoryConstructorDeclaration( |
| 3441 FunctionExpression node, |
| 3442 ConstructorElement constructor, |
| 3443 NodeList parameters, |
| 3444 Node body, |
| 3445 A arg); |
| 3446 |
| 3447 /// A declaration of a redirecting factory [constructor]. The immediate |
| 3448 /// redirection target and its type is provided in [redirectionTarget] and |
| 3449 /// [redirectionType], respectively. |
| 3450 /// |
| 3451 /// For instance |
| 3452 /// class C<T> { |
| 3453 /// factory C() = C<int>.a; |
| 3454 /// factory C.a() = C<C<T>>.b; |
| 3455 /// C.b(); |
| 3456 /// } |
| 3457 /// where `C` has the redirection target `C.a` of type `C<int>` and `C.a` has |
| 3458 /// the redirection target `C.b` of type `C<C<T>>`. |
| 3459 /// |
| 3460 R visitRedirectingFactoryConstructorDeclaration( |
| 3461 FunctionExpression node, |
| 3462 ConstructorElement constructor, |
| 3463 NodeList parameters, |
| 3464 InterfaceType redirectionType, |
| 3465 ConstructorElement redirectionTarget, |
| 3466 A arg); |
| 3467 |
| 3468 /// An initializer of [field] with [initializer] as found in constructor |
| 3469 /// initializers. |
| 3470 /// |
| 3471 /// For instance `this.a = 42` in |
| 3472 /// class C { |
| 3473 /// var a; |
| 3474 /// C() : this.a = 42; |
| 3475 /// } |
| 3476 /// |
| 3477 R visitFieldInitializer( |
| 3478 SendSet node, |
| 3479 FieldElement field, |
| 3480 Node initializer, |
| 3481 A arg); |
| 3482 |
| 3483 /// An initializer of an unresolved field with [initializer] as found in |
| 3484 /// generative constructor initializers. |
| 3485 /// |
| 3486 /// For instance `this.a = 42` in |
| 3487 /// class C { |
| 3488 /// C() : this.a = 42; |
| 3489 /// } |
| 3490 /// |
| 3491 R errorUnresolvedFieldInitializer( |
| 3492 SendSet node, |
| 3493 Element element, |
| 3494 Node initializer, |
| 3495 A arg); |
| 3496 |
| 3497 /// An super constructor invocation of [superConstructor] with [arguments] as |
| 3498 /// found in generative constructor initializers. |
| 3499 /// |
| 3500 /// For instance `super(42)` in |
| 3501 /// class B { |
| 3502 /// B(a); |
| 3503 /// } |
| 3504 /// class C extends B { |
| 3505 /// C() : super(42); |
| 3506 /// } |
| 3507 /// |
| 3508 R visitSuperConstructorInvoke( |
| 3509 Send node, |
| 3510 ConstructorElement superConstructor, |
| 3511 InterfaceType type, |
| 3512 NodeList arguments, |
| 3513 Selector selector, |
| 3514 A arg); |
| 3515 |
| 3516 /// An super constructor invocation of an unresolved with [arguments] as |
| 3517 /// found in generative constructor initializers. |
| 3518 /// |
| 3519 /// For instance `super(42)` in |
| 3520 /// class B { |
| 3521 /// B(a); |
| 3522 /// } |
| 3523 /// class C extends B { |
| 3524 /// C() : super.unresolved(42); |
| 3525 /// } |
| 3526 /// |
| 3527 R errorUnresolvedSuperConstructorInvoke( |
| 3528 Send node, |
| 3529 Element element, |
| 3530 NodeList arguments, |
| 3531 Selector selector, |
| 3532 A arg); |
| 3533 |
| 3534 /// An this constructor invocation of [thisConstructor] with [arguments] as |
| 3535 /// found in a redirecting generative constructors initializer. |
| 3536 /// |
| 3537 /// For instance `this._(42)` in |
| 3538 /// class C { |
| 3539 /// C() : this._(42); |
| 3540 /// C._(a); |
| 3541 /// } |
| 3542 /// |
| 3543 R visitThisConstructorInvoke( |
| 3544 Send node, |
| 3545 ConstructorElement thisConstructor, |
| 3546 NodeList arguments, |
| 3547 Selector selector, |
| 3548 A arg); |
| 3549 |
| 3550 /// An this constructor invocation of an unresolved constructor with |
| 3551 /// [arguments] as found in a redirecting generative constructors initializer. |
| 3552 /// |
| 3553 /// For instance `this._(42)` in |
| 3554 /// class C { |
| 3555 /// C() : this._(42); |
| 3556 /// } |
| 3557 /// |
| 3558 R errorUnresolvedThisConstructorInvoke( |
| 3559 Send node, |
| 3560 Element element, |
| 3561 NodeList arguments, |
| 3562 Selector selector, |
| 3563 A arg); |
| 3564 } |
| OLD | NEW |