OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:collection' show IterableMixin; | 5 import 'dart:collection' show IterableMixin; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../elements/elements.dart' show MetadataAnnotation; | 8 import '../elements/elements.dart' show MetadataAnnotation; |
9 import '../resolution/secret_tree_element.dart' | 9 import '../resolution/secret_tree_element.dart' |
10 show NullTreeElementMixin, StoredTreeElementMixin; | 10 show NullTreeElementMixin, StoredTreeElementMixin; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 | 504 |
505 visitChildren1(Visitor1 visitor, arg) { | 505 visitChildren1(Visitor1 visitor, arg) { |
506 if (superclass != null) superclass.accept1(visitor, arg); | 506 if (superclass != null) superclass.accept1(visitor, arg); |
507 if (mixins != null) mixins.accept1(visitor, arg); | 507 if (mixins != null) mixins.accept1(visitor, arg); |
508 } | 508 } |
509 | 509 |
510 Token getBeginToken() => superclass.getBeginToken(); | 510 Token getBeginToken() => superclass.getBeginToken(); |
511 Token getEndToken() => mixins.getEndToken(); | 511 Token getEndToken() => mixins.getEndToken(); |
512 } | 512 } |
513 | 513 |
514 // TODO(kasperl): Let this share some structure with the typedef for function | |
515 // type aliases? | |
516 class NamedMixinApplication extends Node implements MixinApplication { | 514 class NamedMixinApplication extends Node implements MixinApplication { |
517 final Identifier name; | 515 final Identifier name; |
518 final NodeList typeParameters; | 516 final NodeList typeParameters; |
519 | 517 |
520 final Modifiers modifiers; | 518 final Modifiers modifiers; |
521 final MixinApplication mixinApplication; | 519 final MixinApplication mixinApplication; |
522 final NodeList interfaces; | 520 final NodeList interfaces; |
523 | 521 |
524 final Token classKeyword; | 522 final Token classKeyword; |
525 final Token endToken; | 523 final Token endToken; |
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2847 visitChildren(Visitor visitor) => identifiers.accept(visitor); | 2845 visitChildren(Visitor visitor) => identifiers.accept(visitor); |
2848 | 2846 |
2849 visitChildren1(Visitor1 visitor, arg) => identifiers.accept1(visitor, arg); | 2847 visitChildren1(Visitor1 visitor, arg) => identifiers.accept1(visitor, arg); |
2850 | 2848 |
2851 Token getBeginToken() => keywordToken; | 2849 Token getBeginToken() => keywordToken; |
2852 | 2850 |
2853 Token getEndToken() => identifiers.getEndToken(); | 2851 Token getEndToken() => identifiers.getEndToken(); |
2854 } | 2852 } |
2855 | 2853 |
2856 class Typedef extends Node { | 2854 class Typedef extends Node { |
2855 final bool isNewSyntax; | |
Siggi Cherem (dart-lang)
2016/12/12 23:20:40
I'd avoid terms like `new` and `old`, since in a f
| |
2856 | |
2857 final TypeAnnotation returnType; | 2857 final TypeAnnotation returnType; |
2858 final Identifier name; | 2858 final Identifier name; |
2859 final NodeList typeParameters; | 2859 final NodeList typeParameters; |
2860 final NodeList formals; | 2860 final NodeList formals; |
2861 | 2861 |
2862 final Token typedefKeyword; | 2862 final Token typedefKeyword; |
2863 final Token endToken; | 2863 final Token endToken; |
2864 | 2864 |
2865 Typedef(this.returnType, this.name, this.typeParameters, this.formals, | 2865 Typedef(this.isNewSyntax, this.returnType, this.name, this.typeParameters, |
2866 this.typedefKeyword, this.endToken); | 2866 this.formals, this.typedefKeyword, this.endToken); |
2867 | 2867 |
2868 Typedef asTypedef() => this; | 2868 Typedef asTypedef() => this; |
2869 | 2869 |
2870 accept(Visitor visitor) => visitor.visitTypedef(this); | 2870 accept(Visitor visitor) => visitor.visitTypedef(this); |
2871 | 2871 |
2872 accept1(Visitor1 visitor, arg) => visitor.visitTypedef(this, arg); | 2872 accept1(Visitor1 visitor, arg) => visitor.visitTypedef(this, arg); |
2873 | 2873 |
2874 visitChildren(Visitor visitor) { | 2874 visitChildren(Visitor visitor) { |
2875 if (returnType != null) returnType.accept(visitor); | 2875 if (returnType != null) returnType.accept(visitor); |
2876 name.accept(visitor); | 2876 name.accept(visitor); |
2877 if (typeParameters != null) typeParameters.accept(visitor); | 2877 if (typeParameters != null) typeParameters.accept(visitor); |
2878 formals.accept(visitor); | 2878 formals.accept(visitor); |
2879 } | 2879 } |
2880 | 2880 |
2881 visitChildren1(Visitor1 visitor, arg) { | 2881 visitChildren1(Visitor1 visitor, arg) { |
2882 if (returnType != null) returnType.accept1(visitor, arg); | 2882 if (returnType != null) returnType.accept1(visitor, arg); |
2883 name.accept1(visitor, arg); | 2883 name.accept1(visitor, arg); |
2884 if (typeParameters != null) typeParameters.accept1(visitor, arg); | 2884 if (typeParameters != null) typeParameters.accept1(visitor, arg); |
2885 formals.accept1(visitor, arg); | 2885 formals.accept1(visitor, arg); |
2886 } | 2886 } |
2887 | 2887 |
2888 Token getBeginToken() => typedefKeyword; | 2888 Token getBeginToken() => typedefKeyword; |
2889 | 2889 |
2890 Token getEndToken() => endToken; | 2890 Token getEndToken() => endToken; |
2891 } | 2891 } |
2892 | 2892 |
2893 // TODO(floitsch): find a better name. "FunctionType" is already taken by | |
Siggi Cherem (dart-lang)
2016/12/12 23:20:40
how about FunctionTypeDeclaration ?
| |
2894 // dart_types.dart. (We could use prefixes, but feels annoying.) | |
2895 class NewFunctionType extends Node { | |
2896 final TypeAnnotation returnType; | |
2897 final NodeList typeParameters; | |
2898 final NodeList formals; | |
2899 | |
2900 NewFunctionType(this.returnType, this.typeParameters, this.formals); | |
2901 | |
2902 NewFunctionType asFunctionType() => this; | |
2903 | |
2904 accept(Visitor visitor) { | |
2905 throw new UnsupportedError("FunctionTypeVisit"); | |
2906 } | |
2907 | |
2908 accept1(Visitor1 visitor, arg) { | |
2909 throw new UnsupportedError("FunctionTypeVisit"); | |
2910 } | |
2911 | |
2912 visitChildren(Visitor visitor) { | |
2913 if (returnType != null) returnType.accept(visitor); | |
2914 if (typeParameters != null) typeParameters.accept(visitor); | |
2915 formals.accept(visitor); | |
2916 } | |
2917 | |
2918 visitChildren1(Visitor1 visitor, arg) { | |
2919 if (returnType != null) returnType.accept1(visitor, arg); | |
2920 if (typeParameters != null) typeParameters.accept1(visitor, arg); | |
2921 formals.accept1(visitor, arg); | |
2922 } | |
2923 | |
2924 Token getBeginToken() => returnType.getBeginToken(); | |
2925 | |
2926 Token getEndToken() => formals.getEndToken(); | |
2927 } | |
2928 | |
2893 class TryStatement extends Statement { | 2929 class TryStatement extends Statement { |
2894 final Block tryBlock; | 2930 final Block tryBlock; |
2895 final NodeList catchBlocks; | 2931 final NodeList catchBlocks; |
2896 final Block finallyBlock; | 2932 final Block finallyBlock; |
2897 | 2933 |
2898 final Token tryKeyword; | 2934 final Token tryKeyword; |
2899 final Token finallyKeyword; | 2935 final Token finallyKeyword; |
2900 | 2936 |
2901 TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock, | 2937 TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock, |
2902 this.tryKeyword, this.finallyKeyword); | 2938 this.tryKeyword, this.finallyKeyword); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3127 get getOrSet => null; | 3163 get getOrSet => null; |
3128 get isRedirectingFactory => false; | 3164 get isRedirectingFactory => false; |
3129 bool get hasBody => false; | 3165 bool get hasBody => false; |
3130 bool get hasEmptyBody => false; | 3166 bool get hasEmptyBody => false; |
3131 | 3167 |
3132 // VariableDefinitions. | 3168 // VariableDefinitions. |
3133 get metadata => null; | 3169 get metadata => null; |
3134 get type => null; | 3170 get type => null; |
3135 | 3171 |
3136 // Typedef. | 3172 // Typedef. |
3173 get isNewSyntax => null; | |
3137 get typeParameters => null; | 3174 get typeParameters => null; |
3138 get formals => null; | 3175 get formals => null; |
3139 get typedefKeyword => null; | 3176 get typedefKeyword => null; |
3140 } | 3177 } |
OLD | NEW |