OLD | NEW |
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (right_val == NULL) { | 125 if (right_val == NULL) { |
126 return NULL; | 126 return NULL; |
127 } | 127 } |
128 switch (kind_) { | 128 switch (kind_) { |
129 case Token::kLT: | 129 case Token::kLT: |
130 case Token::kGT: | 130 case Token::kGT: |
131 case Token::kLTE: | 131 case Token::kLTE: |
132 case Token::kGTE: | 132 case Token::kGTE: |
133 if ((left_val->IsNumber() || left_val->IsNull()) && | 133 if ((left_val->IsNumber() || left_val->IsNull()) && |
134 (right_val->IsNumber() || right_val->IsNull())) { | 134 (right_val->IsNumber() || right_val->IsNull())) { |
135 return &Bool::ZoneHandle(Bool::False()); | 135 return &Bool::False(); |
136 } | 136 } |
137 return NULL; | 137 return NULL; |
138 case Token::kEQ: | 138 case Token::kEQ: |
139 case Token::kNE: | 139 case Token::kNE: |
140 case Token::kEQ_STRICT: | 140 case Token::kEQ_STRICT: |
141 case Token::kNE_STRICT: | 141 case Token::kNE_STRICT: |
142 // The comparison is a compile time const if both operands are either a | 142 // The comparison is a compile time const if both operands are either a |
143 // number, string, or boolean value (but not necessarily the same type). | 143 // number, string, or boolean value (but not necessarily the same type). |
144 if ((left_val->IsNumber() || | 144 if ((left_val->IsNumber() || |
145 left_val->IsString() || | 145 left_val->IsString() || |
146 left_val->IsBool() || | 146 left_val->IsBool() || |
147 left_val->IsNull()) && | 147 left_val->IsNull()) && |
148 (right_val->IsNumber() || | 148 (right_val->IsNumber() || |
149 right_val->IsString() || | 149 right_val->IsString() || |
150 right_val->IsBool() || | 150 right_val->IsBool() || |
151 right_val->IsNull())) { | 151 right_val->IsNull())) { |
152 return &Bool::ZoneHandle(Bool::False()); | 152 return &Bool::False(); |
153 } | 153 } |
154 return NULL; | 154 return NULL; |
155 default: | 155 default: |
156 return NULL; | 156 return NULL; |
157 } | 157 } |
158 return NULL; | 158 return NULL; |
159 } | 159 } |
160 | 160 |
161 | 161 |
162 | 162 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 if (result.IsError() || result.IsNull()) { | 434 if (result.IsError() || result.IsNull()) { |
435 // TODO(turnidge): We could get better error messages by returning | 435 // TODO(turnidge): We could get better error messages by returning |
436 // the Error object directly to the parser. This will involve | 436 // the Error object directly to the parser. This will involve |
437 // replumbing all of the EvalConstExpr methods. | 437 // replumbing all of the EvalConstExpr methods. |
438 return NULL; | 438 return NULL; |
439 } | 439 } |
440 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 440 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
441 } | 441 } |
442 | 442 |
443 } // namespace dart | 443 } // namespace dart |
OLD | NEW |