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

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

Issue 10944041: Ensure that parser throws an error when parsing x is! T with malformed type T. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: make test positive Created 8 years, 3 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/isnot_malformed_type_test.dart » ('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 "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 6566 matching lines...) Expand 10 before | Expand all | Expand 10 after
6577 } 6577 }
6578 const intptr_t type_pos = TokenPos(); 6578 const intptr_t type_pos = TokenPos();
6579 const AbstractType& type = 6579 const AbstractType& type =
6580 AbstractType::ZoneHandle(ParseType(ClassFinalizer::kCanonicalize)); 6580 AbstractType::ZoneHandle(ParseType(ClassFinalizer::kCanonicalize));
6581 if (!type.IsInstantiated() && 6581 if (!type.IsInstantiated() &&
6582 (current_block_->scope->function_level() > 0)) { 6582 (current_block_->scope->function_level() > 0)) {
6583 // Make sure that the instantiator is captured. 6583 // Make sure that the instantiator is captured.
6584 CaptureInstantiator(); 6584 CaptureInstantiator();
6585 } 6585 }
6586 right_operand = new TypeNode(type_pos, type); 6586 right_operand = new TypeNode(type_pos, type);
6587 if ((op_kind == Token::kIS) && type.IsMalformed()) { 6587 if (((op_kind == Token::kIS) || (op_kind == Token::kISNOT)) &&
6588 type.IsMalformed()) {
6588 // Note that a type error is thrown even if the tested value is null 6589 // Note that a type error is thrown even if the tested value is null
6589 // in a type test. However, no cast exception is thrown if the value 6590 // in a type test. However, no cast exception is thrown if the value
6590 // is null in a type cast. 6591 // is null in a type cast.
6591 return ThrowTypeError(type_pos, type); 6592 return ThrowTypeError(type_pos, type);
6592 } 6593 }
6593 } 6594 }
6594 if (Token::IsRelationalOperator(op_kind) 6595 if (Token::IsRelationalOperator(op_kind)
6595 || Token::IsTypeTestOperator(op_kind) 6596 || Token::IsTypeTestOperator(op_kind)
6596 || Token::IsTypeCastOperator(op_kind) 6597 || Token::IsTypeCastOperator(op_kind)
6597 || Token::IsEqualityOperator(op_kind)) { 6598 || Token::IsEqualityOperator(op_kind)) {
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after
9509 void Parser::SkipQualIdent() { 9510 void Parser::SkipQualIdent() {
9510 ASSERT(IsIdentifier()); 9511 ASSERT(IsIdentifier());
9511 ConsumeToken(); 9512 ConsumeToken();
9512 if (CurrentToken() == Token::kPERIOD) { 9513 if (CurrentToken() == Token::kPERIOD) {
9513 ConsumeToken(); // Consume the kPERIOD token. 9514 ConsumeToken(); // Consume the kPERIOD token.
9514 ExpectIdentifier("identifier expected after '.'"); 9515 ExpectIdentifier("identifier expected after '.'");
9515 } 9516 }
9516 } 9517 }
9517 9518
9518 } // namespace dart 9519 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/isnot_malformed_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698