OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.ast; | 8 library engine.ast; |
9 | 9 |
10 import 'dart:collection'; | 10 import 'dart:collection'; |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1238 new FieldDeclaration(cloneNode(node.documentationComment), | 1238 new FieldDeclaration(cloneNode(node.documentationComment), |
1239 cloneNodeList(node.metadata), cloneToken(node.staticKeyword), | 1239 cloneNodeList(node.metadata), cloneToken(node.staticKeyword), |
1240 cloneNode(node.fields), cloneToken(node.semicolon)); | 1240 cloneNode(node.fields), cloneToken(node.semicolon)); |
1241 | 1241 |
1242 @override | 1242 @override |
1243 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => | 1243 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => |
1244 new FieldFormalParameter(cloneNode(node.documentationComment), | 1244 new FieldFormalParameter(cloneNode(node.documentationComment), |
1245 cloneNodeList(node.metadata), cloneToken(node.keyword), | 1245 cloneNodeList(node.metadata), cloneToken(node.keyword), |
1246 cloneNode(node.type), cloneToken(node.thisKeyword), | 1246 cloneNode(node.type), cloneToken(node.thisKeyword), |
1247 cloneToken(node.period), cloneNode(node.identifier), | 1247 cloneToken(node.period), cloneNode(node.identifier), |
1248 cloneNode(node.parameters)); | 1248 cloneNode(node.typeParameters), cloneNode(node.parameters)); |
1249 | 1249 |
1250 @override | 1250 @override |
1251 ForEachStatement visitForEachStatement(ForEachStatement node) { | 1251 ForEachStatement visitForEachStatement(ForEachStatement node) { |
1252 DeclaredIdentifier loopVariable = node.loopVariable; | 1252 DeclaredIdentifier loopVariable = node.loopVariable; |
1253 if (loopVariable == null) { | 1253 if (loopVariable == null) { |
1254 return new ForEachStatement.withReference(cloneToken(node.awaitKeyword), | 1254 return new ForEachStatement.withReference(cloneToken(node.awaitKeyword), |
1255 cloneToken(node.forKeyword), cloneToken(node.leftParenthesis), | 1255 cloneToken(node.forKeyword), cloneToken(node.leftParenthesis), |
1256 cloneNode(node.identifier), cloneToken(node.inKeyword), | 1256 cloneNode(node.identifier), cloneToken(node.inKeyword), |
1257 cloneNode(node.iterable), cloneToken(node.rightParenthesis), | 1257 cloneNode(node.iterable), cloneToken(node.rightParenthesis), |
1258 cloneNode(node.body)); | 1258 cloneNode(node.body)); |
(...skipping 26 matching lines...) Expand all Loading... | |
1285 cloneNode(node.returnType), cloneToken(node.propertyKeyword), | 1285 cloneNode(node.returnType), cloneToken(node.propertyKeyword), |
1286 cloneNode(node.name), cloneNode(node.functionExpression)); | 1286 cloneNode(node.name), cloneNode(node.functionExpression)); |
1287 | 1287 |
1288 @override | 1288 @override |
1289 FunctionDeclarationStatement visitFunctionDeclarationStatement( | 1289 FunctionDeclarationStatement visitFunctionDeclarationStatement( |
1290 FunctionDeclarationStatement node) => | 1290 FunctionDeclarationStatement node) => |
1291 new FunctionDeclarationStatement(cloneNode(node.functionDeclaration)); | 1291 new FunctionDeclarationStatement(cloneNode(node.functionDeclaration)); |
1292 | 1292 |
1293 @override | 1293 @override |
1294 FunctionExpression visitFunctionExpression(FunctionExpression node) => | 1294 FunctionExpression visitFunctionExpression(FunctionExpression node) => |
1295 new FunctionExpression(cloneNode(node.parameters), cloneNode(node.body)); | 1295 new FunctionExpression(cloneNode(node.typeParameters), |
1296 cloneNode(node.parameters), cloneNode(node.body)); | |
1296 | 1297 |
1297 @override | 1298 @override |
1298 FunctionExpressionInvocation visitFunctionExpressionInvocation( | 1299 FunctionExpressionInvocation visitFunctionExpressionInvocation( |
1299 FunctionExpressionInvocation node) => new FunctionExpressionInvocation( | 1300 FunctionExpressionInvocation node) => new FunctionExpressionInvocation( |
1300 cloneNode(node.function), cloneNode(node.argumentList)); | 1301 cloneNode(node.function), cloneNode(node.typeArguments), |
1302 cloneNode(node.argumentList)); | |
1301 | 1303 |
1302 @override | 1304 @override |
1303 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => | 1305 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => |
1304 new FunctionTypeAlias(cloneNode(node.documentationComment), | 1306 new FunctionTypeAlias(cloneNode(node.documentationComment), |
1305 cloneNodeList(node.metadata), cloneToken(node.typedefKeyword), | 1307 cloneNodeList(node.metadata), cloneToken(node.typedefKeyword), |
1306 cloneNode(node.returnType), cloneNode(node.name), | 1308 cloneNode(node.returnType), cloneNode(node.name), |
1307 cloneNode(node.typeParameters), cloneNode(node.parameters), | 1309 cloneNode(node.typeParameters), cloneNode(node.parameters), |
1308 cloneToken(node.semicolon)); | 1310 cloneToken(node.semicolon)); |
1309 | 1311 |
1310 @override | 1312 @override |
1311 FunctionTypedFormalParameter visitFunctionTypedFormalParameter( | 1313 FunctionTypedFormalParameter visitFunctionTypedFormalParameter( |
1312 FunctionTypedFormalParameter node) => new FunctionTypedFormalParameter( | 1314 FunctionTypedFormalParameter node) => new FunctionTypedFormalParameter( |
1313 cloneNode(node.documentationComment), cloneNodeList(node.metadata), | 1315 cloneNode(node.documentationComment), cloneNodeList(node.metadata), |
1314 cloneNode(node.returnType), cloneNode(node.identifier), | 1316 cloneNode(node.returnType), cloneNode(node.identifier), |
1315 cloneNode(node.parameters)); | 1317 cloneNode(node.typeParameters), cloneNode(node.parameters)); |
1316 | 1318 |
1317 @override | 1319 @override |
1318 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator( | 1320 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator( |
1319 cloneToken(node.keyword), cloneNodeList(node.hiddenNames)); | 1321 cloneToken(node.keyword), cloneNodeList(node.hiddenNames)); |
1320 | 1322 |
1321 @override | 1323 @override |
1322 IfStatement visitIfStatement(IfStatement node) => new IfStatement( | 1324 IfStatement visitIfStatement(IfStatement node) => new IfStatement( |
1323 cloneToken(node.ifKeyword), cloneToken(node.leftParenthesis), | 1325 cloneToken(node.ifKeyword), cloneToken(node.leftParenthesis), |
1324 cloneNode(node.condition), cloneToken(node.rightParenthesis), | 1326 cloneNode(node.condition), cloneToken(node.rightParenthesis), |
1325 cloneNode(node.thenStatement), cloneToken(node.elseKeyword), | 1327 cloneNode(node.thenStatement), cloneToken(node.elseKeyword), |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1417 MapLiteralEntry visitMapLiteralEntry( | 1419 MapLiteralEntry visitMapLiteralEntry( |
1418 MapLiteralEntry node) => new MapLiteralEntry( | 1420 MapLiteralEntry node) => new MapLiteralEntry( |
1419 cloneNode(node.key), cloneToken(node.separator), cloneNode(node.value)); | 1421 cloneNode(node.key), cloneToken(node.separator), cloneNode(node.value)); |
1420 | 1422 |
1421 @override | 1423 @override |
1422 MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => | 1424 MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => |
1423 new MethodDeclaration(cloneNode(node.documentationComment), | 1425 new MethodDeclaration(cloneNode(node.documentationComment), |
1424 cloneNodeList(node.metadata), cloneToken(node.externalKeyword), | 1426 cloneNodeList(node.metadata), cloneToken(node.externalKeyword), |
1425 cloneToken(node.modifierKeyword), cloneNode(node.returnType), | 1427 cloneToken(node.modifierKeyword), cloneNode(node.returnType), |
1426 cloneToken(node.propertyKeyword), cloneToken(node.operatorKeyword), | 1428 cloneToken(node.propertyKeyword), cloneToken(node.operatorKeyword), |
1427 cloneNode(node.name), cloneNode(node.parameters), | 1429 cloneNode(node.name), cloneNode(node.typeParameters), |
1428 cloneNode(node.body)); | 1430 cloneNode(node.parameters), cloneNode(node.body)); |
1429 | 1431 |
1430 @override | 1432 @override |
1431 MethodInvocation visitMethodInvocation(MethodInvocation node) => | 1433 MethodInvocation visitMethodInvocation(MethodInvocation node) => |
1432 new MethodInvocation(cloneNode(node.target), cloneToken(node.operator), | 1434 new MethodInvocation(cloneNode(node.target), cloneToken(node.operator), |
1433 cloneNode(node.methodName), cloneNode(node.argumentList)); | 1435 cloneNode(node.methodName), cloneNode(node.typeArguments), |
1436 cloneNode(node.argumentList)); | |
1434 | 1437 |
1435 @override | 1438 @override |
1436 NamedExpression visitNamedExpression(NamedExpression node) => | 1439 NamedExpression visitNamedExpression(NamedExpression node) => |
1437 new NamedExpression(cloneNode(node.name), cloneNode(node.expression)); | 1440 new NamedExpression(cloneNode(node.name), cloneNode(node.expression)); |
1438 | 1441 |
1439 @override | 1442 @override |
1440 AstNode visitNativeClause(NativeClause node) => | 1443 AstNode visitNativeClause(NativeClause node) => |
1441 new NativeClause(cloneToken(node.nativeKeyword), cloneNode(node.name)); | 1444 new NativeClause(cloneToken(node.nativeKeyword), cloneNode(node.name)); |
1442 | 1445 |
1443 @override | 1446 @override |
(...skipping 5678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7122 super.visitChildren(visitor); | 7125 super.visitChildren(visitor); |
7123 _safelyVisitChild(_fieldList, visitor); | 7126 _safelyVisitChild(_fieldList, visitor); |
7124 } | 7127 } |
7125 } | 7128 } |
7126 | 7129 |
7127 /** | 7130 /** |
7128 * A field formal parameter. | 7131 * A field formal parameter. |
7129 * | 7132 * |
7130 * > fieldFormalParameter ::= | 7133 * > fieldFormalParameter ::= |
7131 * > ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])? | 7134 * > ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])? |
7132 * > 'this' '.' [SimpleIdentifier] [FormalParameterList]? | 7135 * > 'this' '.' [SimpleIdentifier] ([TypeParameterList]? [FormalParameterLis t])? |
7133 */ | 7136 */ |
7134 class FieldFormalParameter extends NormalFormalParameter { | 7137 class FieldFormalParameter extends NormalFormalParameter { |
7135 /** | 7138 /** |
7136 * The token representing either the 'final', 'const' or 'var' keyword, or | 7139 * The token representing either the 'final', 'const' or 'var' keyword, or |
7137 * `null` if no keyword was used. | 7140 * `null` if no keyword was used. |
7138 */ | 7141 */ |
7139 Token keyword; | 7142 Token keyword; |
7140 | 7143 |
7141 /** | 7144 /** |
7142 * The name of the declared type of the parameter, or `null` if the parameter | 7145 * The name of the declared type of the parameter, or `null` if the parameter |
7143 * does not have a declared type. | 7146 * does not have a declared type. |
7144 */ | 7147 */ |
7145 TypeName _type; | 7148 TypeName _type; |
7146 | 7149 |
7147 /** | 7150 /** |
7148 * The token representing the 'this' keyword. | 7151 * The token representing the 'this' keyword. |
7149 */ | 7152 */ |
7150 Token thisKeyword; | 7153 Token thisKeyword; |
7151 | 7154 |
7152 /** | 7155 /** |
7153 * The token representing the period. | 7156 * The token representing the period. |
7154 */ | 7157 */ |
7155 Token period; | 7158 Token period; |
7156 | 7159 |
7157 /** | 7160 /** |
7161 * The type parameters associated with the method, or `null` if the method is | |
7162 * not a generic method. | |
7163 */ | |
7164 TypeParameterList _typeParameters; | |
7165 | |
7166 /** | |
7158 * The parameters of the function-typed parameter, or `null` if this is not a | 7167 * The parameters of the function-typed parameter, or `null` if this is not a |
7159 * function-typed field formal parameter. | 7168 * function-typed field formal parameter. |
7160 */ | 7169 */ |
7161 FormalParameterList _parameters; | 7170 FormalParameterList _parameters; |
7162 | 7171 |
7163 /** | 7172 /** |
7164 * Initialize a newly created formal parameter. Either or both of the | 7173 * Initialize a newly created formal parameter. Either or both of the |
7165 * [comment] and [metadata] can be `null` if the parameter does not have the | 7174 * [comment] and [metadata] can be `null` if the parameter does not have the |
7166 * corresponding attribute. The [keyword] can be `null` if there is a type. | 7175 * corresponding attribute. The [keyword] can be `null` if there is a type. |
7167 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and | 7176 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and |
7168 * [period] can be `null` if the keyword 'this' was not provided. The | 7177 * [period] can be `null` if the keyword 'this' was not provided. The |
7169 * [parameters] can be `null` if this is not a function-typed field formal | 7178 * [parameters] can be `null` if this is not a function-typed field formal |
7170 * parameter. | 7179 * parameter. |
7171 */ | 7180 */ |
7172 FieldFormalParameter(Comment comment, List<Annotation> metadata, this.keyword, | 7181 FieldFormalParameter(Comment comment, List<Annotation> metadata, this.keyword, |
7173 TypeName type, this.thisKeyword, this.period, SimpleIdentifier identifier, | 7182 TypeName type, this.thisKeyword, this.period, SimpleIdentifier identifier, |
7174 FormalParameterList parameters) | 7183 TypeParameterList typeParameters, FormalParameterList parameters) |
7175 : super(comment, metadata, identifier) { | 7184 : super(comment, metadata, identifier) { |
7176 _type = _becomeParentOf(type); | 7185 _type = _becomeParentOf(type); |
7186 _typeParameters = _becomeParentOf(typeParameters); | |
7177 _parameters = _becomeParentOf(parameters); | 7187 _parameters = _becomeParentOf(parameters); |
7178 } | 7188 } |
7179 | 7189 |
7180 @override | 7190 @override |
7181 Token get beginToken { | 7191 Token get beginToken { |
7182 if (keyword != null) { | 7192 if (keyword != null) { |
7183 return keyword; | 7193 return keyword; |
7184 } else if (_type != null) { | 7194 } else if (_type != null) { |
7185 return _type.beginToken; | 7195 return _type.beginToken; |
7186 } | 7196 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7248 */ | 7258 */ |
7249 TypeName get type => _type; | 7259 TypeName get type => _type; |
7250 | 7260 |
7251 /** | 7261 /** |
7252 * Set the name of the declared type of the parameter to the given [typeName]. | 7262 * Set the name of the declared type of the parameter to the given [typeName]. |
7253 */ | 7263 */ |
7254 void set type(TypeName typeName) { | 7264 void set type(TypeName typeName) { |
7255 _type = _becomeParentOf(typeName); | 7265 _type = _becomeParentOf(typeName); |
7256 } | 7266 } |
7257 | 7267 |
7268 /** | |
7269 * Return the type parameters associated with this method, or `null` if this | |
7270 * method is not a generic method. | |
7271 */ | |
7272 TypeParameterList get typeParameters => _typeParameters; | |
7273 | |
7274 /** | |
7275 * Set the type parameters associated with this method to the given | |
7276 * [typeParameters]. | |
7277 */ | |
7278 void set typeParameters(TypeParameterList typeParameters) { | |
7279 _typeParameters = _becomeParentOf(typeParameters); | |
7280 } | |
7281 | |
7258 @override | 7282 @override |
7259 accept(AstVisitor visitor) => visitor.visitFieldFormalParameter(this); | 7283 accept(AstVisitor visitor) => visitor.visitFieldFormalParameter(this); |
7260 | 7284 |
7261 @override | 7285 @override |
7262 void visitChildren(AstVisitor visitor) { | 7286 void visitChildren(AstVisitor visitor) { |
7263 super.visitChildren(visitor); | 7287 super.visitChildren(visitor); |
7264 _safelyVisitChild(_type, visitor); | 7288 _safelyVisitChild(_type, visitor); |
7265 _safelyVisitChild(identifier, visitor); | 7289 _safelyVisitChild(identifier, visitor); |
7290 _safelyVisitChild(_typeParameters, visitor); | |
7266 _safelyVisitChild(_parameters, visitor); | 7291 _safelyVisitChild(_parameters, visitor); |
7267 } | 7292 } |
7268 } | 7293 } |
7269 | 7294 |
7270 /** | 7295 /** |
7271 * A for-each statement. | 7296 * A for-each statement. |
7272 * | 7297 * |
7273 * > forEachStatement ::= | 7298 * > forEachStatement ::= |
7274 * > 'await'? 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block] | 7299 * > 'await'? 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block] |
7275 * > | 'await'? 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block] | 7300 * > | 'await'? 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block] |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8003 @override | 8028 @override |
8004 void visitChildren(AstVisitor visitor) { | 8029 void visitChildren(AstVisitor visitor) { |
8005 _safelyVisitChild(_functionDeclaration, visitor); | 8030 _safelyVisitChild(_functionDeclaration, visitor); |
8006 } | 8031 } |
8007 } | 8032 } |
8008 | 8033 |
8009 /** | 8034 /** |
8010 * A function expression. | 8035 * A function expression. |
8011 * | 8036 * |
8012 * > functionExpression ::= | 8037 * > functionExpression ::= |
8013 * > [FormalParameterList] [FunctionBody] | 8038 * > [TypeParameterList]? [FormalParameterList] [FunctionBody] |
8014 */ | 8039 */ |
8015 class FunctionExpression extends Expression { | 8040 class FunctionExpression extends Expression { |
8016 /** | 8041 /** |
8042 * The type parameters associated with the method, or `null` if the method is | |
8043 * not a generic method. | |
8044 */ | |
8045 TypeParameterList _typeParameters; | |
8046 | |
8047 /** | |
8017 * The parameters associated with the function. | 8048 * The parameters associated with the function. |
8018 */ | 8049 */ |
8019 FormalParameterList _parameters; | 8050 FormalParameterList _parameters; |
8020 | 8051 |
8021 /** | 8052 /** |
8022 * The body of the function, or `null` if this is an external function. | 8053 * The body of the function, or `null` if this is an external function. |
8023 */ | 8054 */ |
8024 FunctionBody _body; | 8055 FunctionBody _body; |
8025 | 8056 |
8026 /** | 8057 /** |
8027 * The element associated with the function, or `null` if the AST structure | 8058 * The element associated with the function, or `null` if the AST structure |
8028 * has not been resolved. | 8059 * has not been resolved. |
8029 */ | 8060 */ |
8030 ExecutableElement element; | 8061 ExecutableElement element; |
8031 | 8062 |
8032 /** | 8063 /** |
8033 * Initialize a newly created function declaration. | 8064 * Initialize a newly created function declaration. |
8034 */ | 8065 */ |
8035 FunctionExpression(FormalParameterList parameters, FunctionBody body) { | 8066 FunctionExpression(TypeParameterList typeParameters, |
8067 FormalParameterList parameters, FunctionBody body) { | |
8068 _typeParameters = _becomeParentOf(typeParameters); | |
8036 _parameters = _becomeParentOf(parameters); | 8069 _parameters = _becomeParentOf(parameters); |
8037 _body = _becomeParentOf(body); | 8070 _body = _becomeParentOf(body); |
8038 } | 8071 } |
8039 | 8072 |
8040 @override | 8073 @override |
8041 Token get beginToken { | 8074 Token get beginToken { |
8042 if (_parameters != null) { | 8075 if (_typeParameters != null) { |
8076 return _typeParameters.beginToken; | |
8077 } else if (_parameters != null) { | |
8043 return _parameters.beginToken; | 8078 return _parameters.beginToken; |
8044 } else if (_body != null) { | 8079 } else if (_body != null) { |
8045 return _body.beginToken; | 8080 return _body.beginToken; |
8046 } | 8081 } |
8047 // This should never be reached because external functions must be named, | 8082 // This should never be reached because external functions must be named, |
8048 // hence either the body or the name should be non-null. | 8083 // hence either the body or the name should be non-null. |
8049 throw new IllegalStateException("Non-external functions must have a body"); | 8084 throw new IllegalStateException("Non-external functions must have a body"); |
8050 } | 8085 } |
8051 | 8086 |
8052 /** | 8087 /** |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8086 * Set the parameters associated with the function to the given list of | 8121 * Set the parameters associated with the function to the given list of |
8087 * [parameters]. | 8122 * [parameters]. |
8088 */ | 8123 */ |
8089 void set parameters(FormalParameterList parameters) { | 8124 void set parameters(FormalParameterList parameters) { |
8090 _parameters = _becomeParentOf(parameters); | 8125 _parameters = _becomeParentOf(parameters); |
8091 } | 8126 } |
8092 | 8127 |
8093 @override | 8128 @override |
8094 int get precedence => 16; | 8129 int get precedence => 16; |
8095 | 8130 |
8131 /** | |
8132 * Return the type parameters associated with this method, or `null` if this | |
8133 * method is not a generic method. | |
8134 */ | |
8135 TypeParameterList get typeParameters => _typeParameters; | |
8136 | |
8137 /** | |
8138 * Set the type parameters associated with this method to the given | |
8139 * [typeParameters]. | |
8140 */ | |
8141 void set typeParameters(TypeParameterList typeParameters) { | |
8142 _typeParameters = _becomeParentOf(typeParameters); | |
8143 } | |
8144 | |
8096 @override | 8145 @override |
8097 accept(AstVisitor visitor) => visitor.visitFunctionExpression(this); | 8146 accept(AstVisitor visitor) => visitor.visitFunctionExpression(this); |
8098 | 8147 |
8099 @override | 8148 @override |
8100 void visitChildren(AstVisitor visitor) { | 8149 void visitChildren(AstVisitor visitor) { |
8150 _safelyVisitChild(_typeParameters, visitor); | |
8101 _safelyVisitChild(_parameters, visitor); | 8151 _safelyVisitChild(_parameters, visitor); |
8102 _safelyVisitChild(_body, visitor); | 8152 _safelyVisitChild(_body, visitor); |
8103 } | 8153 } |
8104 } | 8154 } |
8105 | 8155 |
8106 /** | 8156 /** |
8107 * The invocation of a function resulting from evaluating an expression. | 8157 * The invocation of a function resulting from evaluating an expression. |
8108 * Invocations of methods and other forms of functions are represented by | 8158 * Invocations of methods and other forms of functions are represented by |
8109 * [MethodInvocation] nodes. Invocations of getters and setters are represented | 8159 * [MethodInvocation] nodes. Invocations of getters and setters are represented |
8110 * by either [PrefixedIdentifier] or [PropertyAccess] nodes. | 8160 * by either [PrefixedIdentifier] or [PropertyAccess] nodes. |
8111 * | 8161 * |
8112 * > functionExpressionInvoction ::= | 8162 * > functionExpressionInvoction ::= |
8113 * > [Expression] [ArgumentList] | 8163 * > [Expression] [TypeArgumentList]? [ArgumentList] |
8114 */ | 8164 */ |
8115 class FunctionExpressionInvocation extends Expression { | 8165 class FunctionExpressionInvocation extends Expression { |
8116 /** | 8166 /** |
8117 * The expression producing the function being invoked. | 8167 * The expression producing the function being invoked. |
8118 */ | 8168 */ |
8119 Expression _function; | 8169 Expression _function; |
8120 | 8170 |
8121 /** | 8171 /** |
8172 * The type arguments to be applied to the method being invoked, or `null` if | |
8173 * no type arguments were provided. | |
8174 */ | |
8175 TypeArgumentList _typeArguments; | |
8176 | |
8177 /** | |
8122 * The list of arguments to the function. | 8178 * The list of arguments to the function. |
8123 */ | 8179 */ |
8124 ArgumentList _argumentList; | 8180 ArgumentList _argumentList; |
8125 | 8181 |
8126 /** | 8182 /** |
8127 * The element associated with the function being invoked based on static type | 8183 * The element associated with the function being invoked based on static type |
8128 * information, or `null` if the AST structure has not been resolved or the | 8184 * information, or `null` if the AST structure has not been resolved or the |
8129 * function could not be resolved. | 8185 * function could not be resolved. |
8130 */ | 8186 */ |
8131 ExecutableElement staticElement; | 8187 ExecutableElement staticElement; |
8132 | 8188 |
8133 /** | 8189 /** |
8134 * The element associated with the function being invoked based on propagated | 8190 * The element associated with the function being invoked based on propagated |
8135 * type information, or `null` if the AST structure has not been resolved or | 8191 * type information, or `null` if the AST structure has not been resolved or |
8136 * the function could not be resolved. | 8192 * the function could not be resolved. |
8137 */ | 8193 */ |
8138 ExecutableElement propagatedElement; | 8194 ExecutableElement propagatedElement; |
8139 | 8195 |
8140 /** | 8196 /** |
8141 * Initialize a newly created function expression invocation. | 8197 * Initialize a newly created function expression invocation. |
8142 */ | 8198 */ |
8143 FunctionExpressionInvocation(Expression function, ArgumentList argumentList) { | 8199 FunctionExpressionInvocation(Expression function, |
8200 TypeArgumentList typeArguments, ArgumentList argumentList) { | |
8144 _function = _becomeParentOf(function); | 8201 _function = _becomeParentOf(function); |
8202 _typeArguments = _becomeParentOf(typeArguments); | |
8145 _argumentList = _becomeParentOf(argumentList); | 8203 _argumentList = _becomeParentOf(argumentList); |
8146 } | 8204 } |
8147 | 8205 |
8148 /** | 8206 /** |
8149 * Return the list of arguments to the method. | 8207 * Return the list of arguments to the method. |
8150 */ | 8208 */ |
8151 ArgumentList get argumentList => _argumentList; | 8209 ArgumentList get argumentList => _argumentList; |
8152 | 8210 |
8153 /** | 8211 /** |
8154 * Set the list of arguments to the method to the given [argumentList]. | 8212 * Set the list of arguments to the method to the given [argumentList]. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8191 * Set the expression producing the function being invoked to the given | 8249 * Set the expression producing the function being invoked to the given |
8192 * [expression]. | 8250 * [expression]. |
8193 */ | 8251 */ |
8194 void set function(Expression expression) { | 8252 void set function(Expression expression) { |
8195 _function = _becomeParentOf(expression); | 8253 _function = _becomeParentOf(expression); |
8196 } | 8254 } |
8197 | 8255 |
8198 @override | 8256 @override |
8199 int get precedence => 15; | 8257 int get precedence => 15; |
8200 | 8258 |
8259 /** | |
8260 * Return the type arguments to be applied to the method being invoked, or | |
8261 * `null` if no type arguments were provided. | |
8262 */ | |
8263 TypeArgumentList get typeArguments => _typeArguments; | |
8264 | |
8265 /** | |
8266 * Set the type arguments to be applied to the method being invoked to the | |
8267 * given [typeArguments]. | |
8268 */ | |
8269 void set typeArguments(TypeArgumentList typeArguments) { | |
8270 _typeArguments = _becomeParentOf(typeArguments); | |
8271 } | |
8272 | |
8201 @override | 8273 @override |
8202 accept(AstVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); | 8274 accept(AstVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); |
8203 | 8275 |
8204 @override | 8276 @override |
8205 void visitChildren(AstVisitor visitor) { | 8277 void visitChildren(AstVisitor visitor) { |
8206 _safelyVisitChild(_function, visitor); | 8278 _safelyVisitChild(_function, visitor); |
8279 _safelyVisitChild(_typeArguments, visitor); | |
8207 _safelyVisitChild(_argumentList, visitor); | 8280 _safelyVisitChild(_argumentList, visitor); |
8208 } | 8281 } |
8209 } | 8282 } |
8210 | 8283 |
8211 /** | 8284 /** |
8212 * A function type alias. | 8285 * A function type alias. |
8213 * | 8286 * |
8214 * > functionTypeAlias ::= | 8287 * > functionTypeAlias ::= |
8215 * > functionPrefix [TypeParameterList]? [FormalParameterList] ';' | 8288 * > functionPrefix [TypeParameterList]? [FormalParameterList] ';' |
8216 * > | 8289 * > |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8316 _safelyVisitChild(_name, visitor); | 8389 _safelyVisitChild(_name, visitor); |
8317 _safelyVisitChild(_typeParameters, visitor); | 8390 _safelyVisitChild(_typeParameters, visitor); |
8318 _safelyVisitChild(_parameters, visitor); | 8391 _safelyVisitChild(_parameters, visitor); |
8319 } | 8392 } |
8320 } | 8393 } |
8321 | 8394 |
8322 /** | 8395 /** |
8323 * A function-typed formal parameter. | 8396 * A function-typed formal parameter. |
8324 * | 8397 * |
8325 * > functionSignature ::= | 8398 * > functionSignature ::= |
8326 * > [TypeName]? [SimpleIdentifier] [FormalParameterList] | 8399 * > [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterLis t] |
8327 */ | 8400 */ |
8328 class FunctionTypedFormalParameter extends NormalFormalParameter { | 8401 class FunctionTypedFormalParameter extends NormalFormalParameter { |
8329 /** | 8402 /** |
8330 * The return type of the function, or `null` if the function does not have a | 8403 * The return type of the function, or `null` if the function does not have a |
8331 * return type. | 8404 * return type. |
8332 */ | 8405 */ |
8333 TypeName _returnType; | 8406 TypeName _returnType; |
8334 | 8407 |
8335 /** | 8408 /** |
8409 * The type parameters associated with the method, or `null` if the method is | |
scheglov
2015/06/26 01:33:50
method -> function
Brian Wilkerson
2015/06/26 19:07:34
Done
| |
8410 * not a generic method. | |
8411 */ | |
8412 TypeParameterList _typeParameters; | |
8413 | |
8414 /** | |
8336 * The parameters of the function-typed parameter. | 8415 * The parameters of the function-typed parameter. |
8337 */ | 8416 */ |
8338 FormalParameterList _parameters; | 8417 FormalParameterList _parameters; |
8339 | 8418 |
8340 /** | 8419 /** |
8341 * Initialize a newly created formal parameter. Either or both of the | 8420 * Initialize a newly created formal parameter. Either or both of the |
8342 * [comment] and [metadata] can be `null` if the parameter does not have the | 8421 * [comment] and [metadata] can be `null` if the parameter does not have the |
8343 * corresponding attribute. The [returnType] can be `null` if no return type | 8422 * corresponding attribute. The [returnType] can be `null` if no return type |
8344 * was specified. | 8423 * was specified. |
8345 */ | 8424 */ |
8346 FunctionTypedFormalParameter(Comment comment, List<Annotation> metadata, | 8425 FunctionTypedFormalParameter(Comment comment, List<Annotation> metadata, |
8347 TypeName returnType, SimpleIdentifier identifier, | 8426 TypeName returnType, SimpleIdentifier identifier, |
8348 FormalParameterList parameters) | 8427 TypeParameterList typeParameters, FormalParameterList parameters) |
8349 : super(comment, metadata, identifier) { | 8428 : super(comment, metadata, identifier) { |
8350 _returnType = _becomeParentOf(returnType); | 8429 _returnType = _becomeParentOf(returnType); |
8430 _typeParameters = _becomeParentOf(typeParameters); | |
8351 _parameters = _becomeParentOf(parameters); | 8431 _parameters = _becomeParentOf(parameters); |
8352 } | 8432 } |
8353 | 8433 |
8354 @override | 8434 @override |
8355 Token get beginToken { | 8435 Token get beginToken { |
8356 if (_returnType != null) { | 8436 if (_returnType != null) { |
8357 return _returnType.beginToken; | 8437 return _returnType.beginToken; |
8358 } | 8438 } |
8359 return identifier.beginToken; | 8439 return identifier.beginToken; |
8360 } | 8440 } |
(...skipping 30 matching lines...) Expand all Loading... | |
8391 */ | 8471 */ |
8392 TypeName get returnType => _returnType; | 8472 TypeName get returnType => _returnType; |
8393 | 8473 |
8394 /** | 8474 /** |
8395 * Set the return type of the function to the given [type]. | 8475 * Set the return type of the function to the given [type]. |
8396 */ | 8476 */ |
8397 void set returnType(TypeName type) { | 8477 void set returnType(TypeName type) { |
8398 _returnType = _becomeParentOf(type); | 8478 _returnType = _becomeParentOf(type); |
8399 } | 8479 } |
8400 | 8480 |
8481 /** | |
8482 * Return the type parameters associated with this method, or `null` if this | |
8483 * method is not a generic method. | |
8484 */ | |
8485 TypeParameterList get typeParameters => _typeParameters; | |
scheglov
2015/06/26 01:33:49
method -> function
Brian Wilkerson
2015/06/26 19:07:34
Done
| |
8486 | |
8487 /** | |
8488 * Set the type parameters associated with this method to the given | |
8489 * [typeParameters]. | |
8490 */ | |
8491 void set typeParameters(TypeParameterList typeParameters) { | |
8492 _typeParameters = _becomeParentOf(typeParameters); | |
8493 } | |
8494 | |
8401 @override | 8495 @override |
8402 accept(AstVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); | 8496 accept(AstVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); |
8403 | 8497 |
8404 @override | 8498 @override |
8405 void visitChildren(AstVisitor visitor) { | 8499 void visitChildren(AstVisitor visitor) { |
8406 super.visitChildren(visitor); | 8500 super.visitChildren(visitor); |
8407 _safelyVisitChild(_returnType, visitor); | 8501 _safelyVisitChild(_returnType, visitor); |
8408 _safelyVisitChild(identifier, visitor); | 8502 _safelyVisitChild(identifier, visitor); |
8503 _safelyVisitChild(_typeParameters, visitor); | |
8409 _safelyVisitChild(_parameters, visitor); | 8504 _safelyVisitChild(_parameters, visitor); |
8410 } | 8505 } |
8411 } | 8506 } |
8412 | 8507 |
8413 /** | 8508 /** |
8414 * An AST visitor that will recursively visit all of the nodes in an AST | 8509 * An AST visitor that will recursively visit all of the nodes in an AST |
8415 * structure (like instances of the class [RecursiveAstVisitor]). In addition, | 8510 * structure (like instances of the class [RecursiveAstVisitor]). In addition, |
8416 * when a node of a specific type is visited not only will the visit method for | 8511 * when a node of a specific type is visited not only will the visit method for |
8417 * that specific type of node be invoked, but additional methods for the | 8512 * that specific type of node be invoked, but additional methods for the |
8418 * superclasses of that node will also be invoked. For example, using an | 8513 * superclasses of that node will also be invoked. For example, using an |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9644 new FieldDeclaration(_cloneNode(node.documentationComment), | 9739 new FieldDeclaration(_cloneNode(node.documentationComment), |
9645 _cloneNodeList(node.metadata), _mapToken(node.staticKeyword), | 9740 _cloneNodeList(node.metadata), _mapToken(node.staticKeyword), |
9646 _cloneNode(node.fields), _mapToken(node.semicolon)); | 9741 _cloneNode(node.fields), _mapToken(node.semicolon)); |
9647 | 9742 |
9648 @override | 9743 @override |
9649 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => | 9744 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => |
9650 new FieldFormalParameter(_cloneNode(node.documentationComment), | 9745 new FieldFormalParameter(_cloneNode(node.documentationComment), |
9651 _cloneNodeList(node.metadata), _mapToken(node.keyword), | 9746 _cloneNodeList(node.metadata), _mapToken(node.keyword), |
9652 _cloneNode(node.type), _mapToken(node.thisKeyword), | 9747 _cloneNode(node.type), _mapToken(node.thisKeyword), |
9653 _mapToken(node.period), _cloneNode(node.identifier), | 9748 _mapToken(node.period), _cloneNode(node.identifier), |
9654 _cloneNode(node.parameters)); | 9749 _cloneNode(node.typeParameters), _cloneNode(node.parameters)); |
9655 | 9750 |
9656 @override | 9751 @override |
9657 ForEachStatement visitForEachStatement(ForEachStatement node) { | 9752 ForEachStatement visitForEachStatement(ForEachStatement node) { |
9658 DeclaredIdentifier loopVariable = node.loopVariable; | 9753 DeclaredIdentifier loopVariable = node.loopVariable; |
9659 if (loopVariable == null) { | 9754 if (loopVariable == null) { |
9660 return new ForEachStatement.withReference(_mapToken(node.awaitKeyword), | 9755 return new ForEachStatement.withReference(_mapToken(node.awaitKeyword), |
9661 _mapToken(node.forKeyword), _mapToken(node.leftParenthesis), | 9756 _mapToken(node.forKeyword), _mapToken(node.leftParenthesis), |
9662 _cloneNode(node.identifier), _mapToken(node.inKeyword), | 9757 _cloneNode(node.identifier), _mapToken(node.inKeyword), |
9663 _cloneNode(node.iterable), _mapToken(node.rightParenthesis), | 9758 _cloneNode(node.iterable), _mapToken(node.rightParenthesis), |
9664 _cloneNode(node.body)); | 9759 _cloneNode(node.body)); |
(...skipping 27 matching lines...) Expand all Loading... | |
9692 _cloneNode(node.name), _cloneNode(node.functionExpression)); | 9787 _cloneNode(node.name), _cloneNode(node.functionExpression)); |
9693 | 9788 |
9694 @override | 9789 @override |
9695 FunctionDeclarationStatement visitFunctionDeclarationStatement( | 9790 FunctionDeclarationStatement visitFunctionDeclarationStatement( |
9696 FunctionDeclarationStatement node) => | 9791 FunctionDeclarationStatement node) => |
9697 new FunctionDeclarationStatement(_cloneNode(node.functionDeclaration)); | 9792 new FunctionDeclarationStatement(_cloneNode(node.functionDeclaration)); |
9698 | 9793 |
9699 @override | 9794 @override |
9700 FunctionExpression visitFunctionExpression(FunctionExpression node) { | 9795 FunctionExpression visitFunctionExpression(FunctionExpression node) { |
9701 FunctionExpression copy = new FunctionExpression( | 9796 FunctionExpression copy = new FunctionExpression( |
9702 _cloneNode(node.parameters), _cloneNode(node.body)); | 9797 _cloneNode(node.typeParameters), _cloneNode(node.parameters), |
9798 _cloneNode(node.body)); | |
9703 copy.element = node.element; | 9799 copy.element = node.element; |
9704 copy.propagatedType = node.propagatedType; | 9800 copy.propagatedType = node.propagatedType; |
9705 copy.staticType = node.staticType; | 9801 copy.staticType = node.staticType; |
9706 return copy; | 9802 return copy; |
9707 } | 9803 } |
9708 | 9804 |
9709 @override | 9805 @override |
9710 FunctionExpressionInvocation visitFunctionExpressionInvocation( | 9806 FunctionExpressionInvocation visitFunctionExpressionInvocation( |
9711 FunctionExpressionInvocation node) { | 9807 FunctionExpressionInvocation node) { |
9712 FunctionExpressionInvocation copy = new FunctionExpressionInvocation( | 9808 FunctionExpressionInvocation copy = new FunctionExpressionInvocation( |
9713 _cloneNode(node.function), _cloneNode(node.argumentList)); | 9809 _cloneNode(node.function), _cloneNode(node.typeArguments), |
9810 _cloneNode(node.argumentList)); | |
9714 copy.propagatedElement = node.propagatedElement; | 9811 copy.propagatedElement = node.propagatedElement; |
9715 copy.propagatedType = node.propagatedType; | 9812 copy.propagatedType = node.propagatedType; |
9716 copy.staticElement = node.staticElement; | 9813 copy.staticElement = node.staticElement; |
9717 copy.staticType = node.staticType; | 9814 copy.staticType = node.staticType; |
9718 return copy; | 9815 return copy; |
9719 } | 9816 } |
9720 | 9817 |
9721 @override | 9818 @override |
9722 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => | 9819 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => |
9723 new FunctionTypeAlias(_cloneNode(node.documentationComment), | 9820 new FunctionTypeAlias(_cloneNode(node.documentationComment), |
9724 _cloneNodeList(node.metadata), _mapToken(node.typedefKeyword), | 9821 _cloneNodeList(node.metadata), _mapToken(node.typedefKeyword), |
9725 _cloneNode(node.returnType), _cloneNode(node.name), | 9822 _cloneNode(node.returnType), _cloneNode(node.name), |
9726 _cloneNode(node.typeParameters), _cloneNode(node.parameters), | 9823 _cloneNode(node.typeParameters), _cloneNode(node.parameters), |
9727 _mapToken(node.semicolon)); | 9824 _mapToken(node.semicolon)); |
9728 | 9825 |
9729 @override | 9826 @override |
9730 FunctionTypedFormalParameter visitFunctionTypedFormalParameter( | 9827 FunctionTypedFormalParameter visitFunctionTypedFormalParameter( |
9731 FunctionTypedFormalParameter node) => new FunctionTypedFormalParameter( | 9828 FunctionTypedFormalParameter node) => new FunctionTypedFormalParameter( |
9732 _cloneNode(node.documentationComment), _cloneNodeList(node.metadata), | 9829 _cloneNode(node.documentationComment), _cloneNodeList(node.metadata), |
9733 _cloneNode(node.returnType), _cloneNode(node.identifier), | 9830 _cloneNode(node.returnType), _cloneNode(node.identifier), |
9734 _cloneNode(node.parameters)); | 9831 _cloneNode(node.typeParameters), _cloneNode(node.parameters)); |
9735 | 9832 |
9736 @override | 9833 @override |
9737 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator( | 9834 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator( |
9738 _mapToken(node.keyword), _cloneNodeList(node.hiddenNames)); | 9835 _mapToken(node.keyword), _cloneNodeList(node.hiddenNames)); |
9739 | 9836 |
9740 @override | 9837 @override |
9741 IfStatement visitIfStatement(IfStatement node) => new IfStatement( | 9838 IfStatement visitIfStatement(IfStatement node) => new IfStatement( |
9742 _mapToken(node.ifKeyword), _mapToken(node.leftParenthesis), | 9839 _mapToken(node.ifKeyword), _mapToken(node.leftParenthesis), |
9743 _cloneNode(node.condition), _mapToken(node.rightParenthesis), | 9840 _cloneNode(node.condition), _mapToken(node.rightParenthesis), |
9744 _cloneNode(node.thenStatement), _mapToken(node.elseKeyword), | 9841 _cloneNode(node.thenStatement), _mapToken(node.elseKeyword), |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9866 MapLiteralEntry visitMapLiteralEntry( | 9963 MapLiteralEntry visitMapLiteralEntry( |
9867 MapLiteralEntry node) => new MapLiteralEntry( | 9964 MapLiteralEntry node) => new MapLiteralEntry( |
9868 _cloneNode(node.key), _mapToken(node.separator), _cloneNode(node.value)); | 9965 _cloneNode(node.key), _mapToken(node.separator), _cloneNode(node.value)); |
9869 | 9966 |
9870 @override | 9967 @override |
9871 MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => | 9968 MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => |
9872 new MethodDeclaration(_cloneNode(node.documentationComment), | 9969 new MethodDeclaration(_cloneNode(node.documentationComment), |
9873 _cloneNodeList(node.metadata), _mapToken(node.externalKeyword), | 9970 _cloneNodeList(node.metadata), _mapToken(node.externalKeyword), |
9874 _mapToken(node.modifierKeyword), _cloneNode(node.returnType), | 9971 _mapToken(node.modifierKeyword), _cloneNode(node.returnType), |
9875 _mapToken(node.propertyKeyword), _mapToken(node.operatorKeyword), | 9972 _mapToken(node.propertyKeyword), _mapToken(node.operatorKeyword), |
9876 _cloneNode(node.name), _cloneNode(node.parameters), | 9973 _cloneNode(node.name), _cloneNode(node._typeParameters), |
9877 _cloneNode(node.body)); | 9974 _cloneNode(node.parameters), _cloneNode(node.body)); |
9878 | 9975 |
9879 @override | 9976 @override |
9880 MethodInvocation visitMethodInvocation(MethodInvocation node) { | 9977 MethodInvocation visitMethodInvocation(MethodInvocation node) { |
9881 MethodInvocation copy = new MethodInvocation(_cloneNode(node.target), | 9978 MethodInvocation copy = new MethodInvocation(_cloneNode(node.target), |
9882 _mapToken(node.operator), _cloneNode(node.methodName), | 9979 _mapToken(node.operator), _cloneNode(node.methodName), |
9883 _cloneNode(node.argumentList)); | 9980 _cloneNode(node.typeArguments), _cloneNode(node.argumentList)); |
9884 copy.propagatedType = node.propagatedType; | 9981 copy.propagatedType = node.propagatedType; |
9885 copy.staticType = node.staticType; | 9982 copy.staticType = node.staticType; |
9886 return copy; | 9983 return copy; |
9887 } | 9984 } |
9888 | 9985 |
9889 @override | 9986 @override |
9890 NamedExpression visitNamedExpression(NamedExpression node) { | 9987 NamedExpression visitNamedExpression(NamedExpression node) { |
9891 NamedExpression copy = | 9988 NamedExpression copy = |
9892 new NamedExpression(_cloneNode(node.name), _cloneNode(node.expression)); | 9989 new NamedExpression(_cloneNode(node.name), _cloneNode(node.expression)); |
9893 copy.propagatedType = node.propagatedType; | 9990 copy.propagatedType = node.propagatedType; |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11409 } | 11506 } |
11410 | 11507 |
11411 /** | 11508 /** |
11412 * A method declaration. | 11509 * A method declaration. |
11413 * | 11510 * |
11414 * > methodDeclaration ::= | 11511 * > methodDeclaration ::= |
11415 * > methodSignature [FunctionBody] | 11512 * > methodSignature [FunctionBody] |
11416 * > | 11513 * > |
11417 * > methodSignature ::= | 11514 * > methodSignature ::= |
11418 * > 'external'? ('abstract' | 'static')? [Type]? ('get' | 'set')? | 11515 * > 'external'? ('abstract' | 'static')? [Type]? ('get' | 'set')? |
11419 * > methodName [FormalParameterList] | 11516 * > methodName [TypeParameterList] [FormalParameterList] |
11420 * > | 11517 * > |
11421 * > methodName ::= | 11518 * > methodName ::= |
11422 * > [SimpleIdentifier] | 11519 * > [SimpleIdentifier] |
11423 * > | 'operator' [SimpleIdentifier] | 11520 * > | 'operator' [SimpleIdentifier] |
11424 */ | 11521 */ |
11425 class MethodDeclaration extends ClassMember { | 11522 class MethodDeclaration extends ClassMember { |
11426 /** | 11523 /** |
11427 * The token for the 'external' keyword, or `null` if the constructor is not | 11524 * The token for the 'external' keyword, or `null` if the constructor is not |
11428 * external. | 11525 * external. |
11429 */ | 11526 */ |
(...skipping 21 matching lines...) Expand all Loading... | |
11451 * does not declare an operator. | 11548 * does not declare an operator. |
11452 */ | 11549 */ |
11453 Token operatorKeyword; | 11550 Token operatorKeyword; |
11454 | 11551 |
11455 /** | 11552 /** |
11456 * The name of the method. | 11553 * The name of the method. |
11457 */ | 11554 */ |
11458 SimpleIdentifier _name; | 11555 SimpleIdentifier _name; |
11459 | 11556 |
11460 /** | 11557 /** |
11558 * The type parameters associated with the method, or `null` if the method is | |
11559 * not a generic method. | |
11560 */ | |
11561 TypeParameterList _typeParameters; | |
11562 | |
11563 /** | |
11461 * The parameters associated with the method, or `null` if this method | 11564 * The parameters associated with the method, or `null` if this method |
11462 * declares a getter. | 11565 * declares a getter. |
11463 */ | 11566 */ |
11464 FormalParameterList _parameters; | 11567 FormalParameterList _parameters; |
11465 | 11568 |
11466 /** | 11569 /** |
11467 * The body of the method. | 11570 * The body of the method. |
11468 */ | 11571 */ |
11469 FunctionBody _body; | 11572 FunctionBody _body; |
11470 | 11573 |
11471 /** | 11574 /** |
11472 * Initialize a newly created method declaration. Either or both of the | 11575 * Initialize a newly created method declaration. Either or both of the |
11473 * [comment] and [metadata] can be `null` if the declaration does not have the | 11576 * [comment] and [metadata] can be `null` if the declaration does not have the |
11474 * corresponding attribute. The [externalKeyword] can be `null` if the method | 11577 * corresponding attribute. The [externalKeyword] can be `null` if the method |
11475 * is not external. The [modifierKeyword] can be `null` if the method is | 11578 * is not external. The [modifierKeyword] can be `null` if the method is |
11476 * neither abstract nor static. The [returnType] can be `null` if no return | 11579 * neither abstract nor static. The [returnType] can be `null` if no return |
11477 * type was specified. The [propertyKeyword] can be `null` if the method is | 11580 * type was specified. The [propertyKeyword] can be `null` if the method is |
11478 * neither a getter or a setter. The [operatorKeyword] can be `null` if the | 11581 * neither a getter or a setter. The [operatorKeyword] can be `null` if the |
11479 * method does not implement an operator. The [parameters] must be `null` if | 11582 * method does not implement an operator. The [parameters] must be `null` if |
11480 * this method declares a getter. | 11583 * this method declares a getter. |
11481 */ | 11584 */ |
11482 MethodDeclaration(Comment comment, List<Annotation> metadata, | 11585 MethodDeclaration(Comment comment, List<Annotation> metadata, |
11483 this.externalKeyword, this.modifierKeyword, TypeName returnType, | 11586 this.externalKeyword, this.modifierKeyword, TypeName returnType, |
11484 this.propertyKeyword, this.operatorKeyword, SimpleIdentifier name, | 11587 this.propertyKeyword, this.operatorKeyword, SimpleIdentifier name, |
11485 FormalParameterList parameters, FunctionBody body) | 11588 TypeParameterList typeParameters, FormalParameterList parameters, |
11589 FunctionBody body) | |
11486 : super(comment, metadata) { | 11590 : super(comment, metadata) { |
11487 _returnType = _becomeParentOf(returnType); | 11591 _returnType = _becomeParentOf(returnType); |
11488 _name = _becomeParentOf(name); | 11592 _name = _becomeParentOf(name); |
11593 _typeParameters = _becomeParentOf(typeParameters); | |
11489 _parameters = _becomeParentOf(parameters); | 11594 _parameters = _becomeParentOf(parameters); |
11490 _body = _becomeParentOf(body); | 11595 _body = _becomeParentOf(body); |
11491 } | 11596 } |
11492 | 11597 |
11493 /** | 11598 /** |
11494 * Return the body of the method. | 11599 * Return the body of the method. |
11495 */ | 11600 */ |
11496 FunctionBody get body => _body; | 11601 FunctionBody get body => _body; |
11497 | 11602 |
11498 /** | 11603 /** |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11605 */ | 11710 */ |
11606 TypeName get returnType => _returnType; | 11711 TypeName get returnType => _returnType; |
11607 | 11712 |
11608 /** | 11713 /** |
11609 * Set the return type of the method to the given [typeName]. | 11714 * Set the return type of the method to the given [typeName]. |
11610 */ | 11715 */ |
11611 void set returnType(TypeName typeName) { | 11716 void set returnType(TypeName typeName) { |
11612 _returnType = _becomeParentOf(typeName); | 11717 _returnType = _becomeParentOf(typeName); |
11613 } | 11718 } |
11614 | 11719 |
11720 /** | |
11721 * Return the type parameters associated with this method, or `null` if this | |
11722 * method is not a generic method. | |
11723 */ | |
11724 TypeParameterList get typeParameters => _typeParameters; | |
11725 | |
11726 /** | |
11727 * Set the type parameters associated with this method to the given | |
11728 * [typeParameters]. | |
11729 */ | |
11730 void set typeParameters(TypeParameterList typeParameters) { | |
11731 _typeParameters = _becomeParentOf(typeParameters); | |
11732 } | |
11733 | |
11615 @override | 11734 @override |
11616 accept(AstVisitor visitor) => visitor.visitMethodDeclaration(this); | 11735 accept(AstVisitor visitor) => visitor.visitMethodDeclaration(this); |
11617 | 11736 |
11618 @override | 11737 @override |
11619 void visitChildren(AstVisitor visitor) { | 11738 void visitChildren(AstVisitor visitor) { |
11620 super.visitChildren(visitor); | 11739 super.visitChildren(visitor); |
11621 _safelyVisitChild(_returnType, visitor); | 11740 _safelyVisitChild(_returnType, visitor); |
11622 _safelyVisitChild(_name, visitor); | 11741 _safelyVisitChild(_name, visitor); |
11742 _safelyVisitChild(_typeParameters, visitor); | |
11623 _safelyVisitChild(_parameters, visitor); | 11743 _safelyVisitChild(_parameters, visitor); |
11624 _safelyVisitChild(_body, visitor); | 11744 _safelyVisitChild(_body, visitor); |
11625 } | 11745 } |
11626 } | 11746 } |
11627 | 11747 |
11628 /** | 11748 /** |
11629 * The invocation of either a function or a method. Invocations of functions | 11749 * The invocation of either a function or a method. Invocations of functions |
11630 * resulting from evaluating an expression are represented by | 11750 * resulting from evaluating an expression are represented by |
11631 * [FunctionExpressionInvocation] nodes. Invocations of getters and setters are | 11751 * [FunctionExpressionInvocation] nodes. Invocations of getters and setters are |
11632 * represented by either [PrefixedIdentifier] or [PropertyAccess] nodes. | 11752 * represented by either [PrefixedIdentifier] or [PropertyAccess] nodes. |
11633 * | 11753 * |
11634 * > methodInvoction ::= | 11754 * > methodInvoction ::= |
11635 * > ([Expression] '.')? [SimpleIdentifier] [ArgumentList] | 11755 * > ([Expression] '.')? [SimpleIdentifier] [TypeArgumentList]? [ArgumentLis t] |
11636 */ | 11756 */ |
11637 class MethodInvocation extends Expression { | 11757 class MethodInvocation extends Expression { |
11638 /** | 11758 /** |
11639 * The expression producing the object on which the method is defined, or | 11759 * The expression producing the object on which the method is defined, or |
11640 * `null` if there is no target (that is, the target is implicitly `this`). | 11760 * `null` if there is no target (that is, the target is implicitly `this`). |
11641 */ | 11761 */ |
11642 Expression _target; | 11762 Expression _target; |
11643 | 11763 |
11644 /** | 11764 /** |
11645 * The operator that separates the target from the method name, or `null` | 11765 * The operator that separates the target from the method name, or `null` |
11646 * if there is no target. In an ordinary method invocation this will be a | 11766 * if there is no target. In an ordinary method invocation this will be a |
11647 * period ('.'). In a cascade section this will be the cascade operator | 11767 * period ('.'). In a cascade section this will be the cascade operator |
11648 * ('..'). | 11768 * ('..'). |
11649 */ | 11769 */ |
11650 Token operator; | 11770 Token operator; |
11651 | 11771 |
11652 /** | 11772 /** |
11653 * The name of the method being invoked. | 11773 * The name of the method being invoked. |
11654 */ | 11774 */ |
11655 SimpleIdentifier _methodName; | 11775 SimpleIdentifier _methodName; |
11656 | 11776 |
11657 /** | 11777 /** |
11778 * The type arguments to be applied to the method being invoked, or `null` if | |
11779 * no type arguments were provided. | |
11780 */ | |
11781 TypeArgumentList _typeArguments; | |
11782 | |
11783 /** | |
11658 * The list of arguments to the method. | 11784 * The list of arguments to the method. |
11659 */ | 11785 */ |
11660 ArgumentList _argumentList; | 11786 ArgumentList _argumentList; |
11661 | 11787 |
11662 /** | 11788 /** |
11663 * Initialize a newly created method invocation. The [target] and [operator] | 11789 * Initialize a newly created method invocation. The [target] and [operator] |
11664 * can be `null` if there is no target. | 11790 * can be `null` if there is no target. |
11665 */ | 11791 */ |
11666 MethodInvocation(Expression target, this.operator, | 11792 MethodInvocation(Expression target, this.operator, |
11667 SimpleIdentifier methodName, ArgumentList argumentList) { | 11793 SimpleIdentifier methodName, TypeArgumentList typeArguments, |
11794 ArgumentList argumentList) { | |
11668 _target = _becomeParentOf(target); | 11795 _target = _becomeParentOf(target); |
11669 _methodName = _becomeParentOf(methodName); | 11796 _methodName = _becomeParentOf(methodName); |
11797 _typeArguments = _becomeParentOf(typeArguments); | |
11670 _argumentList = _becomeParentOf(argumentList); | 11798 _argumentList = _becomeParentOf(argumentList); |
11671 } | 11799 } |
11672 | 11800 |
11673 /** | 11801 /** |
11674 * Return the list of arguments to the method. | 11802 * Return the list of arguments to the method. |
11675 */ | 11803 */ |
11676 ArgumentList get argumentList => _argumentList; | 11804 ArgumentList get argumentList => _argumentList; |
11677 | 11805 |
11678 /** | 11806 /** |
11679 * Set the list of arguments to the method to the given [argumentList]. | 11807 * Set the list of arguments to the method to the given [argumentList]. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11776 Expression get target => _target; | 11904 Expression get target => _target; |
11777 | 11905 |
11778 /** | 11906 /** |
11779 * Set the expression producing the object on which the method is defined to | 11907 * Set the expression producing the object on which the method is defined to |
11780 * the given [expression]. | 11908 * the given [expression]. |
11781 */ | 11909 */ |
11782 void set target(Expression expression) { | 11910 void set target(Expression expression) { |
11783 _target = _becomeParentOf(expression); | 11911 _target = _becomeParentOf(expression); |
11784 } | 11912 } |
11785 | 11913 |
11914 /** | |
11915 * Return the type arguments to be applied to the method being invoked, or | |
11916 * `null` if no type arguments were provided. | |
11917 */ | |
11918 TypeArgumentList get typeArguments => _typeArguments; | |
11919 | |
11920 /** | |
11921 * Set the type arguments to be applied to the method being invoked to the | |
11922 * given [typeArguments]. | |
11923 */ | |
11924 void set typeArguments(TypeArgumentList typeArguments) { | |
11925 _typeArguments = _becomeParentOf(typeArguments); | |
11926 } | |
11927 | |
11786 @override | 11928 @override |
11787 accept(AstVisitor visitor) => visitor.visitMethodInvocation(this); | 11929 accept(AstVisitor visitor) => visitor.visitMethodInvocation(this); |
11788 | 11930 |
11789 @override | 11931 @override |
11790 void visitChildren(AstVisitor visitor) { | 11932 void visitChildren(AstVisitor visitor) { |
11791 _safelyVisitChild(_target, visitor); | 11933 _safelyVisitChild(_target, visitor); |
11792 _safelyVisitChild(_methodName, visitor); | 11934 _safelyVisitChild(_methodName, visitor); |
11935 _safelyVisitChild(_typeArguments, visitor); | |
11793 _safelyVisitChild(_argumentList, visitor); | 11936 _safelyVisitChild(_argumentList, visitor); |
11794 } | 11937 } |
11795 } | 11938 } |
11796 | 11939 |
11797 /** | 11940 /** |
11798 * A node that declares a single name within the scope of a compilation unit. | 11941 * A node that declares a single name within the scope of a compilation unit. |
11799 */ | 11942 */ |
11800 abstract class NamedCompilationUnitMember extends CompilationUnitMember { | 11943 abstract class NamedCompilationUnitMember extends CompilationUnitMember { |
11801 /** | 11944 /** |
11802 * The name of the member being declared. | 11945 * The name of the member being declared. |
(...skipping 5956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17759 _writer.print(";"); | 17902 _writer.print(";"); |
17760 return null; | 17903 return null; |
17761 } | 17904 } |
17762 | 17905 |
17763 @override | 17906 @override |
17764 Object visitFieldFormalParameter(FieldFormalParameter node) { | 17907 Object visitFieldFormalParameter(FieldFormalParameter node) { |
17765 _visitTokenWithSuffix(node.keyword, " "); | 17908 _visitTokenWithSuffix(node.keyword, " "); |
17766 _visitNodeWithSuffix(node.type, " "); | 17909 _visitNodeWithSuffix(node.type, " "); |
17767 _writer.print("this."); | 17910 _writer.print("this."); |
17768 _visitNode(node.identifier); | 17911 _visitNode(node.identifier); |
17912 _visitNode(node.typeParameters); | |
17769 _visitNode(node.parameters); | 17913 _visitNode(node.parameters); |
17770 return null; | 17914 return null; |
17771 } | 17915 } |
17772 | 17916 |
17773 @override | 17917 @override |
17774 Object visitForEachStatement(ForEachStatement node) { | 17918 Object visitForEachStatement(ForEachStatement node) { |
17775 DeclaredIdentifier loopVariable = node.loopVariable; | 17919 DeclaredIdentifier loopVariable = node.loopVariable; |
17776 if (node.awaitKeyword != null) { | 17920 if (node.awaitKeyword != null) { |
17777 _writer.print("await "); | 17921 _writer.print("await "); |
17778 } | 17922 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17847 } | 17991 } |
17848 | 17992 |
17849 @override | 17993 @override |
17850 Object visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { | 17994 Object visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { |
17851 _visitNode(node.functionDeclaration); | 17995 _visitNode(node.functionDeclaration); |
17852 return null; | 17996 return null; |
17853 } | 17997 } |
17854 | 17998 |
17855 @override | 17999 @override |
17856 Object visitFunctionExpression(FunctionExpression node) { | 18000 Object visitFunctionExpression(FunctionExpression node) { |
18001 _visitNode(node.typeParameters); | |
17857 _visitNode(node.parameters); | 18002 _visitNode(node.parameters); |
17858 _writer.print(' '); | 18003 _writer.print(' '); |
17859 _visitNode(node.body); | 18004 _visitNode(node.body); |
17860 return null; | 18005 return null; |
17861 } | 18006 } |
17862 | 18007 |
17863 @override | 18008 @override |
17864 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { | 18009 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { |
17865 _visitNode(node.function); | 18010 _visitNode(node.function); |
18011 _visitNode(node.typeArguments); | |
17866 _visitNode(node.argumentList); | 18012 _visitNode(node.argumentList); |
17867 return null; | 18013 return null; |
17868 } | 18014 } |
17869 | 18015 |
17870 @override | 18016 @override |
17871 Object visitFunctionTypeAlias(FunctionTypeAlias node) { | 18017 Object visitFunctionTypeAlias(FunctionTypeAlias node) { |
17872 _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " "); | 18018 _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " "); |
17873 _writer.print("typedef "); | 18019 _writer.print("typedef "); |
17874 _visitNodeWithSuffix(node.returnType, " "); | 18020 _visitNodeWithSuffix(node.returnType, " "); |
17875 _visitNode(node.name); | 18021 _visitNode(node.name); |
17876 _visitNode(node.typeParameters); | 18022 _visitNode(node.typeParameters); |
17877 _visitNode(node.parameters); | 18023 _visitNode(node.parameters); |
17878 _writer.print(";"); | 18024 _writer.print(";"); |
17879 return null; | 18025 return null; |
17880 } | 18026 } |
17881 | 18027 |
17882 @override | 18028 @override |
17883 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { | 18029 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { |
17884 _visitNodeWithSuffix(node.returnType, " "); | 18030 _visitNodeWithSuffix(node.returnType, " "); |
17885 _visitNode(node.identifier); | 18031 _visitNode(node.identifier); |
18032 _visitNode(node.typeParameters); | |
17886 _visitNode(node.parameters); | 18033 _visitNode(node.parameters); |
17887 return null; | 18034 return null; |
17888 } | 18035 } |
17889 | 18036 |
17890 @override | 18037 @override |
17891 Object visitHideCombinator(HideCombinator node) { | 18038 Object visitHideCombinator(HideCombinator node) { |
17892 _writer.print("hide "); | 18039 _writer.print("hide "); |
17893 _visitNodeListWithSeparator(node.hiddenNames, ", "); | 18040 _visitNodeListWithSeparator(node.hiddenNames, ", "); |
17894 return null; | 18041 return null; |
17895 } | 18042 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
18049 @override | 18196 @override |
18050 Object visitMethodDeclaration(MethodDeclaration node) { | 18197 Object visitMethodDeclaration(MethodDeclaration node) { |
18051 _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " "); | 18198 _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " "); |
18052 _visitTokenWithSuffix(node.externalKeyword, " "); | 18199 _visitTokenWithSuffix(node.externalKeyword, " "); |
18053 _visitTokenWithSuffix(node.modifierKeyword, " "); | 18200 _visitTokenWithSuffix(node.modifierKeyword, " "); |
18054 _visitNodeWithSuffix(node.returnType, " "); | 18201 _visitNodeWithSuffix(node.returnType, " "); |
18055 _visitTokenWithSuffix(node.propertyKeyword, " "); | 18202 _visitTokenWithSuffix(node.propertyKeyword, " "); |
18056 _visitTokenWithSuffix(node.operatorKeyword, " "); | 18203 _visitTokenWithSuffix(node.operatorKeyword, " "); |
18057 _visitNode(node.name); | 18204 _visitNode(node.name); |
18058 if (!node.isGetter) { | 18205 if (!node.isGetter) { |
18206 _visitNode(node.typeParameters); | |
18059 _visitNode(node.parameters); | 18207 _visitNode(node.parameters); |
18060 } | 18208 } |
18061 _visitFunctionWithPrefix(" ", node.body); | 18209 _visitFunctionWithPrefix(" ", node.body); |
18062 return null; | 18210 return null; |
18063 } | 18211 } |
18064 | 18212 |
18065 @override | 18213 @override |
18066 Object visitMethodInvocation(MethodInvocation node) { | 18214 Object visitMethodInvocation(MethodInvocation node) { |
18067 if (node.isCascaded) { | 18215 if (node.isCascaded) { |
18068 _writer.print(".."); | 18216 _writer.print(".."); |
18069 } else { | 18217 } else { |
18070 if (node.target != null) { | 18218 if (node.target != null) { |
18071 node.target.accept(this); | 18219 node.target.accept(this); |
18072 _writer.print(node.operator.lexeme); | 18220 _writer.print(node.operator.lexeme); |
18073 } | 18221 } |
18074 } | 18222 } |
18075 _visitNode(node.methodName); | 18223 _visitNode(node.methodName); |
18224 _visitNode(node.typeArguments); | |
18076 _visitNode(node.argumentList); | 18225 _visitNode(node.argumentList); |
18077 return null; | 18226 return null; |
18078 } | 18227 } |
18079 | 18228 |
18080 @override | 18229 @override |
18081 Object visitNamedExpression(NamedExpression node) { | 18230 Object visitNamedExpression(NamedExpression node) { |
18082 _visitNode(node.name); | 18231 _visitNode(node.name); |
18083 _visitNodeWithPrefix(" ", node.expression); | 18232 _visitNodeWithPrefix(" ", node.expression); |
18084 return null; | 18233 return null; |
18085 } | 18234 } |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20057 } | 20206 } |
20058 | 20207 |
20059 @override | 20208 @override |
20060 accept(AstVisitor visitor) => visitor.visitYieldStatement(this); | 20209 accept(AstVisitor visitor) => visitor.visitYieldStatement(this); |
20061 | 20210 |
20062 @override | 20211 @override |
20063 void visitChildren(AstVisitor visitor) { | 20212 void visitChildren(AstVisitor visitor) { |
20064 _safelyVisitChild(_expression, visitor); | 20213 _safelyVisitChild(_expression, visitor); |
20065 } | 20214 } |
20066 } | 20215 } |
OLD | NEW |