| 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 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 11819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11830 if (primary_node->primary().IsFunction()) { | 11830 if (primary_node->primary().IsFunction()) { |
| 11831 array = LoadClosure(primary_node); | 11831 array = LoadClosure(primary_node); |
| 11832 } else if (primary_node->primary().IsClass()) { | 11832 } else if (primary_node->primary().IsClass()) { |
| 11833 const Class& type_class = Class::Cast(primary_node->primary()); | 11833 const Class& type_class = Class::Cast(primary_node->primary()); |
| 11834 AbstractType& type = Type::ZoneHandle( | 11834 AbstractType& type = Type::ZoneHandle( |
| 11835 Z, Type::New(type_class, TypeArguments::Handle(Z), primary_pos, | 11835 Z, Type::New(type_class, TypeArguments::Handle(Z), primary_pos, |
| 11836 Heap::kOld)); | 11836 Heap::kOld)); |
| 11837 type ^= CanonicalizeType(type); | 11837 type ^= CanonicalizeType(type); |
| 11838 // Type may be malbounded, but not malformed. | 11838 // Type may be malbounded, but not malformed. |
| 11839 ASSERT(!type.IsMalformed()); | 11839 ASSERT(!type.IsMalformed()); |
| 11840 array = new (Z) TypeNode(primary_pos, type); | 11840 array = new (Z) TypeNode(primary_pos, type, |
| 11841 primary_node->is_deferred_reference()); |
| 11841 } else if (primary_node->primary().IsTypeParameter()) { | 11842 } else if (primary_node->primary().IsTypeParameter()) { |
| 11842 array = LoadTypeParameter(primary_node); | 11843 array = LoadTypeParameter(primary_node); |
| 11843 } else { | 11844 } else { |
| 11844 UNREACHABLE(); // Internal parser error. | 11845 UNREACHABLE(); // Internal parser error. |
| 11845 } | 11846 } |
| 11846 } | 11847 } |
| 11847 selector = new (Z) | 11848 selector = new (Z) |
| 11848 LoadIndexedNode(bracket_pos, array, index, Class::ZoneHandle(Z)); | 11849 LoadIndexedNode(bracket_pos, array, index, Class::ZoneHandle(Z)); |
| 11849 } else if (IsArgumentPart()) { | 11850 } else if (IsArgumentPart()) { |
| 11850 if (CurrentToken() == Token::kLT) { | 11851 if (CurrentToken() == Token::kLT) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11924 name.ToCString()); | 11925 name.ToCString()); |
| 11925 } | 11926 } |
| 11926 } else if (primary_node->primary().IsClass()) { | 11927 } else if (primary_node->primary().IsClass()) { |
| 11927 const Class& type_class = Class::Cast(primary_node->primary()); | 11928 const Class& type_class = Class::Cast(primary_node->primary()); |
| 11928 AbstractType& type = Type::ZoneHandle( | 11929 AbstractType& type = Type::ZoneHandle( |
| 11929 Z, Type::New(type_class, TypeArguments::Handle(Z), primary_pos, | 11930 Z, Type::New(type_class, TypeArguments::Handle(Z), primary_pos, |
| 11930 Heap::kOld)); | 11931 Heap::kOld)); |
| 11931 type ^= CanonicalizeType(type); | 11932 type ^= CanonicalizeType(type); |
| 11932 // Type may be malbounded, but not malformed. | 11933 // Type may be malbounded, but not malformed. |
| 11933 ASSERT(!type.IsMalformed()); | 11934 ASSERT(!type.IsMalformed()); |
| 11934 selector = new (Z) TypeNode(primary_pos, type); | 11935 selector = new (Z) TypeNode(primary_pos, type, |
| 11936 primary_node->is_deferred_reference()); |
| 11935 } else { | 11937 } else { |
| 11936 UNREACHABLE(); // Internal parser error. | 11938 UNREACHABLE(); // Internal parser error. |
| 11937 } | 11939 } |
| 11938 } else { | 11940 } else { |
| 11939 // Left is not a primary node; this must be a closure call. | 11941 // Left is not a primary node; this must be a closure call. |
| 11940 AstNode* closure = left; | 11942 AstNode* closure = left; |
| 11941 selector = ParseClosureCall(closure); | 11943 selector = ParseClosureCall(closure); |
| 11942 } | 11944 } |
| 11943 } else { | 11945 } else { |
| 11944 // No (more) selectors to parse. | 11946 // No (more) selectors to parse. |
| 11945 left = LoadFieldIfUnresolved(left); | 11947 left = LoadFieldIfUnresolved(left); |
| 11946 if (left->IsPrimaryNode()) { | 11948 if (left->IsPrimaryNode()) { |
| 11947 PrimaryNode* primary_node = left->AsPrimaryNode(); | 11949 PrimaryNode* primary_node = left->AsPrimaryNode(); |
| 11948 const TokenPosition primary_pos = primary->token_pos(); | 11950 const TokenPosition primary_pos = primary->token_pos(); |
| 11949 if (primary_node->primary().IsFunction()) { | 11951 if (primary_node->primary().IsFunction()) { |
| 11950 // Treat as implicit closure. | 11952 // Treat as implicit closure. |
| 11951 left = LoadClosure(primary_node); | 11953 left = LoadClosure(primary_node); |
| 11952 } else if (primary_node->primary().IsClass()) { | 11954 } else if (primary_node->primary().IsClass()) { |
| 11953 const Class& type_class = Class::Cast(primary_node->primary()); | 11955 const Class& type_class = Class::Cast(primary_node->primary()); |
| 11954 AbstractType& type = Type::ZoneHandle( | 11956 AbstractType& type = Type::ZoneHandle( |
| 11955 Z, Type::New(type_class, TypeArguments::Handle(Z), primary_pos, | 11957 Z, Type::New(type_class, TypeArguments::Handle(Z), primary_pos, |
| 11956 Heap::kOld)); | 11958 Heap::kOld)); |
| 11957 type = CanonicalizeType(type); | 11959 type = CanonicalizeType(type); |
| 11958 // Type may be malbounded, but not malformed. | 11960 // Type may be malbounded, but not malformed. |
| 11959 ASSERT(!type.IsMalformed()); | 11961 ASSERT(!type.IsMalformed()); |
| 11960 left = new (Z) TypeNode(primary_pos, type); | 11962 left = new (Z) TypeNode(primary_pos, type, |
| 11963 primary_node->is_deferred_reference()); |
| 11961 } else if (primary_node->primary().IsTypeParameter()) { | 11964 } else if (primary_node->primary().IsTypeParameter()) { |
| 11962 left = LoadTypeParameter(primary_node); | 11965 left = LoadTypeParameter(primary_node); |
| 11963 } else if (primary_node->IsSuper()) { | 11966 } else if (primary_node->IsSuper()) { |
| 11964 // Return "super" to handle unary super operator calls, | 11967 // Return "super" to handle unary super operator calls, |
| 11965 // or to report illegal use of "super" otherwise. | 11968 // or to report illegal use of "super" otherwise. |
| 11966 left = primary_node; | 11969 left = primary_node; |
| 11967 } else { | 11970 } else { |
| 11968 UNREACHABLE(); // Internal parser error. | 11971 UNREACHABLE(); // Internal parser error. |
| 11969 } | 11972 } |
| 11970 } | 11973 } |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12871 ident.ToCString()); | 12874 ident.ToCString()); |
| 12872 } | 12875 } |
| 12873 } else if (primary->primary().IsClass()) { | 12876 } else if (primary->primary().IsClass()) { |
| 12874 const Class& type_class = Class::Cast(primary->primary()); | 12877 const Class& type_class = Class::Cast(primary->primary()); |
| 12875 AbstractType& type = | 12878 AbstractType& type = |
| 12876 Type::ZoneHandle(Z, Type::New(type_class, TypeArguments::Handle(Z), | 12879 Type::ZoneHandle(Z, Type::New(type_class, TypeArguments::Handle(Z), |
| 12877 primary_pos, Heap::kOld)); | 12880 primary_pos, Heap::kOld)); |
| 12878 type ^= CanonicalizeType(type); | 12881 type ^= CanonicalizeType(type); |
| 12879 // Type may be malbounded, but not malformed. | 12882 // Type may be malbounded, but not malformed. |
| 12880 ASSERT(!type.IsMalformed()); | 12883 ASSERT(!type.IsMalformed()); |
| 12881 resolved = new (Z) TypeNode(primary_pos, type); | 12884 resolved = |
| 12885 new (Z) TypeNode(primary_pos, type, primary->is_deferred_reference()); |
| 12882 } | 12886 } |
| 12883 } | 12887 } |
| 12884 return resolved; | 12888 return resolved; |
| 12885 } | 12889 } |
| 12886 | 12890 |
| 12887 | 12891 |
| 12888 RawAbstractType* Parser::ParseType( | 12892 RawAbstractType* Parser::ParseType( |
| 12889 ClassFinalizer::FinalizationKind finalization, | 12893 ClassFinalizer::FinalizationKind finalization, |
| 12890 bool allow_deferred_type, | 12894 bool allow_deferred_type, |
| 12891 bool consume_unresolved_prefix) { | 12895 bool consume_unresolved_prefix) { |
| (...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14967 const ArgumentListNode& function_args, | 14971 const ArgumentListNode& function_args, |
| 14968 const LocalVariable* temp_for_last_arg, | 14972 const LocalVariable* temp_for_last_arg, |
| 14969 bool is_super_invocation) { | 14973 bool is_super_invocation) { |
| 14970 UNREACHABLE(); | 14974 UNREACHABLE(); |
| 14971 return NULL; | 14975 return NULL; |
| 14972 } | 14976 } |
| 14973 | 14977 |
| 14974 } // namespace dart | 14978 } // namespace dart |
| 14975 | 14979 |
| 14976 #endif // DART_PRECOMPILED_RUNTIME | 14980 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |