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

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

Issue 185553018: Always evaluate e in (e is T) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 | « no previous file | tests/language/language.status » ('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) 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 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 7590 matching lines...) Expand 10 before | Expand all | Expand 10 after
7601 (current_block_->scope->function_level() > 0)) { 7601 (current_block_->scope->function_level() > 0)) {
7602 // Make sure that the instantiator is captured. 7602 // Make sure that the instantiator is captured.
7603 CaptureInstantiator(); 7603 CaptureInstantiator();
7604 } 7604 }
7605 right_operand = new TypeNode(type_pos, type); 7605 right_operand = new TypeNode(type_pos, type);
7606 // In production mode, the type may be malformed. 7606 // In production mode, the type may be malformed.
7607 // In checked mode, the type may be malformed or malbounded. 7607 // In checked mode, the type may be malformed or malbounded.
7608 if (((op_kind == Token::kIS) || (op_kind == Token::kISNOT) || 7608 if (((op_kind == Token::kIS) || (op_kind == Token::kISNOT) ||
7609 (op_kind == Token::kAS)) && 7609 (op_kind == Token::kAS)) &&
7610 type.IsMalformedOrMalbounded()) { 7610 type.IsMalformedOrMalbounded()) {
7611 // Note that a type error is thrown even if the tested value is null 7611 // Note that a type error is thrown in a type test or in
7612 // in a type test or in a type cast. 7612 // a type cast even if the tested value is null.
7613 // TODO(hausner): We drop the left operand. We need to 7613 // We need to evaluate the left operand for potential
7614 // evaluate it in case there are side effects. 7614 // side effects.
7615 left_operand = ThrowTypeError(type_pos, type); 7615 LetNode* let = new LetNode(left_operand->token_pos());
7616 let->AddNode(left_operand);
7617 let->AddNode(ThrowTypeError(type_pos, type));
7618 left_operand = let;
7616 break; // Type checks and casts can't be chained. 7619 break; // Type checks and casts can't be chained.
7617 } 7620 }
7618 } 7621 }
7619 if (Token::IsRelationalOperator(op_kind) 7622 if (Token::IsRelationalOperator(op_kind)
7620 || Token::IsTypeTestOperator(op_kind) 7623 || Token::IsTypeTestOperator(op_kind)
7621 || Token::IsTypeCastOperator(op_kind) 7624 || Token::IsTypeCastOperator(op_kind)
7622 || Token::IsEqualityOperator(op_kind)) { 7625 || Token::IsEqualityOperator(op_kind)) {
7623 if (Token::IsTypeTestOperator(op_kind) || 7626 if (Token::IsTypeTestOperator(op_kind) ||
7624 Token::IsTypeCastOperator(op_kind)) { 7627 Token::IsTypeCastOperator(op_kind)) {
7625 if (!right_operand->AsTypeNode()->type().IsInstantiated()) { 7628 if (!right_operand->AsTypeNode()->type().IsInstantiated()) {
(...skipping 3159 matching lines...) Expand 10 before | Expand all | Expand 10 after
10785 void Parser::SkipQualIdent() { 10788 void Parser::SkipQualIdent() {
10786 ASSERT(IsIdentifier()); 10789 ASSERT(IsIdentifier());
10787 ConsumeToken(); 10790 ConsumeToken();
10788 if (CurrentToken() == Token::kPERIOD) { 10791 if (CurrentToken() == Token::kPERIOD) {
10789 ConsumeToken(); // Consume the kPERIOD token. 10792 ConsumeToken(); // Consume the kPERIOD token.
10790 ExpectIdentifier("identifier expected after '.'"); 10793 ExpectIdentifier("identifier expected after '.'");
10791 } 10794 }
10792 } 10795 }
10793 10796
10794 } // namespace dart 10797 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698