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

Side by Side Diff: runtime/vm/ast.cc

Issue 1455213002: Handle potentially const interpolation (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/ast.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #include "vm/ast.h" 5 #include "vm/ast.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "vm/dart_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 #include "vm/resolver.h" 10 #include "vm/resolver.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 117
118 void ArrayNode::VisitChildren(AstNodeVisitor* visitor) const { 118 void ArrayNode::VisitChildren(AstNodeVisitor* visitor) const {
119 for (intptr_t i = 0; i < this->length(); i++) { 119 for (intptr_t i = 0; i < this->length(); i++) {
120 ElementAt(i)->Visit(visitor); 120 ElementAt(i)->Visit(visitor);
121 } 121 }
122 } 122 }
123 123
124 124
125 bool StringInterpolateNode::IsPotentiallyConst() const {
126 for (int i = 0; i < value_->length(); i++) {
127 if (!value_->ElementAt(i)->IsPotentiallyConst()) {
128 return false;
129 }
130 }
131 return true;
132 }
133
134
125 bool LiteralNode::IsPotentiallyConst() const { 135 bool LiteralNode::IsPotentiallyConst() const {
126 return true; 136 return true;
127 } 137 }
128 138
129 139
130 AstNode* LiteralNode::ApplyUnaryOp(Token::Kind unary_op_kind) { 140 AstNode* LiteralNode::ApplyUnaryOp(Token::Kind unary_op_kind) {
131 if (unary_op_kind == Token::kNEGATE) { 141 if (unary_op_kind == Token::kNEGATE) {
132 if (literal().IsSmi()) { 142 if (literal().IsSmi()) {
133 const Smi& smi = Smi::Cast(literal()); 143 const Smi& smi = Smi::Cast(literal());
134 const Instance& literal = 144 const Instance& literal =
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 if (result.IsError() || result.IsNull()) { 773 if (result.IsError() || result.IsNull()) {
764 // TODO(turnidge): We could get better error messages by returning 774 // TODO(turnidge): We could get better error messages by returning
765 // the Error object directly to the parser. This will involve 775 // the Error object directly to the parser. This will involve
766 // replumbing all of the EvalConstExpr methods. 776 // replumbing all of the EvalConstExpr methods.
767 return NULL; 777 return NULL;
768 } 778 }
769 return &Instance::ZoneHandle(Instance::Cast(result).raw()); 779 return &Instance::ZoneHandle(Instance::Cast(result).raw());
770 } 780 }
771 781
772 } // namespace dart 782 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698