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

Side by Side Diff: pkg/analyzer/lib/src/generated/ast.dart

Issue 1050203002: Begin making copies of AST nodes for constants during resolution. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
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 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after
5302 // VariableElement variable = (VariableElement) element; 5302 // VariableElement variable = (VariableElement) element;
5303 // if (variable.isStatic() && variable.isConst()) { 5303 // if (variable.isStatic() && variable.isConst()) {
5304 // //variable.getConstantValue(); 5304 // //variable.getConstantValue();
5305 // } 5305 // }
5306 } 5306 }
5307 return NOT_A_CONSTANT; 5307 return NOT_A_CONSTANT;
5308 } 5308 }
5309 } 5309 }
5310 5310
5311 /** 5311 /**
5312 * Object representing a "const" instance creation expression, and its
5313 * evaluation result. This is used as the target for constant evaluation of
5314 * instance creation expressions.
5315 */
5316 class ConstantInstanceCreationHandle {
Brian Wilkerson 2015/04/01 20:31:54 Do you mean "target" as in AnalysisTarget? If so,
Paul Berry 2015/04/02 15:18:49 Yes, that was what I meant. I've changed the comm
5317 /**
5318 * The result of evaluating the constant.
5319 */
5320 EvaluationResultImpl evaluationResult;
5321 }
5322
5323 /**
5312 * A constructor declaration. 5324 * A constructor declaration.
5313 * 5325 *
5314 * > constructorDeclaration ::= 5326 * > constructorDeclaration ::=
5315 * > constructorSignature [FunctionBody]? 5327 * > constructorSignature [FunctionBody]?
5316 * > | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier]) ? arguments 5328 * > | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier]) ? arguments
5317 * > 5329 * >
5318 * > constructorSignature ::= 5330 * > constructorSignature ::=
5319 * > 'external'? constructorName formalParameterList initializerList? 5331 * > 'external'? constructorName formalParameterList initializerList?
5320 * > | 'external'? 'factory' factoryName formalParameterList initializerList? 5332 * > | 'external'? 'factory' factoryName formalParameterList initializerList?
5321 * > | 'external'? 'const' constructorName formalParameterList initializerLis t? 5333 * > | 'external'? 'const' constructorName formalParameterList initializerLis t?
(...skipping 5296 matching lines...) Expand 10 before | Expand all | Expand 10 after
10618 ArgumentList _argumentList; 10630 ArgumentList _argumentList;
10619 10631
10620 /** 10632 /**
10621 * The element associated with the constructor based on static type 10633 * The element associated with the constructor based on static type
10622 * information, or `null` if the AST structure has not been resolved or if the 10634 * information, or `null` if the AST structure has not been resolved or if the
10623 * constructor could not be resolved. 10635 * constructor could not be resolved.
10624 */ 10636 */
10625 ConstructorElement staticElement; 10637 ConstructorElement staticElement;
10626 10638
10627 /** 10639 /**
10628 * The result of evaluating this expression, if it is constant. 10640 * The [ConstantInstanceCreationHandle] holding the result of evaluating this
10641 * expression, if it is constant.
10629 */ 10642 */
10630 EvaluationResultImpl evaluationResult; 10643 ConstantInstanceCreationHandle constantHandle;
10631 10644
10632 /** 10645 /**
10633 * Initialize a newly created instance creation expression. 10646 * Initialize a newly created instance creation expression.
10634 */ 10647 */
10635 InstanceCreationExpression(this.keyword, ConstructorName constructorName, 10648 InstanceCreationExpression(this.keyword, ConstructorName constructorName,
10636 ArgumentList argumentList) { 10649 ArgumentList argumentList) {
10637 _constructorName = _becomeParentOf(constructorName); 10650 _constructorName = _becomeParentOf(constructorName);
10638 _argumentList = _becomeParentOf(argumentList); 10651 _argumentList = _becomeParentOf(argumentList);
10639 } 10652 }
10640 10653
(...skipping 27 matching lines...) Expand all
10668 * Set the name of the constructor to be invoked to the given [name]. 10681 * Set the name of the constructor to be invoked to the given [name].
10669 */ 10682 */
10670 void set constructorName(ConstructorName name) { 10683 void set constructorName(ConstructorName name) {
10671 _constructorName = _becomeParentOf(name); 10684 _constructorName = _becomeParentOf(name);
10672 } 10685 }
10673 10686
10674 @override 10687 @override
10675 Token get endToken => _argumentList.endToken; 10688 Token get endToken => _argumentList.endToken;
10676 10689
10677 /** 10690 /**
10691 * The result of evaluating this expression, if it is constant.
10692 */
10693 EvaluationResultImpl get evaluationResult {
10694 if (constantHandle != null) {
10695 return constantHandle.evaluationResult;
10696 }
10697 return null;
10698 }
10699
10700 /**
10678 * Return `true` if this creation expression is used to invoke a constant 10701 * Return `true` if this creation expression is used to invoke a constant
10679 * constructor. 10702 * constructor.
10680 */ 10703 */
10681 bool get isConst => keyword is KeywordToken && 10704 bool get isConst => keyword is KeywordToken &&
10682 (keyword as KeywordToken).keyword == Keyword.CONST; 10705 (keyword as KeywordToken).keyword == Keyword.CONST;
10683 10706
10684 @override 10707 @override
10685 int get precedence => 16; 10708 int get precedence => 16;
10686 10709
10687 @override 10710 @override
(...skipping 9434 matching lines...) Expand 10 before | Expand all | Expand 10 after
20122 } 20145 }
20123 20146
20124 @override 20147 @override
20125 accept(AstVisitor visitor) => visitor.visitYieldStatement(this); 20148 accept(AstVisitor visitor) => visitor.visitYieldStatement(this);
20126 20149
20127 @override 20150 @override
20128 void visitChildren(AstVisitor visitor) { 20151 void visitChildren(AstVisitor visitor) {
20129 _safelyVisitChild(_expression, visitor); 20152 _safelyVisitChild(_expression, visitor);
20130 } 20153 }
20131 } 20154 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/constant.dart » ('j') | pkg/analyzer/lib/src/generated/constant.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698