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, MessageKind; |
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'; |
(...skipping 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3021 /// Invocation of an unresolved [constructor] on [type] with [arguments]. | 3021 /// Invocation of an unresolved [constructor] on [type] with [arguments]. |
3022 /// | 3022 /// |
3023 /// For instance | 3023 /// For instance |
3024 /// class C<T> { | 3024 /// class C<T> { |
3025 /// C(); | 3025 /// C(); |
3026 /// } | 3026 /// } |
3027 /// m() => new C<int>.unresolved(true, 42); | 3027 /// m() => new C<int>.unresolved(true, 42); |
3028 /// | 3028 /// |
3029 /// where [type] is `C<int>`. | 3029 /// where [type] is `C<int>`. |
3030 /// | 3030 /// |
3031 // TODO(johnniwinther): Update [type] to be [InterfaceType] when this is no | 3031 // TODO(johnniwinther): Change [type] to [InterfaceType] when is it not |
3032 // longer a catch-all clause for the erroneous constructor invocations. | 3032 // `dynamic`. |
3033 R errorUnresolvedConstructorInvoke( | 3033 R visitUnresolvedConstructorInvoke( |
3034 NewExpression node, | 3034 NewExpression node, |
3035 Element constructor, | 3035 Element constructor, |
3036 DartType type, | 3036 DartType type, |
3037 NodeList arguments, | 3037 NodeList arguments, |
3038 Selector selector, | 3038 Selector selector, |
3039 A arg); | 3039 A arg); |
3040 | 3040 |
3041 /// Invocation of a constructor on an unresolved [type] with [arguments]. | 3041 /// Invocation of a constructor on an unresolved [type] with [arguments]. |
3042 /// | 3042 /// |
3043 /// For instance | 3043 /// For instance |
3044 /// m() => new Unresolved(true, 42); | 3044 /// m() => new Unresolved(true, 42); |
3045 /// | 3045 /// |
3046 /// where [type] is the malformed type `Unresolved`. | 3046 /// where [type] is the malformed type `Unresolved`. |
3047 /// | 3047 /// |
3048 R errorUnresolvedClassConstructorInvoke( | 3048 // TODO(johnniwinther): Change [type] to [MalformedType] when is it not |
| 3049 // `dynamic`. |
| 3050 R visitUnresolvedClassConstructorInvoke( |
3049 NewExpression node, | 3051 NewExpression node, |
3050 Element element, | 3052 Element element, |
3051 MalformedType type, | 3053 MalformedType type, |
3052 NodeList arguments, | 3054 NodeList arguments, |
3053 Selector selector, | 3055 Selector selector, |
3054 A arg); | 3056 A arg); |
3055 | 3057 |
| 3058 /// Constant invocation of a non-constant constructor. |
| 3059 /// |
| 3060 /// For instance |
| 3061 /// class C { |
| 3062 /// C(a, b); |
| 3063 /// } |
| 3064 /// m() => const C(true, 42); |
| 3065 /// |
| 3066 R errorNonConstantConstructorInvoke( |
| 3067 NewExpression node, |
| 3068 Element element, |
| 3069 InterfaceType type, |
| 3070 NodeList arguments, |
| 3071 CallStructure callStructure, |
| 3072 A arg); |
| 3073 |
3056 /// Invocation of a constructor on an abstract [type] with [arguments]. | 3074 /// Invocation of a constructor on an abstract [type] with [arguments]. |
3057 /// | 3075 /// |
3058 /// For instance | 3076 /// For instance |
3059 /// m() => new Unresolved(true, 42); | 3077 /// m() => new Unresolved(true, 42); |
3060 /// | 3078 /// |
3061 /// where [type] is the malformed type `Unresolved`. | 3079 /// where [type] is the malformed type `Unresolved`. |
3062 /// | 3080 /// |
3063 R errorAbstractClassConstructorInvoke( | 3081 R visitAbstractClassConstructorInvoke( |
3064 NewExpression node, | 3082 NewExpression node, |
3065 ConstructorElement element, | 3083 ConstructorElement element, |
3066 InterfaceType type, | 3084 InterfaceType type, |
3067 NodeList arguments, | 3085 NodeList arguments, |
3068 CallStructure callStructure, | 3086 CallStructure callStructure, |
3069 A arg); | 3087 A arg); |
3070 | 3088 |
3071 /// Invocation of a factory [constructor] on [type] with [arguments] where | 3089 /// Invocation of a factory [constructor] on [type] with [arguments] where |
3072 /// [effectiveTarget] and [effectiveTargetType] are the constructor effective | 3090 /// [effectiveTarget] and [effectiveTargetType] are the constructor effective |
3073 /// invoked and its type, respectively. | 3091 /// invoked and its type, respectively. |
3074 /// | 3092 /// |
3075 /// For instance | 3093 /// For instance |
3076 /// class C { | 3094 /// class C { |
3077 /// factory C(a, b) = Unresolved; | 3095 /// factory C(a, b) = Unresolved; |
3078 /// factory C.a(a, b) = C.unresolved; | 3096 /// factory C.a(a, b) = C.unresolved; |
3079 /// } | 3097 /// } |
3080 /// m1() => new C(true, 42); | 3098 /// m1() => new C(true, 42); |
3081 /// m2() => new C.a(true, 42); | 3099 /// m2() => new C.a(true, 42); |
3082 /// | 3100 /// |
3083 R errorUnresolvedRedirectingFactoryConstructorInvoke( | 3101 R visitUnresolvedRedirectingFactoryConstructorInvoke( |
3084 NewExpression node, | 3102 NewExpression node, |
3085 ConstructorElement constructor, | 3103 ConstructorElement constructor, |
3086 InterfaceType type, | 3104 InterfaceType type, |
3087 NodeList arguments, | 3105 NodeList arguments, |
3088 Selector selector, | 3106 CallStructure callStructure, |
3089 A arg); | 3107 A arg); |
3090 } | 3108 } |
3091 | 3109 |
3092 abstract class SemanticDeclarationVisitor<R, A> { | 3110 abstract class SemanticDeclarationVisitor<R, A> { |
3093 R apply(Node node, A arg); | 3111 R apply(Node node, A arg); |
3094 | 3112 |
3095 /// Apply this visitor to the [parameters]. | 3113 /// Apply this visitor to the [parameters]. |
3096 applyParameters(NodeList parameters, A arg); | 3114 applyParameters(NodeList parameters, A arg); |
3097 | 3115 |
3098 /// Apply this visitor to the constructor [initializers]. | 3116 /// Apply this visitor to the constructor [initializers]. |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3630 /// C() : this._(42); | 3648 /// C() : this._(42); |
3631 /// } | 3649 /// } |
3632 /// | 3650 /// |
3633 R errorUnresolvedThisConstructorInvoke( | 3651 R errorUnresolvedThisConstructorInvoke( |
3634 Send node, | 3652 Send node, |
3635 Element element, | 3653 Element element, |
3636 NodeList arguments, | 3654 NodeList arguments, |
3637 Selector selector, | 3655 Selector selector, |
3638 A arg); | 3656 A arg); |
3639 } | 3657 } |
OLD | NEW |