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

Side by Side Diff: pkg/compiler/lib/src/tree/nodes.dart

Issue 1942763002: Rebased and retested version of CL 1915123008. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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) 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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 1069
1070 /// Is `true` if this modifier is either `async` or `async*`. 1070 /// Is `true` if this modifier is either `async` or `async*`.
1071 bool get isAsynchronous => asyncToken.value == 'async'; 1071 bool get isAsynchronous => asyncToken.value == 'async';
1072 1072
1073 /// Is `true` if this modifier is either `sync*` or `async*`. 1073 /// Is `true` if this modifier is either `sync*` or `async*`.
1074 bool get isYielding => starToken != null; 1074 bool get isYielding => starToken != null;
1075 } 1075 }
1076 1076
1077 class FunctionExpression extends Expression with StoredTreeElementMixin { 1077 class FunctionExpression extends Expression with StoredTreeElementMixin {
1078 final Node name; 1078 final Node name;
1079 final NodeList typeVariables;
1079 1080
1080 /** 1081 /**
1081 * List of VariableDefinitions or NodeList. 1082 * List of VariableDefinitions or NodeList.
1082 * 1083 *
1083 * A NodeList can only occur at the end and holds named parameters. 1084 * A NodeList can only occur at the end and holds named parameters.
1084 */ 1085 */
1085 final NodeList parameters; 1086 final NodeList parameters;
1086 1087
1087 final Statement body; 1088 final Statement body;
1088 final TypeAnnotation returnType; 1089 final TypeAnnotation returnType;
1089 final Modifiers modifiers; 1090 final Modifiers modifiers;
1090 final NodeList initializers; 1091 final NodeList initializers;
1091 1092
1092 final Token getOrSet; 1093 final Token getOrSet;
1093 final AsyncModifier asyncModifier; 1094 final AsyncModifier asyncModifier;
1094 1095
1095 FunctionExpression(this.name, this.parameters, this.body, this.returnType, 1096 FunctionExpression(
1096 this.modifiers, this.initializers, this.getOrSet, this.asyncModifier) { 1097 this.name,
1098 this.typeVariables,
1099 this.parameters,
1100 this.body,
1101 this.returnType,
1102 this.modifiers,
1103 this.initializers,
1104 this.getOrSet,
1105 this.asyncModifier) {
1097 assert(modifiers != null); 1106 assert(modifiers != null);
1098 } 1107 }
1099 1108
1100 FunctionExpression asFunctionExpression() => this; 1109 FunctionExpression asFunctionExpression() => this;
1101 1110
1102 accept(Visitor visitor) => visitor.visitFunctionExpression(this); 1111 accept(Visitor visitor) => visitor.visitFunctionExpression(this);
1103 1112
1104 accept1(Visitor1 visitor, arg) => visitor.visitFunctionExpression(this, arg); 1113 accept1(Visitor1 visitor, arg) => visitor.visitFunctionExpression(this, arg);
1105 1114
1106 bool get isRedirectingFactory { 1115 bool get isRedirectingFactory {
1107 return body != null && body.asRedirectingFactoryBody() != null; 1116 return body != null && body.asRedirectingFactoryBody() != null;
1108 } 1117 }
1109 1118
1110 visitChildren(Visitor visitor) { 1119 visitChildren(Visitor visitor) {
1111 if (modifiers != null) modifiers.accept(visitor); 1120 if (modifiers != null) modifiers.accept(visitor);
1112 if (returnType != null) returnType.accept(visitor); 1121 if (returnType != null) returnType.accept(visitor);
1113 if (name != null) name.accept(visitor); 1122 if (name != null) name.accept(visitor);
1123 if (typeVariables != null) typeVariables.accept(visitor);
1114 if (parameters != null) parameters.accept(visitor); 1124 if (parameters != null) parameters.accept(visitor);
1115 if (initializers != null) initializers.accept(visitor); 1125 if (initializers != null) initializers.accept(visitor);
1116 if (asyncModifier != null) asyncModifier.accept(visitor); 1126 if (asyncModifier != null) asyncModifier.accept(visitor);
1117 if (body != null) body.accept(visitor); 1127 if (body != null) body.accept(visitor);
1118 } 1128 }
1119 1129
1120 visitChildren1(Visitor1 visitor, arg) { 1130 visitChildren1(Visitor1 visitor, arg) {
1121 if (modifiers != null) modifiers.accept1(visitor, arg); 1131 if (modifiers != null) modifiers.accept1(visitor, arg);
1122 if (returnType != null) returnType.accept1(visitor, arg); 1132 if (returnType != null) returnType.accept1(visitor, arg);
1123 if (name != null) name.accept1(visitor, arg); 1133 if (name != null) name.accept1(visitor, arg);
1134 if (typeVariables != null) typeVariables.accept1(visitor, arg);
1124 if (parameters != null) parameters.accept1(visitor, arg); 1135 if (parameters != null) parameters.accept1(visitor, arg);
1125 if (initializers != null) initializers.accept1(visitor, arg); 1136 if (initializers != null) initializers.accept1(visitor, arg);
1126 if (asyncModifier != null) asyncModifier.accept1(visitor, arg); 1137 if (asyncModifier != null) asyncModifier.accept1(visitor, arg);
1127 if (body != null) body.accept1(visitor, arg); 1138 if (body != null) body.accept1(visitor, arg);
1128 } 1139 }
1129 1140
1130 bool get hasBody => body.asEmptyStatement() == null; 1141 bool get hasBody => body.asEmptyStatement() == null;
1131 1142
1132 bool get hasEmptyBody { 1143 bool get hasEmptyBody {
1133 Block block = body.asBlock(); 1144 Block block = body.asBlock();
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 accept1(Visitor1 visitor, arg) {} 3106 accept1(Visitor1 visitor, arg) {}
3096 3107
3097 visitChildren(Visitor visitor) {} 3108 visitChildren(Visitor visitor) {}
3098 3109
3099 visitChildren1(Visitor1 visitor, arg) {} 3110 visitChildren1(Visitor1 visitor, arg) {}
3100 3111
3101 bool get isErroneous => true; 3112 bool get isErroneous => true;
3102 3113
3103 // FunctionExpression. 3114 // FunctionExpression.
3104 get asyncModifier => null; 3115 get asyncModifier => null;
3116 get typeVariables => null;
3105 get parameters => null; 3117 get parameters => null;
3106 get body => null; 3118 get body => null;
3107 get returnType => null; 3119 get returnType => null;
3108 get modifiers => Modifiers.EMPTY; 3120 get modifiers => Modifiers.EMPTY;
3109 get initializers => null; 3121 get initializers => null;
3110 get getOrSet => null; 3122 get getOrSet => null;
3111 get isRedirectingFactory => false; 3123 get isRedirectingFactory => false;
3112 bool get hasBody => false; 3124 bool get hasBody => false;
3113 bool get hasEmptyBody => false; 3125 bool get hasEmptyBody => false;
3114 3126
3115 // VariableDefinitions. 3127 // VariableDefinitions.
3116 get metadata => null; 3128 get metadata => null;
3117 get type => null; 3129 get type => null;
3118 3130
3119 // Typedef. 3131 // Typedef.
3120 get typeParameters => null; 3132 get typeParameters => null;
3121 get formals => null; 3133 get formals => null;
3122 get typedefKeyword => null; 3134 get typedefKeyword => null;
3123 } 3135 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698