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

Side by Side Diff: vm/ast.cc

Issue 10693092: Remove unused code for StringConcatNode from the AST and the graph builder. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « vm/ast.h ('k') | vm/ast_printer.cc » ('j') | 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 10
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return false; 176 return false;
177 } 177 }
178 } 178 }
179 179
180 180
181 const char* BinaryOpNode::Name() const { 181 const char* BinaryOpNode::Name() const {
182 return Token::Str(kind_); 182 return Token::Str(kind_);
183 } 183 }
184 184
185 185
186 const Instance* StringConcatNode::EvalConstExpr() const {
187 for (int i = 0; i < values()->length(); i++) {
188 if (!values()->ElementAt(i)->IsLiteralNode()) {
189 return NULL;
190 }
191 }
192 // All nodes are literals, so this is a compile time constant string.
193 // We just return the first literal as value approximation.
194 return &values()->ElementAt(0)->AsLiteralNode()->literal();
195 }
196
197
198 const Instance* BinaryOpNode::EvalConstExpr() const { 186 const Instance* BinaryOpNode::EvalConstExpr() const {
199 const Instance* left_val = this->left()->EvalConstExpr(); 187 const Instance* left_val = this->left()->EvalConstExpr();
200 if (left_val == NULL) { 188 if (left_val == NULL) {
201 return NULL; 189 return NULL;
202 } 190 }
203 if (!left_val->IsNumber() && !left_val->IsBool()) { 191 if (!left_val->IsNumber() && !left_val->IsBool()) {
204 return NULL; 192 return NULL;
205 } 193 }
206 const Instance* right_val = this->right()->EvalConstExpr(); 194 const Instance* right_val = this->right()->EvalConstExpr();
207 if (right_val == NULL) { 195 if (right_val == NULL) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 if (result.IsError() || result.IsNull()) { 368 if (result.IsError() || result.IsNull()) {
381 // TODO(turnidge): We could get better error messages by returning 369 // TODO(turnidge): We could get better error messages by returning
382 // the Error object directly to the parser. This will involve 370 // the Error object directly to the parser. This will involve
383 // replumbing all of the EvalConstExpr methods. 371 // replumbing all of the EvalConstExpr methods.
384 return NULL; 372 return NULL;
385 } 373 }
386 return &Instance::ZoneHandle(Instance::Cast(result).raw()); 374 return &Instance::ZoneHandle(Instance::Cast(result).raw());
387 } 375 }
388 376
389 } // namespace dart 377 } // namespace dart
OLDNEW
« no previous file with comments | « vm/ast.h ('k') | vm/ast_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698