Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/parser.h" | 5 #include "vm/parser.h" |
| 6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED | 8 #ifndef DART_PRECOMPILED |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 10484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10495 old->token_pos(), old->kind(), old->left(), old->right(), val); | 10495 old->token_pos(), old->kind(), old->left(), old->right(), val); |
| 10496 return binop; | 10496 return binop; |
| 10497 } | 10497 } |
| 10498 } | 10498 } |
| 10499 } | 10499 } |
| 10500 } | 10500 } |
| 10501 if (binary_op == Token::kIFNULL) { | 10501 if (binary_op == Token::kIFNULL) { |
| 10502 // Handle a ?? b. | 10502 // Handle a ?? b. |
| 10503 LetNode* result = new(Z) LetNode(op_pos); | 10503 LetNode* result = new(Z) LetNode(op_pos); |
| 10504 LocalVariable* left_temp = result->AddInitializer(lhs); | 10504 LocalVariable* left_temp = result->AddInitializer(lhs); |
| 10505 left_temp->set_is_final(); | |
| 10506 if ((lhs->IsPotentiallyConst()) && (lhs->EvalConstExpr() != NULL)) { | |
|
hausner
2016/01/12 20:46:47
The first test, IsPotentiallyConst(), is not neede
hausner
2016/01/12 21:48:35
On second thought: you also need to check that rhs
Lasse Reichstein Nielsen
2016/01/13 13:40:35
Done.
I still set left_temp to final below becaus
| |
| 10507 Instance& expr_value = Instance::ZoneHandle(Z); | |
| 10508 intptr_t lhs_pos = lhs->token_pos(); | |
| 10509 if (!GetCachedConstant(lhs_pos, &expr_value)) { | |
| 10510 expr_value = EvaluateConstExpr(lhs_pos, lhs).raw(); | |
| 10511 CacheConstantValue(lhs_pos, expr_value); | |
| 10512 } | |
| 10513 left_temp->SetConstValue(expr_value); | |
| 10514 } | |
| 10505 const intptr_t no_pos = Scanner::kNoSourcePos; | 10515 const intptr_t no_pos = Scanner::kNoSourcePos; |
| 10506 LiteralNode* null_operand = | 10516 LiteralNode* null_operand = |
| 10507 new(Z) LiteralNode(no_pos, Object::null_instance()); | 10517 new(Z) LiteralNode(no_pos, Object::null_instance()); |
| 10508 LoadLocalNode* load_left_temp = new(Z) LoadLocalNode(no_pos, left_temp); | 10518 LoadLocalNode* load_left_temp = new(Z) LoadLocalNode(no_pos, left_temp); |
| 10509 ComparisonNode* null_compare = | 10519 ComparisonNode* null_compare = |
| 10510 new(Z) ComparisonNode(no_pos, | 10520 new(Z) ComparisonNode(no_pos, |
| 10511 Token::kNE_STRICT, | 10521 Token::kNE_STRICT, |
| 10512 load_left_temp, | 10522 load_left_temp, |
| 10513 null_operand); | 10523 null_operand); |
| 10514 result->AddNode(new(Z) ConditionalExprNode(op_pos, | 10524 result->AddNode(new(Z) ConditionalExprNode(op_pos, |
| (...skipping 3871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14386 const ArgumentListNode& function_args, | 14396 const ArgumentListNode& function_args, |
| 14387 const LocalVariable* temp_for_last_arg, | 14397 const LocalVariable* temp_for_last_arg, |
| 14388 bool is_super_invocation) { | 14398 bool is_super_invocation) { |
| 14389 UNREACHABLE(); | 14399 UNREACHABLE(); |
| 14390 return NULL; | 14400 return NULL; |
| 14391 } | 14401 } |
| 14392 | 14402 |
| 14393 } // namespace dart | 14403 } // namespace dart |
| 14394 | 14404 |
| 14395 #endif // DART_PRECOMPILED | 14405 #endif // DART_PRECOMPILED |
| OLD | NEW |