| 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 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2923 library_.AddClass(cls); | 2923 library_.AddClass(cls); |
| 2924 } else { | 2924 } else { |
| 2925 if (!obj.IsClass()) { | 2925 if (!obj.IsClass()) { |
| 2926 ErrorMsg(classname_pos, "'%s' is already defined", | 2926 ErrorMsg(classname_pos, "'%s' is already defined", |
| 2927 class_name.ToCString()); | 2927 class_name.ToCString()); |
| 2928 } | 2928 } |
| 2929 cls ^= obj.raw(); | 2929 cls ^= obj.raw(); |
| 2930 if (cls.is_interface()) { | 2930 if (cls.is_interface()) { |
| 2931 ErrorMsg(classname_pos, "'%s' is already defined as interface", | 2931 ErrorMsg(classname_pos, "'%s' is already defined as interface", |
| 2932 class_name.ToCString()); | 2932 class_name.ToCString()); |
| 2933 } else if (cls.functions() != Array::Empty()) { | 2933 } else if (cls.functions() != Object::empty_array()) { |
| 2934 ErrorMsg(classname_pos, "class '%s' is already defined", | 2934 ErrorMsg(classname_pos, "class '%s' is already defined", |
| 2935 class_name.ToCString()); | 2935 class_name.ToCString()); |
| 2936 } | 2936 } |
| 2937 } | 2937 } |
| 2938 ASSERT(!cls.IsNull()); | 2938 ASSERT(!cls.IsNull()); |
| 2939 ASSERT(cls.functions() == Array::Empty()); | 2939 ASSERT(cls.functions() == Object::empty_array()); |
| 2940 set_current_class(cls); | 2940 set_current_class(cls); |
| 2941 ParseTypeParameters(cls); | 2941 ParseTypeParameters(cls); |
| 2942 Type& super_type = Type::Handle(); | 2942 Type& super_type = Type::Handle(); |
| 2943 if (CurrentToken() == Token::kEXTENDS) { | 2943 if (CurrentToken() == Token::kEXTENDS) { |
| 2944 ConsumeToken(); | 2944 ConsumeToken(); |
| 2945 const intptr_t type_pos = TokenPos(); | 2945 const intptr_t type_pos = TokenPos(); |
| 2946 const AbstractType& type = AbstractType::Handle( | 2946 const AbstractType& type = AbstractType::Handle( |
| 2947 ParseType(ClassFinalizer::kTryResolve)); | 2947 ParseType(ClassFinalizer::kTryResolve)); |
| 2948 if (type.IsTypeParameter()) { | 2948 if (type.IsTypeParameter()) { |
| 2949 ErrorMsg(type_pos, | 2949 ErrorMsg(type_pos, |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3201 } else { | 3201 } else { |
| 3202 if (!obj.IsClass()) { | 3202 if (!obj.IsClass()) { |
| 3203 ErrorMsg(interfacename_pos, "'%s' is already defined", | 3203 ErrorMsg(interfacename_pos, "'%s' is already defined", |
| 3204 interface_name.ToCString()); | 3204 interface_name.ToCString()); |
| 3205 } | 3205 } |
| 3206 interface ^= obj.raw(); | 3206 interface ^= obj.raw(); |
| 3207 if (!interface.is_interface()) { | 3207 if (!interface.is_interface()) { |
| 3208 ErrorMsg(interfacename_pos, | 3208 ErrorMsg(interfacename_pos, |
| 3209 "'%s' is already defined as class", | 3209 "'%s' is already defined as class", |
| 3210 interface_name.ToCString()); | 3210 interface_name.ToCString()); |
| 3211 } else if (interface.functions() != Array::Empty()) { | 3211 } else if (interface.functions() != Object::empty_array()) { |
| 3212 ErrorMsg(interfacename_pos, | 3212 ErrorMsg(interfacename_pos, |
| 3213 "interface '%s' is already defined", | 3213 "interface '%s' is already defined", |
| 3214 interface_name.ToCString()); | 3214 interface_name.ToCString()); |
| 3215 } | 3215 } |
| 3216 } | 3216 } |
| 3217 ASSERT(!interface.IsNull()); | 3217 ASSERT(!interface.IsNull()); |
| 3218 ASSERT(interface.functions() == Array::Empty()); | 3218 ASSERT(interface.functions() == Object::empty_array()); |
| 3219 set_current_class(interface); | 3219 set_current_class(interface); |
| 3220 ParseTypeParameters(interface); | 3220 ParseTypeParameters(interface); |
| 3221 | 3221 |
| 3222 if (CurrentToken() == Token::kEXTENDS) { | 3222 if (CurrentToken() == Token::kEXTENDS) { |
| 3223 Array& interfaces = Array::Handle(); | 3223 Array& interfaces = Array::Handle(); |
| 3224 const intptr_t interfaces_pos = TokenPos(); | 3224 const intptr_t interfaces_pos = TokenPos(); |
| 3225 interfaces = ParseInterfaceList(); | 3225 interfaces = ParseInterfaceList(); |
| 3226 AddInterfaces(interfaces_pos, interface, interfaces); | 3226 AddInterfaces(interfaces_pos, interface, interfaces); |
| 3227 } | 3227 } |
| 3228 | 3228 |
| (...skipping 5808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9037 void Parser::SkipQualIdent() { | 9037 void Parser::SkipQualIdent() { |
| 9038 ASSERT(IsIdentifier()); | 9038 ASSERT(IsIdentifier()); |
| 9039 ConsumeToken(); | 9039 ConsumeToken(); |
| 9040 if (CurrentToken() == Token::kPERIOD) { | 9040 if (CurrentToken() == Token::kPERIOD) { |
| 9041 ConsumeToken(); // Consume the kPERIOD token. | 9041 ConsumeToken(); // Consume the kPERIOD token. |
| 9042 ExpectIdentifier("identifier expected after '.'"); | 9042 ExpectIdentifier("identifier expected after '.'"); |
| 9043 } | 9043 } |
| 9044 } | 9044 } |
| 9045 | 9045 |
| 9046 } // namespace dart | 9046 } // namespace dart |
| OLD | NEW |