| 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'; |
| 11 | 11 |
| 12 import 'constant.dart'; | |
| 13 import 'element.dart'; | 12 import 'element.dart'; |
| 14 import 'engine.dart' show AnalysisEngine; | 13 import 'engine.dart' show AnalysisEngine; |
| 15 import 'java_core.dart'; | 14 import 'java_core.dart'; |
| 16 import 'java_engine.dart'; | 15 import 'java_engine.dart'; |
| 17 import 'parser.dart'; | 16 import 'parser.dart'; |
| 18 import 'scanner.dart'; | 17 import 'scanner.dart'; |
| 19 import 'source.dart' show LineInfo, Source; | 18 import 'source.dart' show LineInfo, Source; |
| 20 import 'utilities_collection.dart' show TokenMap; | 19 import 'utilities_collection.dart' show TokenMap; |
| 21 import 'utilities_dart.dart'; | 20 import 'utilities_dart.dart'; |
| 22 | 21 |
| (...skipping 5231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5254 // VariableElement variable = (VariableElement) element; | 5253 // VariableElement variable = (VariableElement) element; |
| 5255 // if (variable.isStatic() && variable.isConst()) { | 5254 // if (variable.isStatic() && variable.isConst()) { |
| 5256 // //variable.getConstantValue(); | 5255 // //variable.getConstantValue(); |
| 5257 // } | 5256 // } |
| 5258 } | 5257 } |
| 5259 return NOT_A_CONSTANT; | 5258 return NOT_A_CONSTANT; |
| 5260 } | 5259 } |
| 5261 } | 5260 } |
| 5262 | 5261 |
| 5263 /** | 5262 /** |
| 5264 * Object representing a "const" instance creation expression, and its | |
| 5265 * evaluation result. This is used as the AnalysisTarget for constant | |
| 5266 * evaluation of instance creation expressions. | |
| 5267 */ | |
| 5268 class ConstantInstanceCreationHandle { | |
| 5269 /** | |
| 5270 * The result of evaluating the constant. | |
| 5271 */ | |
| 5272 EvaluationResultImpl evaluationResult; | |
| 5273 } | |
| 5274 | |
| 5275 /** | |
| 5276 * A constructor declaration. | 5263 * A constructor declaration. |
| 5277 * | 5264 * |
| 5278 * > constructorDeclaration ::= | 5265 * > constructorDeclaration ::= |
| 5279 * > constructorSignature [FunctionBody]? | 5266 * > constructorSignature [FunctionBody]? |
| 5280 * > | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier])
? arguments | 5267 * > | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier])
? arguments |
| 5281 * > | 5268 * > |
| 5282 * > constructorSignature ::= | 5269 * > constructorSignature ::= |
| 5283 * > 'external'? constructorName formalParameterList initializerList? | 5270 * > 'external'? constructorName formalParameterList initializerList? |
| 5284 * > | 'external'? 'factory' factoryName formalParameterList initializerList? | 5271 * > | 'external'? 'factory' factoryName formalParameterList initializerList? |
| 5285 * > | 'external'? 'const' constructorName formalParameterList initializerLis
t? | 5272 * > | 'external'? 'const' constructorName formalParameterList initializerLis
t? |
| (...skipping 5226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10512 ArgumentList _argumentList; | 10499 ArgumentList _argumentList; |
| 10513 | 10500 |
| 10514 /** | 10501 /** |
| 10515 * The element associated with the constructor based on static type | 10502 * The element associated with the constructor based on static type |
| 10516 * information, or `null` if the AST structure has not been resolved or if the | 10503 * information, or `null` if the AST structure has not been resolved or if the |
| 10517 * constructor could not be resolved. | 10504 * constructor could not be resolved. |
| 10518 */ | 10505 */ |
| 10519 ConstructorElement staticElement; | 10506 ConstructorElement staticElement; |
| 10520 | 10507 |
| 10521 /** | 10508 /** |
| 10522 * The [ConstantInstanceCreationHandle] holding the result of evaluating this | |
| 10523 * expression, if it is constant. | |
| 10524 */ | |
| 10525 ConstantInstanceCreationHandle constantHandle; | |
| 10526 | |
| 10527 /** | |
| 10528 * Initialize a newly created instance creation expression. | 10509 * Initialize a newly created instance creation expression. |
| 10529 */ | 10510 */ |
| 10530 InstanceCreationExpression(this.keyword, ConstructorName constructorName, | 10511 InstanceCreationExpression(this.keyword, ConstructorName constructorName, |
| 10531 ArgumentList argumentList) { | 10512 ArgumentList argumentList) { |
| 10532 _constructorName = _becomeParentOf(constructorName); | 10513 _constructorName = _becomeParentOf(constructorName); |
| 10533 _argumentList = _becomeParentOf(argumentList); | 10514 _argumentList = _becomeParentOf(argumentList); |
| 10534 } | 10515 } |
| 10535 | 10516 |
| 10536 /** | 10517 /** |
| 10537 * Return the list of arguments to the constructor. | 10518 * Return the list of arguments to the constructor. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 10563 * Set the name of the constructor to be invoked to the given [name]. | 10544 * Set the name of the constructor to be invoked to the given [name]. |
| 10564 */ | 10545 */ |
| 10565 void set constructorName(ConstructorName name) { | 10546 void set constructorName(ConstructorName name) { |
| 10566 _constructorName = _becomeParentOf(name); | 10547 _constructorName = _becomeParentOf(name); |
| 10567 } | 10548 } |
| 10568 | 10549 |
| 10569 @override | 10550 @override |
| 10570 Token get endToken => _argumentList.endToken; | 10551 Token get endToken => _argumentList.endToken; |
| 10571 | 10552 |
| 10572 /** | 10553 /** |
| 10573 * The result of evaluating this expression, if it is constant. | |
| 10574 */ | |
| 10575 EvaluationResultImpl get evaluationResult { | |
| 10576 if (constantHandle != null) { | |
| 10577 return constantHandle.evaluationResult; | |
| 10578 } | |
| 10579 return null; | |
| 10580 } | |
| 10581 | |
| 10582 /** | |
| 10583 * Return `true` if this creation expression is used to invoke a constant | 10554 * Return `true` if this creation expression is used to invoke a constant |
| 10584 * constructor. | 10555 * constructor. |
| 10585 */ | 10556 */ |
| 10586 bool get isConst => keyword is KeywordToken && | 10557 bool get isConst => keyword is KeywordToken && |
| 10587 (keyword as KeywordToken).keyword == Keyword.CONST; | 10558 (keyword as KeywordToken).keyword == Keyword.CONST; |
| 10588 | 10559 |
| 10589 @override | 10560 @override |
| 10590 int get precedence => 16; | 10561 int get precedence => 16; |
| 10591 | 10562 |
| 10592 @override | 10563 @override |
| (...skipping 9457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20050 } | 20021 } |
| 20051 | 20022 |
| 20052 @override | 20023 @override |
| 20053 accept(AstVisitor visitor) => visitor.visitYieldStatement(this); | 20024 accept(AstVisitor visitor) => visitor.visitYieldStatement(this); |
| 20054 | 20025 |
| 20055 @override | 20026 @override |
| 20056 void visitChildren(AstVisitor visitor) { | 20027 void visitChildren(AstVisitor visitor) { |
| 20057 _safelyVisitChild(_expression, visitor); | 20028 _safelyVisitChild(_expression, visitor); |
| 20058 } | 20029 } |
| 20059 } | 20030 } |
| OLD | NEW |