| 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 | 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 7654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7665 ParseType(ClassFinalizer::kFinalizeWellFormed)); | 7665 ParseType(ClassFinalizer::kFinalizeWellFormed)); |
| 7666 // Malformed bounds never result in a compile time error, therefore, the | 7666 // Malformed bounds never result in a compile time error, therefore, the |
| 7667 // parsed type may be malformed although we requested kFinalizeWellFormed. | 7667 // parsed type may be malformed although we requested kFinalizeWellFormed. |
| 7668 // In that case, we throw a dynamic type error instead of calling the | 7668 // In that case, we throw a dynamic type error instead of calling the |
| 7669 // constructor. | 7669 // constructor. |
| 7670 if (type.IsTypeParameter()) { | 7670 if (type.IsTypeParameter()) { |
| 7671 ErrorMsg(type_pos, | 7671 ErrorMsg(type_pos, |
| 7672 "type parameter '%s' cannot be instantiated", | 7672 "type parameter '%s' cannot be instantiated", |
| 7673 String::Handle(type.Name()).ToCString()); | 7673 String::Handle(type.Name()).ToCString()); |
| 7674 } | 7674 } |
| 7675 if (type.IsDynamicType()) { |
| 7676 ErrorMsg(type_pos, "Dynamic cannot be instantiated"); |
| 7677 } |
| 7675 Class& type_class = Class::Handle(type.type_class()); | 7678 Class& type_class = Class::Handle(type.type_class()); |
| 7676 String& type_class_name = String::Handle(type_class.Name()); | 7679 String& type_class_name = String::Handle(type_class.Name()); |
| 7677 AbstractTypeArguments& type_arguments = | 7680 AbstractTypeArguments& type_arguments = |
| 7678 AbstractTypeArguments::ZoneHandle(type.arguments()); | 7681 AbstractTypeArguments::ZoneHandle(type.arguments()); |
| 7679 | 7682 |
| 7680 // The constructor class and its name are those of the parsed type, unless the | 7683 // The constructor class and its name are those of the parsed type, unless the |
| 7681 // parsed type is an interface and a default factory class is specified, in | 7684 // parsed type is an interface and a default factory class is specified, in |
| 7682 // which case constructor_class and constructor_class_name are modified below. | 7685 // which case constructor_class and constructor_class_name are modified below. |
| 7683 Class& constructor_class = Class::ZoneHandle(type_class.raw()); | 7686 Class& constructor_class = Class::ZoneHandle(type_class.raw()); |
| 7684 String& constructor_class_name = String::Handle(type_class_name.raw()); | 7687 String& constructor_class_name = String::Handle(type_class_name.raw()); |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8431 void Parser::SkipQualIdent() { | 8434 void Parser::SkipQualIdent() { |
| 8432 ASSERT(IsIdentifier()); | 8435 ASSERT(IsIdentifier()); |
| 8433 ConsumeToken(); | 8436 ConsumeToken(); |
| 8434 if (CurrentToken() == Token::kPERIOD) { | 8437 if (CurrentToken() == Token::kPERIOD) { |
| 8435 ConsumeToken(); // Consume the kPERIOD token. | 8438 ConsumeToken(); // Consume the kPERIOD token. |
| 8436 ExpectIdentifier("identifier expected after '.'"); | 8439 ExpectIdentifier("identifier expected after '.'"); |
| 8437 } | 8440 } |
| 8438 } | 8441 } |
| 8439 | 8442 |
| 8440 } // namespace dart | 8443 } // namespace dart |
| OLD | NEW |