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 "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 2820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 ASSERT(!func.is_const()); // Closure functions cannot be const. | 2831 ASSERT(!func.is_const()); // Closure functions cannot be const. |
2832 params.AddFinalParameter( | 2832 params.AddFinalParameter( |
2833 TokenPos(), | 2833 TokenPos(), |
2834 &Symbols::ClosureParameter(), | 2834 &Symbols::ClosureParameter(), |
2835 &Type::ZoneHandle(Type::DynamicType())); | 2835 &Type::ZoneHandle(Type::DynamicType())); |
2836 } else if (!func.is_static()) { | 2836 } else if (!func.is_static()) { |
2837 // Static functions do not have a receiver. | 2837 // Static functions do not have a receiver. |
2838 ASSERT(current_class().raw() == func.Owner()); | 2838 ASSERT(current_class().raw() == func.Owner()); |
2839 params.AddReceiver(ReceiverType(current_class()), func.token_pos()); | 2839 params.AddReceiver(ReceiverType(current_class()), func.token_pos()); |
2840 } else if (func.IsFactory()) { | 2840 } else if (func.IsFactory()) { |
2841 // The first parameter of a factory is the AbstractTypeArguments vector of | 2841 // The first parameter of a factory is the TypeArguments vector of |
2842 // the type of the instance to be allocated. | 2842 // the type of the instance to be allocated. |
2843 params.AddFinalParameter( | 2843 params.AddFinalParameter( |
2844 TokenPos(), | 2844 TokenPos(), |
2845 &Symbols::TypeArgumentsParameter(), | 2845 &Symbols::TypeArgumentsParameter(), |
2846 &Type::ZoneHandle(Type::DynamicType())); | 2846 &Type::ZoneHandle(Type::DynamicType())); |
2847 } | 2847 } |
2848 ASSERT((CurrentToken() == Token::kLPAREN) || func.IsGetterFunction()); | 2848 ASSERT((CurrentToken() == Token::kLPAREN) || func.IsGetterFunction()); |
2849 const bool allow_explicit_default_values = true; | 2849 const bool allow_explicit_default_values = true; |
2850 if (func.IsGetterFunction()) { | 2850 if (func.IsGetterFunction()) { |
2851 // Populate function scope with the formal parameters. Since in this case | 2851 // Populate function scope with the formal parameters. Since in this case |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3099 if (method->has_const && method->IsConstructor()) { | 3099 if (method->has_const && method->IsConstructor()) { |
3100 current_class().set_is_const(); | 3100 current_class().set_is_const(); |
3101 } | 3101 } |
3102 | 3102 |
3103 // Parse the formal parameters. | 3103 // Parse the formal parameters. |
3104 const bool are_implicitly_final = method->has_const; | 3104 const bool are_implicitly_final = method->has_const; |
3105 const bool allow_explicit_default_values = true; | 3105 const bool allow_explicit_default_values = true; |
3106 const intptr_t formal_param_pos = TokenPos(); | 3106 const intptr_t formal_param_pos = TokenPos(); |
3107 method->params.Clear(); | 3107 method->params.Clear(); |
3108 // Static functions do not have a receiver. | 3108 // Static functions do not have a receiver. |
3109 // The first parameter of a factory is the AbstractTypeArguments vector of | 3109 // The first parameter of a factory is the TypeArguments vector of |
3110 // the type of the instance to be allocated. | 3110 // the type of the instance to be allocated. |
3111 if (!method->has_static || method->IsConstructor()) { | 3111 if (!method->has_static || method->IsConstructor()) { |
3112 method->params.AddReceiver(ReceiverType(current_class()), formal_param_pos); | 3112 method->params.AddReceiver(ReceiverType(current_class()), formal_param_pos); |
3113 } else if (method->IsFactory()) { | 3113 } else if (method->IsFactory()) { |
3114 method->params.AddFinalParameter( | 3114 method->params.AddFinalParameter( |
3115 formal_param_pos, | 3115 formal_param_pos, |
3116 &Symbols::TypeArgumentsParameter(), | 3116 &Symbols::TypeArgumentsParameter(), |
3117 &Type::ZoneHandle(Type::DynamicType())); | 3117 &Type::ZoneHandle(Type::DynamicType())); |
3118 } | 3118 } |
3119 // Constructors have an implicit parameter for the construction phase. | 3119 // Constructors have an implicit parameter for the construction phase. |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4440 type_parameter_bound = type_parameter.bound(); | 4440 type_parameter_bound = type_parameter.bound(); |
4441 ResolveTypeFromClass(cls, | 4441 ResolveTypeFromClass(cls, |
4442 ClassFinalizer::kResolveTypeParameters, | 4442 ClassFinalizer::kResolveTypeParameters, |
4443 &type_parameter_bound); | 4443 &type_parameter_bound); |
4444 type_parameter.set_bound(type_parameter_bound); | 4444 type_parameter.set_bound(type_parameter_bound); |
4445 } | 4445 } |
4446 } | 4446 } |
4447 } | 4447 } |
4448 | 4448 |
4449 | 4449 |
4450 RawAbstractTypeArguments* Parser::ParseTypeArguments( | 4450 RawTypeArguments* Parser::ParseTypeArguments( |
4451 ClassFinalizer::FinalizationKind finalization) { | 4451 ClassFinalizer::FinalizationKind finalization) { |
4452 TRACE_PARSER("ParseTypeArguments"); | 4452 TRACE_PARSER("ParseTypeArguments"); |
4453 if (CurrentToken() == Token::kLT) { | 4453 if (CurrentToken() == Token::kLT) { |
4454 const GrowableObjectArray& types = | 4454 const GrowableObjectArray& types = |
4455 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 4455 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
4456 AbstractType& type = AbstractType::Handle(); | 4456 AbstractType& type = AbstractType::Handle(); |
4457 do { | 4457 do { |
4458 ConsumeToken(); | 4458 ConsumeToken(); |
4459 type = ParseType(finalization); | 4459 type = ParseType(finalization); |
4460 // Map a malformed type argument to dynamic. | 4460 // Map a malformed type argument to dynamic. |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5719 | 5719 |
5720 // Make sure that the instantiator is captured. | 5720 // Make sure that the instantiator is captured. |
5721 if ((signature_class.NumTypeParameters() > 0) && | 5721 if ((signature_class.NumTypeParameters() > 0) && |
5722 (current_block_->scope->function_level() > 0)) { | 5722 (current_block_->scope->function_level() > 0)) { |
5723 CaptureInstantiator(); | 5723 CaptureInstantiator(); |
5724 } | 5724 } |
5725 | 5725 |
5726 // Since the signature type is cached by the signature class, it may have | 5726 // Since the signature type is cached by the signature class, it may have |
5727 // been finalized already. | 5727 // been finalized already. |
5728 Type& signature_type = Type::Handle(signature_class.SignatureType()); | 5728 Type& signature_type = Type::Handle(signature_class.SignatureType()); |
5729 AbstractTypeArguments& signature_type_arguments = | 5729 TypeArguments& signature_type_arguments = |
5730 AbstractTypeArguments::Handle(signature_type.arguments()); | 5730 TypeArguments::Handle(signature_type.arguments()); |
5731 | 5731 |
5732 if (!signature_type.IsFinalized()) { | 5732 if (!signature_type.IsFinalized()) { |
5733 signature_type ^= ClassFinalizer::FinalizeType( | 5733 signature_type ^= ClassFinalizer::FinalizeType( |
5734 signature_class, signature_type, ClassFinalizer::kCanonicalize); | 5734 signature_class, signature_type, ClassFinalizer::kCanonicalize); |
5735 | 5735 |
5736 // The call to ClassFinalizer::FinalizeType may have | 5736 // The call to ClassFinalizer::FinalizeType may have |
5737 // extended the vector of type arguments. | 5737 // extended the vector of type arguments. |
5738 signature_type_arguments = signature_type.arguments(); | 5738 signature_type_arguments = signature_type.arguments(); |
5739 ASSERT(signature_type_arguments.IsNull() || | 5739 ASSERT(signature_type_arguments.IsNull() || |
5740 (signature_type_arguments.Length() == | 5740 (signature_type_arguments.Length() == |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5834 // Assigning null never causes a type error. | 5834 // Assigning null never causes a type error. |
5835 if (CurrentToken() == Token::kNULL) { | 5835 if (CurrentToken() == Token::kNULL) { |
5836 *value = Instance::null(); | 5836 *value = Instance::null(); |
5837 return true; | 5837 return true; |
5838 } | 5838 } |
5839 // If the type of the const field is guaranteed to be instantiated once | 5839 // If the type of the const field is guaranteed to be instantiated once |
5840 // resolved at class finalization time, and if the type of the literal is one | 5840 // resolved at class finalization time, and if the type of the literal is one |
5841 // of int, double, String, or bool, then preset the field with the value and | 5841 // of int, double, String, or bool, then preset the field with the value and |
5842 // perform the type check (in checked mode only) at finalization time. | 5842 // perform the type check (in checked mode only) at finalization time. |
5843 if (type.IsTypeParameter() || | 5843 if (type.IsTypeParameter() || |
5844 (type.arguments() != AbstractTypeArguments::null())) { | 5844 (type.arguments() != TypeArguments::null())) { |
5845 // Type parameters are always resolved eagerly by the parser and never | 5845 // Type parameters are always resolved eagerly by the parser and never |
5846 // resolved later by the class finalizer. Therefore, we know here that if | 5846 // resolved later by the class finalizer. Therefore, we know here that if |
5847 // 'type' is not a type parameter (an unresolved type will not get resolved | 5847 // 'type' is not a type parameter (an unresolved type will not get resolved |
5848 // to a type parameter later) and if 'type' has no type arguments, then it | 5848 // to a type parameter later) and if 'type' has no type arguments, then it |
5849 // will be instantiated at class finalization time. Otherwise, we return | 5849 // will be instantiated at class finalization time. Otherwise, we return |
5850 // false, since the type test would not be possible at finalization time for | 5850 // false, since the type test would not be possible at finalization time for |
5851 // an uninstantiated type. | 5851 // an uninstantiated type. |
5852 return false; | 5852 return false; |
5853 } | 5853 } |
5854 if (CurrentToken() == Token::kINTEGER) { | 5854 if (CurrentToken() == Token::kINTEGER) { |
(...skipping 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8695 Error::Handle(), // No previous error. | 8695 Error::Handle(), // No previous error. |
8696 script_, | 8696 script_, |
8697 type->token_pos(), | 8697 type->token_pos(), |
8698 "type parameter '%s' cannot be referenced " | 8698 "type parameter '%s' cannot be referenced " |
8699 "from static member", | 8699 "from static member", |
8700 String::Handle(type_parameter.name()).ToCString()); | 8700 String::Handle(type_parameter.name()).ToCString()); |
8701 return; | 8701 return; |
8702 } | 8702 } |
8703 // A type parameter cannot be parameterized, so make the type | 8703 // A type parameter cannot be parameterized, so make the type |
8704 // malformed if type arguments have previously been parsed. | 8704 // malformed if type arguments have previously been parsed. |
8705 if (!AbstractTypeArguments::Handle(type->arguments()).IsNull()) { | 8705 if (!TypeArguments::Handle(type->arguments()).IsNull()) { |
8706 *type = ClassFinalizer::NewFinalizedMalformedType( | 8706 *type = ClassFinalizer::NewFinalizedMalformedType( |
8707 Error::Handle(), // No previous error. | 8707 Error::Handle(), // No previous error. |
8708 script_, | 8708 script_, |
8709 type_parameter.token_pos(), | 8709 type_parameter.token_pos(), |
8710 "type parameter '%s' cannot be parameterized", | 8710 "type parameter '%s' cannot be parameterized", |
8711 String::Handle(type_parameter.name()).ToCString()); | 8711 String::Handle(type_parameter.name()).ToCString()); |
8712 return; | 8712 return; |
8713 } | 8713 } |
8714 *type = type_parameter.raw(); | 8714 *type = type_parameter.raw(); |
8715 return; | 8715 return; |
(...skipping 22 matching lines...) Expand all Loading... |
8738 ClassFinalizer::FinalizeMalformedType( | 8738 ClassFinalizer::FinalizeMalformedType( |
8739 Error::Handle(), // No previous error. | 8739 Error::Handle(), // No previous error. |
8740 script_, | 8740 script_, |
8741 parameterized_type, | 8741 parameterized_type, |
8742 "type '%s' is not loaded", | 8742 "type '%s' is not loaded", |
8743 String::Handle(parameterized_type.UserVisibleName()).ToCString()); | 8743 String::Handle(parameterized_type.UserVisibleName()).ToCString()); |
8744 return; | 8744 return; |
8745 } | 8745 } |
8746 } | 8746 } |
8747 // Resolve type arguments, if any. | 8747 // Resolve type arguments, if any. |
8748 const AbstractTypeArguments& arguments = | 8748 const TypeArguments& arguments = TypeArguments::Handle(type->arguments()); |
8749 AbstractTypeArguments::Handle(type->arguments()); | 8749 TypeArguments::Handle(type->arguments()); |
8750 if (!arguments.IsNull()) { | 8750 if (!arguments.IsNull()) { |
8751 const intptr_t num_arguments = arguments.Length(); | 8751 const intptr_t num_arguments = arguments.Length(); |
8752 for (intptr_t i = 0; i < num_arguments; i++) { | 8752 for (intptr_t i = 0; i < num_arguments; i++) { |
8753 AbstractType& type_argument = AbstractType::Handle(arguments.TypeAt(i)); | 8753 AbstractType& type_argument = AbstractType::Handle(arguments.TypeAt(i)); |
8754 ResolveTypeFromClass(scope_class, finalization, &type_argument); | 8754 ResolveTypeFromClass(scope_class, finalization, &type_argument); |
8755 arguments.SetTypeAt(i, type_argument); | 8755 arguments.SetTypeAt(i, type_argument); |
8756 } | 8756 } |
8757 } | 8757 } |
8758 } | 8758 } |
8759 | 8759 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8917 return new StaticGetterNode(field_ref_pos, | 8917 return new StaticGetterNode(field_ref_pos, |
8918 NULL, | 8918 NULL, |
8919 false, | 8919 false, |
8920 field_owner, | 8920 field_owner, |
8921 field_name); | 8921 field_name); |
8922 } | 8922 } |
8923 | 8923 |
8924 | 8924 |
8925 RawObject* Parser::EvaluateConstConstructorCall( | 8925 RawObject* Parser::EvaluateConstConstructorCall( |
8926 const Class& type_class, | 8926 const Class& type_class, |
8927 const AbstractTypeArguments& type_arguments, | 8927 const TypeArguments& type_arguments, |
8928 const Function& constructor, | 8928 const Function& constructor, |
8929 ArgumentListNode* arguments) { | 8929 ArgumentListNode* arguments) { |
8930 // Factories have one extra argument: the type arguments. | 8930 // Factories have one extra argument: the type arguments. |
8931 // Constructors have 2 extra arguments: rcvr and construction phase. | 8931 // Constructors have 2 extra arguments: rcvr and construction phase. |
8932 const int kNumExtraArgs = constructor.IsFactory() ? 1 : 2; | 8932 const int kNumExtraArgs = constructor.IsFactory() ? 1 : 2; |
8933 const int num_arguments = arguments->length() + kNumExtraArgs; | 8933 const int num_arguments = arguments->length() + kNumExtraArgs; |
8934 const Array& arg_values = Array::Handle(Array::New(num_arguments)); | 8934 const Array& arg_values = Array::Handle(Array::New(num_arguments)); |
8935 Instance& instance = Instance::Handle(); | 8935 Instance& instance = Instance::Handle(); |
8936 if (!constructor.IsFactory()) { | 8936 if (!constructor.IsFactory()) { |
8937 instance = Instance::New(type_class, Heap::kOld); | 8937 instance = Instance::New(type_class, Heap::kOld); |
8938 if (!type_arguments.IsNull()) { | 8938 if (!type_arguments.IsNull()) { |
8939 if (!type_arguments.IsInstantiated()) { | 8939 if (!type_arguments.IsInstantiated()) { |
8940 ErrorMsg("type must be constant in const constructor"); | 8940 ErrorMsg("type must be constant in const constructor"); |
8941 } | 8941 } |
8942 instance.SetTypeArguments( | 8942 instance.SetTypeArguments( |
8943 AbstractTypeArguments::Handle(type_arguments.Canonicalize())); | 8943 TypeArguments::Handle(type_arguments.Canonicalize())); |
8944 } | 8944 } |
8945 arg_values.SetAt(0, instance); | 8945 arg_values.SetAt(0, instance); |
8946 arg_values.SetAt(1, Smi::Handle(Smi::New(Function::kCtorPhaseAll))); | 8946 arg_values.SetAt(1, Smi::Handle(Smi::New(Function::kCtorPhaseAll))); |
8947 } else { | 8947 } else { |
8948 // Prepend type_arguments to list of arguments to factory. | 8948 // Prepend type_arguments to list of arguments to factory. |
8949 ASSERT(type_arguments.IsZoneHandle()); | 8949 ASSERT(type_arguments.IsZoneHandle()); |
8950 arg_values.SetAt(0, type_arguments); | 8950 arg_values.SetAt(0, type_arguments); |
8951 } | 8951 } |
8952 for (int i = 0; i < arguments->length(); i++) { | 8952 for (int i = 0; i < arguments->length(); i++) { |
8953 AstNode* arg = arguments->NodeAt(i); | 8953 AstNode* arg = arguments->NodeAt(i); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9327 // Leave type_class as null if type finalization mode is kIgnore. | 9327 // Leave type_class as null if type finalization mode is kIgnore. |
9328 if (finalization != ClassFinalizer::kIgnore) { | 9328 if (finalization != ClassFinalizer::kIgnore) { |
9329 LibraryPrefix& lib_prefix = LibraryPrefix::Handle(isolate()); | 9329 LibraryPrefix& lib_prefix = LibraryPrefix::Handle(isolate()); |
9330 if (type_name.lib_prefix != NULL) { | 9330 if (type_name.lib_prefix != NULL) { |
9331 lib_prefix = type_name.lib_prefix->raw(); | 9331 lib_prefix = type_name.lib_prefix->raw(); |
9332 } | 9332 } |
9333 type_class = UnresolvedClass::New(lib_prefix, | 9333 type_class = UnresolvedClass::New(lib_prefix, |
9334 *type_name.ident, | 9334 *type_name.ident, |
9335 type_name.ident_pos); | 9335 type_name.ident_pos); |
9336 } | 9336 } |
9337 AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle( | 9337 TypeArguments& type_arguments = TypeArguments::Handle( |
9338 isolate(), ParseTypeArguments(finalization)); | 9338 isolate(), ParseTypeArguments(finalization)); |
9339 if (finalization == ClassFinalizer::kIgnore) { | 9339 if (finalization == ClassFinalizer::kIgnore) { |
9340 return Type::DynamicType(); | 9340 return Type::DynamicType(); |
9341 } | 9341 } |
9342 AbstractType& type = AbstractType::Handle( | 9342 AbstractType& type = AbstractType::Handle( |
9343 isolate(), Type::New(type_class, type_arguments, type_name.ident_pos)); | 9343 isolate(), Type::New(type_class, type_arguments, type_name.ident_pos)); |
9344 if (finalization >= ClassFinalizer::kResolveTypeParameters) { | 9344 if (finalization >= ClassFinalizer::kResolveTypeParameters) { |
9345 ResolveTypeFromClass(current_class(), finalization, &type); | 9345 ResolveTypeFromClass(current_class(), finalization, &type); |
9346 if (finalization >= ClassFinalizer::kCanonicalize) { | 9346 if (finalization >= ClassFinalizer::kCanonicalize) { |
9347 type ^= ClassFinalizer::FinalizeType(current_class(), type, finalization); | 9347 type ^= ClassFinalizer::FinalizeType(current_class(), type, finalization); |
9348 } | 9348 } |
9349 } | 9349 } |
9350 return type.raw(); | 9350 return type.raw(); |
9351 } | 9351 } |
9352 | 9352 |
9353 | 9353 |
9354 void Parser::CheckConstructorCallTypeArguments( | 9354 void Parser::CheckConstructorCallTypeArguments( |
9355 intptr_t pos, Function& constructor, | 9355 intptr_t pos, Function& constructor, |
9356 const AbstractTypeArguments& type_arguments) { | 9356 const TypeArguments& type_arguments) { |
9357 if (!type_arguments.IsNull()) { | 9357 if (!type_arguments.IsNull()) { |
9358 const Class& constructor_class = Class::Handle(constructor.Owner()); | 9358 const Class& constructor_class = Class::Handle(constructor.Owner()); |
9359 ASSERT(!constructor_class.IsNull()); | 9359 ASSERT(!constructor_class.IsNull()); |
9360 ASSERT(constructor_class.is_finalized()); | 9360 ASSERT(constructor_class.is_finalized()); |
| 9361 ASSERT(type_arguments.IsCanonical()); |
9361 // Do not report the expected vs. actual number of type arguments, because | 9362 // Do not report the expected vs. actual number of type arguments, because |
9362 // the type argument vector is flattened and raw types are allowed. | 9363 // the type argument vector is flattened and raw types are allowed. |
9363 if (type_arguments.Length() != constructor_class.NumTypeArguments()) { | 9364 if (type_arguments.Length() != constructor_class.NumTypeArguments()) { |
9364 ErrorMsg(pos, "wrong number of type arguments passed to constructor"); | 9365 ErrorMsg(pos, "wrong number of type arguments passed to constructor"); |
9365 } | 9366 } |
9366 } | 9367 } |
9367 } | 9368 } |
9368 | 9369 |
9369 | 9370 |
9370 // Parse "[" [ expr { "," expr } ["," ] "]". | 9371 // Parse "[" [ expr { "," expr } ["," ] "]". |
9371 // Note: if the list literal is empty and the brackets have no whitespace | 9372 // Note: if the list literal is empty and the brackets have no whitespace |
9372 // between them, the scanner recognizes the opening and closing bracket | 9373 // between them, the scanner recognizes the opening and closing bracket |
9373 // as one token of type Token::kINDEX. | 9374 // as one token of type Token::kINDEX. |
9374 AstNode* Parser::ParseListLiteral(intptr_t type_pos, | 9375 AstNode* Parser::ParseListLiteral(intptr_t type_pos, |
9375 bool is_const, | 9376 bool is_const, |
9376 const AbstractTypeArguments& type_arguments) { | 9377 const TypeArguments& type_arguments) { |
9377 TRACE_PARSER("ParseListLiteral"); | 9378 TRACE_PARSER("ParseListLiteral"); |
9378 ASSERT(type_pos >= 0); | 9379 ASSERT(type_pos >= 0); |
9379 ASSERT(CurrentToken() == Token::kLBRACK || CurrentToken() == Token::kINDEX); | 9380 ASSERT(CurrentToken() == Token::kLBRACK || CurrentToken() == Token::kINDEX); |
9380 const intptr_t literal_pos = TokenPos(); | 9381 const intptr_t literal_pos = TokenPos(); |
9381 bool is_empty_literal = CurrentToken() == Token::kINDEX; | 9382 bool is_empty_literal = CurrentToken() == Token::kINDEX; |
9382 ConsumeToken(); | 9383 ConsumeToken(); |
9383 | 9384 |
9384 AbstractType& element_type = Type::ZoneHandle(Type::DynamicType()); | 9385 AbstractType& element_type = Type::ZoneHandle(Type::DynamicType()); |
9385 AbstractTypeArguments& list_type_arguments = | 9386 TypeArguments& list_type_arguments = |
9386 AbstractTypeArguments::ZoneHandle(type_arguments.raw()); | 9387 TypeArguments::ZoneHandle(type_arguments.raw()); |
9387 // If no type argument vector is provided, leave it as null, which is | 9388 // If no type argument vector is provided, leave it as null, which is |
9388 // equivalent to using dynamic as the type argument for the element type. | 9389 // equivalent to using dynamic as the type argument for the element type. |
9389 if (!list_type_arguments.IsNull()) { | 9390 if (!list_type_arguments.IsNull()) { |
9390 ASSERT(list_type_arguments.Length() > 0); | 9391 ASSERT(list_type_arguments.Length() > 0); |
9391 // List literals take a single type argument. | 9392 // List literals take a single type argument. |
9392 if (list_type_arguments.Length() == 1) { | 9393 if (list_type_arguments.Length() == 1) { |
9393 element_type = list_type_arguments.TypeAt(0); | 9394 element_type = list_type_arguments.TypeAt(0); |
9394 ASSERT(!element_type.IsMalformed()); // Would be mapped to dynamic. | 9395 ASSERT(!element_type.IsMalformed()); // Would be mapped to dynamic. |
9395 ASSERT(!element_type.IsMalbounded()); // No declared bound in List. | 9396 ASSERT(!element_type.IsMalbounded()); // No declared bound in List. |
9396 if (element_type.IsDynamicType()) { | 9397 if (element_type.IsDynamicType()) { |
9397 list_type_arguments = AbstractTypeArguments::null(); | 9398 list_type_arguments = TypeArguments::null(); |
9398 } else if (is_const && !element_type.IsInstantiated()) { | 9399 } else if (is_const && !element_type.IsInstantiated()) { |
9399 ErrorMsg(type_pos, | 9400 ErrorMsg(type_pos, |
9400 "the type argument of a constant list literal cannot include " | 9401 "the type argument of a constant list literal cannot include " |
9401 "a type variable"); | 9402 "a type variable"); |
9402 } | 9403 } |
9403 } else { | 9404 } else { |
9404 if (FLAG_error_on_bad_type) { | 9405 if (FLAG_error_on_bad_type) { |
9405 ErrorMsg(type_pos, | 9406 ErrorMsg(type_pos, |
9406 "a list literal takes one type argument specifying " | 9407 "a list literal takes one type argument specifying " |
9407 "the element type"); | 9408 "the element type"); |
9408 } | 9409 } |
9409 // Ignore type arguments. | 9410 // Ignore type arguments. |
9410 list_type_arguments = AbstractTypeArguments::null(); | 9411 list_type_arguments = TypeArguments::null(); |
9411 } | 9412 } |
9412 } | 9413 } |
9413 ASSERT(list_type_arguments.IsNull() || (list_type_arguments.Length() == 1)); | 9414 ASSERT(list_type_arguments.IsNull() || (list_type_arguments.Length() == 1)); |
9414 const Class& array_class = Class::Handle( | 9415 const Class& array_class = Class::Handle( |
9415 isolate()->object_store()->array_class()); | 9416 isolate()->object_store()->array_class()); |
9416 Type& type = Type::ZoneHandle( | 9417 Type& type = Type::ZoneHandle( |
9417 Type::New(array_class, list_type_arguments, type_pos)); | 9418 Type::New(array_class, list_type_arguments, type_pos)); |
9418 type ^= ClassFinalizer::FinalizeType( | 9419 type ^= ClassFinalizer::FinalizeType( |
9419 current_class(), type, ClassFinalizer::kCanonicalize); | 9420 current_class(), type, ClassFinalizer::kCanonicalize); |
9420 GrowableArray<AstNode*> element_list; | 9421 GrowableArray<AstNode*> element_list; |
(...skipping 21 matching lines...) Expand all Loading... |
9442 } | 9443 } |
9443 ExpectToken(Token::kRBRACK); | 9444 ExpectToken(Token::kRBRACK); |
9444 SetAllowFunctionLiterals(saved_mode); | 9445 SetAllowFunctionLiterals(saved_mode); |
9445 } | 9446 } |
9446 | 9447 |
9447 if (is_const) { | 9448 if (is_const) { |
9448 // Allocate and initialize the const list at compile time. | 9449 // Allocate and initialize the const list at compile time. |
9449 Array& const_list = | 9450 Array& const_list = |
9450 Array::ZoneHandle(Array::New(element_list.length(), Heap::kOld)); | 9451 Array::ZoneHandle(Array::New(element_list.length(), Heap::kOld)); |
9451 const_list.SetTypeArguments( | 9452 const_list.SetTypeArguments( |
9452 AbstractTypeArguments::Handle(list_type_arguments.Canonicalize())); | 9453 TypeArguments::Handle(list_type_arguments.Canonicalize())); |
9453 Error& malformed_error = Error::Handle(); | 9454 Error& malformed_error = Error::Handle(); |
9454 for (int i = 0; i < element_list.length(); i++) { | 9455 for (int i = 0; i < element_list.length(); i++) { |
9455 AstNode* elem = element_list[i]; | 9456 AstNode* elem = element_list[i]; |
9456 // Arguments have been evaluated to a literal value already. | 9457 // Arguments have been evaluated to a literal value already. |
9457 ASSERT(elem->IsLiteralNode()); | 9458 ASSERT(elem->IsLiteralNode()); |
9458 ASSERT(!is_top_level_); // We cannot check unresolved types. | 9459 ASSERT(!is_top_level_); // We cannot check unresolved types. |
9459 if (FLAG_enable_type_checks && | 9460 if (FLAG_enable_type_checks && |
9460 !element_type.IsDynamicType() && | 9461 !element_type.IsDynamicType() && |
9461 (!elem->AsLiteralNode()->literal().IsNull() && | 9462 (!elem->AsLiteralNode()->literal().IsNull() && |
9462 !elem->AsLiteralNode()->literal().IsInstanceOf( | 9463 !elem->AsLiteralNode()->literal().IsInstanceOf( |
(...skipping 22 matching lines...) Expand all Loading... |
9485 const Function& factory_method = Function::ZoneHandle( | 9486 const Function& factory_method = Function::ZoneHandle( |
9486 factory_class.LookupFactory( | 9487 factory_class.LookupFactory( |
9487 Library::PrivateCoreLibName(Symbols::ListLiteralFactory()))); | 9488 Library::PrivateCoreLibName(Symbols::ListLiteralFactory()))); |
9488 ASSERT(!factory_method.IsNull()); | 9489 ASSERT(!factory_method.IsNull()); |
9489 if (!list_type_arguments.IsNull() && | 9490 if (!list_type_arguments.IsNull() && |
9490 !list_type_arguments.IsInstantiated() && | 9491 !list_type_arguments.IsInstantiated() && |
9491 (current_block_->scope->function_level() > 0)) { | 9492 (current_block_->scope->function_level() > 0)) { |
9492 // Make sure that the instantiator is captured. | 9493 // Make sure that the instantiator is captured. |
9493 CaptureInstantiator(); | 9494 CaptureInstantiator(); |
9494 } | 9495 } |
9495 AbstractTypeArguments& factory_type_args = | 9496 TypeArguments& factory_type_args = |
9496 AbstractTypeArguments::ZoneHandle(list_type_arguments.raw()); | 9497 TypeArguments::ZoneHandle(list_type_arguments.raw()); |
9497 // If the factory class extends other parameterized classes, adjust the | 9498 // If the factory class extends other parameterized classes, adjust the |
9498 // type argument vector. | 9499 // type argument vector. |
9499 if (!factory_type_args.IsNull() && (factory_class.NumTypeArguments() > 1)) { | 9500 if (!factory_type_args.IsNull() && (factory_class.NumTypeArguments() > 1)) { |
9500 ASSERT(factory_type_args.Length() == 1); | 9501 ASSERT(factory_type_args.Length() == 1); |
9501 Type& factory_type = Type::Handle(Type::New( | 9502 Type& factory_type = Type::Handle(Type::New( |
9502 factory_class, factory_type_args, type_pos, Heap::kNew)); | 9503 factory_class, factory_type_args, type_pos, Heap::kNew)); |
9503 factory_type ^= ClassFinalizer::FinalizeType( | 9504 factory_type ^= ClassFinalizer::FinalizeType( |
9504 current_class(), factory_type, ClassFinalizer::kFinalize); | 9505 current_class(), factory_type, ClassFinalizer::kFinalize); |
9505 factory_type_args = factory_type.arguments(); | 9506 factory_type_args = factory_type.arguments(); |
9506 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments()); | 9507 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments()); |
(...skipping 13 matching lines...) Expand all Loading... |
9520 return CreateConstructorCallNode(literal_pos, | 9521 return CreateConstructorCallNode(literal_pos, |
9521 factory_type_args, | 9522 factory_type_args, |
9522 factory_method, | 9523 factory_method, |
9523 factory_param); | 9524 factory_param); |
9524 } | 9525 } |
9525 } | 9526 } |
9526 | 9527 |
9527 | 9528 |
9528 ConstructorCallNode* Parser::CreateConstructorCallNode( | 9529 ConstructorCallNode* Parser::CreateConstructorCallNode( |
9529 intptr_t token_pos, | 9530 intptr_t token_pos, |
9530 const AbstractTypeArguments& type_arguments, | 9531 const TypeArguments& type_arguments, |
9531 const Function& constructor, | 9532 const Function& constructor, |
9532 ArgumentListNode* arguments) { | 9533 ArgumentListNode* arguments) { |
9533 if (!type_arguments.IsNull() && !type_arguments.IsInstantiated()) { | 9534 if (!type_arguments.IsNull() && !type_arguments.IsInstantiated()) { |
9534 EnsureExpressionTemp(); | 9535 EnsureExpressionTemp(); |
9535 } | 9536 } |
9536 return new ConstructorCallNode(token_pos, | 9537 return new ConstructorCallNode(token_pos, |
9537 type_arguments, | 9538 type_arguments, |
9538 constructor, | 9539 constructor, |
9539 arguments); | 9540 arguments); |
9540 } | 9541 } |
(...skipping 19 matching lines...) Expand all Loading... |
9560 } | 9561 } |
9561 } | 9562 } |
9562 } | 9563 } |
9563 pairs->Add(key); | 9564 pairs->Add(key); |
9564 pairs->Add(value); | 9565 pairs->Add(value); |
9565 } | 9566 } |
9566 | 9567 |
9567 | 9568 |
9568 AstNode* Parser::ParseMapLiteral(intptr_t type_pos, | 9569 AstNode* Parser::ParseMapLiteral(intptr_t type_pos, |
9569 bool is_const, | 9570 bool is_const, |
9570 const AbstractTypeArguments& type_arguments) { | 9571 const TypeArguments& type_arguments) { |
9571 TRACE_PARSER("ParseMapLiteral"); | 9572 TRACE_PARSER("ParseMapLiteral"); |
9572 ASSERT(type_pos >= 0); | 9573 ASSERT(type_pos >= 0); |
9573 ASSERT(CurrentToken() == Token::kLBRACE); | 9574 ASSERT(CurrentToken() == Token::kLBRACE); |
9574 const intptr_t literal_pos = TokenPos(); | 9575 const intptr_t literal_pos = TokenPos(); |
9575 ConsumeToken(); | 9576 ConsumeToken(); |
9576 | 9577 |
9577 AbstractType& key_type = Type::ZoneHandle(Type::DynamicType()); | 9578 AbstractType& key_type = Type::ZoneHandle(Type::DynamicType()); |
9578 AbstractType& value_type = Type::ZoneHandle(Type::DynamicType()); | 9579 AbstractType& value_type = Type::ZoneHandle(Type::DynamicType()); |
9579 AbstractTypeArguments& map_type_arguments = | 9580 TypeArguments& map_type_arguments = |
9580 AbstractTypeArguments::ZoneHandle(type_arguments.raw()); | 9581 TypeArguments::ZoneHandle(type_arguments.raw()); |
9581 // If no type argument vector is provided, leave it as null, which is | 9582 // If no type argument vector is provided, leave it as null, which is |
9582 // equivalent to using dynamic as the type argument for the both key and value | 9583 // equivalent to using dynamic as the type argument for the both key and value |
9583 // types. | 9584 // types. |
9584 if (!map_type_arguments.IsNull()) { | 9585 if (!map_type_arguments.IsNull()) { |
9585 ASSERT(map_type_arguments.Length() > 0); | 9586 ASSERT(map_type_arguments.Length() > 0); |
9586 // Map literals take two type arguments. | 9587 // Map literals take two type arguments. |
9587 if (map_type_arguments.Length() == 2) { | 9588 if (map_type_arguments.Length() == 2) { |
9588 key_type = map_type_arguments.TypeAt(0); | 9589 key_type = map_type_arguments.TypeAt(0); |
9589 value_type = map_type_arguments.TypeAt(1); | 9590 value_type = map_type_arguments.TypeAt(1); |
9590 // Malformed type arguments are mapped to dynamic. | 9591 // Malformed type arguments are mapped to dynamic. |
9591 ASSERT(!key_type.IsMalformed() && !value_type.IsMalformed()); | 9592 ASSERT(!key_type.IsMalformed() && !value_type.IsMalformed()); |
9592 // No declared bounds in Map. | 9593 // No declared bounds in Map. |
9593 ASSERT(!key_type.IsMalbounded() && !value_type.IsMalbounded()); | 9594 ASSERT(!key_type.IsMalbounded() && !value_type.IsMalbounded()); |
9594 if (key_type.IsDynamicType() && value_type.IsDynamicType()) { | 9595 if (key_type.IsDynamicType() && value_type.IsDynamicType()) { |
9595 map_type_arguments = AbstractTypeArguments::null(); | 9596 map_type_arguments = TypeArguments::null(); |
9596 } else if (is_const && !type_arguments.IsInstantiated()) { | 9597 } else if (is_const && !type_arguments.IsInstantiated()) { |
9597 ErrorMsg(type_pos, | 9598 ErrorMsg(type_pos, |
9598 "the type arguments of a constant map literal cannot include " | 9599 "the type arguments of a constant map literal cannot include " |
9599 "a type variable"); | 9600 "a type variable"); |
9600 } | 9601 } |
9601 } else { | 9602 } else { |
9602 if (FLAG_error_on_bad_type) { | 9603 if (FLAG_error_on_bad_type) { |
9603 ErrorMsg(type_pos, | 9604 ErrorMsg(type_pos, |
9604 "a map literal takes two type arguments specifying " | 9605 "a map literal takes two type arguments specifying " |
9605 "the key type and the value type"); | 9606 "the key type and the value type"); |
9606 } | 9607 } |
9607 // Ignore type arguments. | 9608 // Ignore type arguments. |
9608 map_type_arguments = AbstractTypeArguments::null(); | 9609 map_type_arguments = TypeArguments::null(); |
9609 } | 9610 } |
9610 } | 9611 } |
9611 ASSERT(map_type_arguments.IsNull() || (map_type_arguments.Length() == 2)); | 9612 ASSERT(map_type_arguments.IsNull() || (map_type_arguments.Length() == 2)); |
9612 map_type_arguments ^= map_type_arguments.Canonicalize(); | 9613 map_type_arguments ^= map_type_arguments.Canonicalize(); |
9613 | 9614 |
9614 GrowableArray<AstNode*> kv_pairs_list; | 9615 GrowableArray<AstNode*> kv_pairs_list; |
9615 // Parse the map entries. Note: there may be an optional extra | 9616 // Parse the map entries. Note: there may be an optional extra |
9616 // comma after the last entry. | 9617 // comma after the last entry. |
9617 while (CurrentToken() != Token::kRBRACE) { | 9618 while (CurrentToken() != Token::kRBRACE) { |
9618 const bool saved_mode = SetAllowFunctionLiterals(true); | 9619 const bool saved_mode = SetAllowFunctionLiterals(true); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9681 // Check key type. | 9682 // Check key type. |
9682 arg_type = key_type.raw(); | 9683 arg_type = key_type.raw(); |
9683 } else { | 9684 } else { |
9684 // Check value type. | 9685 // Check value type. |
9685 arg_type = value_type.raw(); | 9686 arg_type = value_type.raw(); |
9686 } | 9687 } |
9687 if (!arg_type.IsDynamicType() && | 9688 if (!arg_type.IsDynamicType() && |
9688 (!arg->AsLiteralNode()->literal().IsNull() && | 9689 (!arg->AsLiteralNode()->literal().IsNull() && |
9689 !arg->AsLiteralNode()->literal().IsInstanceOf( | 9690 !arg->AsLiteralNode()->literal().IsInstanceOf( |
9690 arg_type, | 9691 arg_type, |
9691 Object::null_abstract_type_arguments(), | 9692 Object::null_type_arguments(), |
9692 &malformed_error))) { | 9693 &malformed_error))) { |
9693 // If the failure is due to a malformed type error, display it. | 9694 // If the failure is due to a malformed type error, display it. |
9694 if (!malformed_error.IsNull()) { | 9695 if (!malformed_error.IsNull()) { |
9695 ErrorMsg(malformed_error); | 9696 ErrorMsg(malformed_error); |
9696 } else { | 9697 } else { |
9697 ErrorMsg(arg->AsLiteralNode()->token_pos(), | 9698 ErrorMsg(arg->AsLiteralNode()->token_pos(), |
9698 "map literal %s at index %d must be " | 9699 "map literal %s at index %d must be " |
9699 "a constant of type '%s'", | 9700 "a constant of type '%s'", |
9700 ((i % 2) == 0) ? "key" : "value", | 9701 ((i % 2) == 0) ? "key" : "value", |
9701 i >> 1, | 9702 i >> 1, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9743 const Function& factory_method = Function::ZoneHandle( | 9744 const Function& factory_method = Function::ZoneHandle( |
9744 factory_class.LookupFactory( | 9745 factory_class.LookupFactory( |
9745 Library::PrivateCoreLibName(Symbols::MapLiteralFactory()))); | 9746 Library::PrivateCoreLibName(Symbols::MapLiteralFactory()))); |
9746 ASSERT(!factory_method.IsNull()); | 9747 ASSERT(!factory_method.IsNull()); |
9747 if (!map_type_arguments.IsNull() && | 9748 if (!map_type_arguments.IsNull() && |
9748 !map_type_arguments.IsInstantiated() && | 9749 !map_type_arguments.IsInstantiated() && |
9749 (current_block_->scope->function_level() > 0)) { | 9750 (current_block_->scope->function_level() > 0)) { |
9750 // Make sure that the instantiator is captured. | 9751 // Make sure that the instantiator is captured. |
9751 CaptureInstantiator(); | 9752 CaptureInstantiator(); |
9752 } | 9753 } |
9753 AbstractTypeArguments& factory_type_args = | 9754 TypeArguments& factory_type_args = |
9754 AbstractTypeArguments::ZoneHandle(map_type_arguments.raw()); | 9755 TypeArguments::ZoneHandle(map_type_arguments.raw()); |
9755 // If the factory class extends other parameterized classes, adjust the | 9756 // If the factory class extends other parameterized classes, adjust the |
9756 // type argument vector. | 9757 // type argument vector. |
9757 if (!factory_type_args.IsNull() && (factory_class.NumTypeArguments() > 2)) { | 9758 if (!factory_type_args.IsNull() && (factory_class.NumTypeArguments() > 2)) { |
9758 ASSERT(factory_type_args.Length() == 2); | 9759 ASSERT(factory_type_args.Length() == 2); |
9759 Type& factory_type = Type::Handle(Type::New( | 9760 Type& factory_type = Type::Handle(Type::New( |
9760 factory_class, factory_type_args, type_pos, Heap::kNew)); | 9761 factory_class, factory_type_args, type_pos, Heap::kNew)); |
9761 factory_type ^= ClassFinalizer::FinalizeType( | 9762 factory_type ^= ClassFinalizer::FinalizeType( |
9762 current_class(), factory_type, ClassFinalizer::kFinalize); | 9763 current_class(), factory_type, ClassFinalizer::kFinalize); |
9763 factory_type_args = factory_type.arguments(); | 9764 factory_type_args = factory_type.arguments(); |
9764 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments()); | 9765 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments()); |
(...skipping 18 matching lines...) Expand all Loading... |
9783 | 9784 |
9784 | 9785 |
9785 AstNode* Parser::ParseCompoundLiteral() { | 9786 AstNode* Parser::ParseCompoundLiteral() { |
9786 TRACE_PARSER("ParseCompoundLiteral"); | 9787 TRACE_PARSER("ParseCompoundLiteral"); |
9787 bool is_const = false; | 9788 bool is_const = false; |
9788 if (CurrentToken() == Token::kCONST) { | 9789 if (CurrentToken() == Token::kCONST) { |
9789 is_const = true; | 9790 is_const = true; |
9790 ConsumeToken(); | 9791 ConsumeToken(); |
9791 } | 9792 } |
9792 const intptr_t type_pos = TokenPos(); | 9793 const intptr_t type_pos = TokenPos(); |
9793 AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle( | 9794 TypeArguments& type_arguments = TypeArguments::Handle( |
9794 ParseTypeArguments(ClassFinalizer::kCanonicalize)); | 9795 ParseTypeArguments(ClassFinalizer::kCanonicalize)); |
9795 // Malformed type arguments are mapped to dynamic, so we will not encounter | 9796 // Malformed type arguments are mapped to dynamic, so we will not encounter |
9796 // them here. | 9797 // them here. |
9797 // Map and List interfaces do not declare bounds on their type parameters, so | 9798 // Map and List interfaces do not declare bounds on their type parameters, so |
9798 // we will not see malbounded type arguments here. | 9799 // we will not see malbounded type arguments here. |
9799 AstNode* primary = NULL; | 9800 AstNode* primary = NULL; |
9800 if ((CurrentToken() == Token::kLBRACK) || | 9801 if ((CurrentToken() == Token::kLBRACK) || |
9801 (CurrentToken() == Token::kINDEX)) { | 9802 (CurrentToken() == Token::kINDEX)) { |
9802 primary = ParseListLiteral(type_pos, is_const, type_arguments); | 9803 primary = ParseListLiteral(type_pos, is_const, type_arguments); |
9803 } else if (CurrentToken() == Token::kLBRACE) { | 9804 } else if (CurrentToken() == Token::kLBRACE) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9916 if (is_const) { | 9917 if (is_const) { |
9917 const Error& error = Error::Handle(type.error()); | 9918 const Error& error = Error::Handle(type.error()); |
9918 ErrorMsg(error); | 9919 ErrorMsg(error); |
9919 } | 9920 } |
9920 return ThrowTypeError(type_pos, type); | 9921 return ThrowTypeError(type_pos, type); |
9921 } | 9922 } |
9922 | 9923 |
9923 // Resolve the type and optional identifier to a constructor or factory. | 9924 // Resolve the type and optional identifier to a constructor or factory. |
9924 Class& type_class = Class::Handle(type.type_class()); | 9925 Class& type_class = Class::Handle(type.type_class()); |
9925 String& type_class_name = String::Handle(type_class.Name()); | 9926 String& type_class_name = String::Handle(type_class.Name()); |
9926 AbstractTypeArguments& type_arguments = | 9927 TypeArguments& type_arguments = |
9927 AbstractTypeArguments::ZoneHandle(type.arguments()); | 9928 TypeArguments::ZoneHandle(type.arguments()); |
9928 | 9929 |
9929 // A constructor has an implicit 'this' parameter (instance to construct) | 9930 // A constructor has an implicit 'this' parameter (instance to construct) |
9930 // and a factory has an implicit 'this' parameter (type_arguments). | 9931 // and a factory has an implicit 'this' parameter (type_arguments). |
9931 // A constructor has a second implicit 'phase' parameter. | 9932 // A constructor has a second implicit 'phase' parameter. |
9932 intptr_t arguments_length = arguments->length() + 2; | 9933 intptr_t arguments_length = arguments->length() + 2; |
9933 | 9934 |
9934 // An additional type check of the result of a redirecting factory may be | 9935 // An additional type check of the result of a redirecting factory may be |
9935 // required. | 9936 // required. |
9936 AbstractType& type_bound = AbstractType::ZoneHandle(); | 9937 AbstractType& type_bound = AbstractType::ZoneHandle(); |
9937 | 9938 |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10774 void Parser::SkipQualIdent() { | 10775 void Parser::SkipQualIdent() { |
10775 ASSERT(IsIdentifier()); | 10776 ASSERT(IsIdentifier()); |
10776 ConsumeToken(); | 10777 ConsumeToken(); |
10777 if (CurrentToken() == Token::kPERIOD) { | 10778 if (CurrentToken() == Token::kPERIOD) { |
10778 ConsumeToken(); // Consume the kPERIOD token. | 10779 ConsumeToken(); // Consume the kPERIOD token. |
10779 ExpectIdentifier("identifier expected after '.'"); | 10780 ExpectIdentifier("identifier expected after '.'"); |
10780 } | 10781 } |
10781 } | 10782 } |
10782 | 10783 |
10783 } // namespace dart | 10784 } // namespace dart |
OLD | NEW |