| 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/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 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2871 Token::Kind token = CurrentToken(); | 2871 Token::Kind token = CurrentToken(); |
| 2872 if ((token == Token::kGT) || | 2872 if ((token == Token::kGT) || |
| 2873 (token == Token::kSAR) || | 2873 (token == Token::kSAR) || |
| 2874 (token == Token::kSHR)) { | 2874 (token == Token::kSHR)) { |
| 2875 ConsumeRightAngleBracket(); | 2875 ConsumeRightAngleBracket(); |
| 2876 } else { | 2876 } else { |
| 2877 ErrorMsg("right angle bracket expected"); | 2877 ErrorMsg("right angle bracket expected"); |
| 2878 } | 2878 } |
| 2879 return NewTypeArray(types); | 2879 return NewTypeArray(types); |
| 2880 } | 2880 } |
| 2881 return TypeArguments::null(); | 2881 return TypeArray::null(); |
| 2882 } | 2882 } |
| 2883 | 2883 |
| 2884 | 2884 |
| 2885 // Parse and return an array of interface types. | 2885 // Parse and return an array of interface types. |
| 2886 RawArray* Parser::ParseInterfaceList() { | 2886 RawArray* Parser::ParseInterfaceList() { |
| 2887 ASSERT((CurrentToken() == Token::kIMPLEMENTS) || | 2887 ASSERT((CurrentToken() == Token::kIMPLEMENTS) || |
| 2888 (CurrentToken() == Token::kEXTENDS)); | 2888 (CurrentToken() == Token::kEXTENDS)); |
| 2889 GrowableArray<Type*> interfaces; | 2889 GrowableArray<Type*> interfaces; |
| 2890 do { | 2890 do { |
| 2891 ConsumeToken(); | 2891 ConsumeToken(); |
| (...skipping 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6032 const UnresolvedClass& unresolved_class = | 6032 const UnresolvedClass& unresolved_class = |
| 6033 UnresolvedClass::Handle(type->unresolved_class()); | 6033 UnresolvedClass::Handle(type->unresolved_class()); |
| 6034 const String& unresolved_class_name = | 6034 const String& unresolved_class_name = |
| 6035 String::Handle(unresolved_class.ident()); | 6035 String::Handle(unresolved_class.ident()); |
| 6036 // First check if the type is a type parameter of the given class. | 6036 // First check if the type is a type parameter of the given class. |
| 6037 const TypeParameter& type_parameter = TypeParameter::Handle( | 6037 const TypeParameter& type_parameter = TypeParameter::Handle( |
| 6038 cls.LookupTypeParameter(unresolved_class_name)); | 6038 cls.LookupTypeParameter(unresolved_class_name)); |
| 6039 if (!type_parameter.IsNull()) { | 6039 if (!type_parameter.IsNull()) { |
| 6040 // A type parameter cannot be parameterized, so report an error if type | 6040 // A type parameter cannot be parameterized, so report an error if type |
| 6041 // arguments have previously been parsed. | 6041 // arguments have previously been parsed. |
| 6042 if (type->arguments() != TypeArguments::null()) { | 6042 if (!TypeArguments::Handle(type->arguments()).IsNull()) { |
| 6043 ErrorMsg(type_pos, "type parameter '%s' cannot be parameterized", | 6043 ErrorMsg(type_pos, "type parameter '%s' cannot be parameterized", |
| 6044 type_parameter.ToCString()); | 6044 type_parameter.ToCString()); |
| 6045 } | 6045 } |
| 6046 *type = type_parameter.raw(); | 6046 *type = type_parameter.raw(); |
| 6047 return; | 6047 return; |
| 6048 } | 6048 } |
| 6049 const Class& resolved_type_class = | 6049 const Class& resolved_type_class = |
| 6050 Class::Handle(LookupClass(unresolved_class_name)); | 6050 Class::Handle(LookupClass(unresolved_class_name)); |
| 6051 if (!resolved_type_class.IsNull()) { | 6051 if (!resolved_type_class.IsNull()) { |
| 6052 Object& type_class = Object::Handle(resolved_type_class.raw()); | 6052 Object& type_class = Object::Handle(resolved_type_class.raw()); |
| (...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7582 } | 7582 } |
| 7583 | 7583 |
| 7584 | 7584 |
| 7585 void Parser::SkipNestedExpr() { | 7585 void Parser::SkipNestedExpr() { |
| 7586 const bool saved_mode = SetAllowFunctionLiterals(true); | 7586 const bool saved_mode = SetAllowFunctionLiterals(true); |
| 7587 SkipExpr(); | 7587 SkipExpr(); |
| 7588 SetAllowFunctionLiterals(saved_mode); | 7588 SetAllowFunctionLiterals(saved_mode); |
| 7589 } | 7589 } |
| 7590 | 7590 |
| 7591 } // namespace dart | 7591 } // namespace dart |
| OLD | NEW |