| 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 "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 // Lookup class in the core lib which also contains various VM | 1596 // Lookup class in the core lib which also contains various VM |
| 1597 // helper methods and classes. Allow look up of private classes. | 1597 // helper methods and classes. Allow look up of private classes. |
| 1598 static RawClass* LookupCoreClass(const String& class_name) { | 1598 static RawClass* LookupCoreClass(const String& class_name) { |
| 1599 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1599 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 1600 String& name = String::Handle(class_name.raw()); | 1600 String& name = String::Handle(class_name.raw()); |
| 1601 if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) { | 1601 if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) { |
| 1602 // Private identifiers are mangled on a per script basis. | 1602 // Private identifiers are mangled on a per script basis. |
| 1603 name = String::Concat(name, String::Handle(core_lib.private_key())); | 1603 name = String::Concat(name, String::Handle(core_lib.private_key())); |
| 1604 name = Symbols::New(name); | 1604 name = Symbols::New(name); |
| 1605 } | 1605 } |
| 1606 return core_lib.LookupClass(name); | 1606 return core_lib.LookupClass(name, NULL); // No ambiguity error expected. |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 | 1609 |
| 1610 static const String& PrivateCoreLibName(const String& str) { | 1610 static const String& PrivateCoreLibName(const String& str) { |
| 1611 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1611 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 1612 const String& private_name = String::ZoneHandle(core_lib.PrivateName(str)); | 1612 const String& private_name = String::ZoneHandle(core_lib.PrivateName(str)); |
| 1613 return private_name; | 1613 return private_name; |
| 1614 } | 1614 } |
| 1615 | 1615 |
| 1616 | 1616 |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 "static method '%s' cannot be abstract", | 2836 "static method '%s' cannot be abstract", |
| 2837 method->name->ToCString()); | 2837 method->name->ToCString()); |
| 2838 } | 2838 } |
| 2839 if (method->has_const && !method->IsFactoryOrConstructor()) { | 2839 if (method->has_const && !method->IsFactoryOrConstructor()) { |
| 2840 ErrorMsg(method->name_pos, "'const' not allowed for methods"); | 2840 ErrorMsg(method->name_pos, "'const' not allowed for methods"); |
| 2841 } | 2841 } |
| 2842 if (method->has_abstract && method->IsFactoryOrConstructor()) { | 2842 if (method->has_abstract && method->IsFactoryOrConstructor()) { |
| 2843 ErrorMsg(method->name_pos, "constructor cannot be abstract"); | 2843 ErrorMsg(method->name_pos, "constructor cannot be abstract"); |
| 2844 } | 2844 } |
| 2845 if (method->has_const && method->IsConstructor()) { | 2845 if (method->has_const && method->IsConstructor()) { |
| 2846 Class& cls = Class::Handle(library_.LookupClass(members->class_name())); | 2846 current_class().set_is_const(); |
| 2847 cls.set_is_const(); | |
| 2848 } | 2847 } |
| 2849 | 2848 |
| 2850 // Parse the formal parameters. | 2849 // Parse the formal parameters. |
| 2851 const bool are_implicitly_final = method->has_const; | 2850 const bool are_implicitly_final = method->has_const; |
| 2852 const bool allow_explicit_default_values = true; | 2851 const bool allow_explicit_default_values = true; |
| 2853 const intptr_t formal_param_pos = TokenPos(); | 2852 const intptr_t formal_param_pos = TokenPos(); |
| 2854 method->params.Clear(); | 2853 method->params.Clear(); |
| 2855 // Static functions do not have a receiver. | 2854 // Static functions do not have a receiver. |
| 2856 // The first parameter of a factory is the AbstractTypeArguments vector of | 2855 // The first parameter of a factory is the AbstractTypeArguments vector of |
| 2857 // the type of the instance to be allocated. | 2856 // the type of the instance to be allocated. |
| (...skipping 7344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10202 void Parser::SkipQualIdent() { | 10201 void Parser::SkipQualIdent() { |
| 10203 ASSERT(IsIdentifier()); | 10202 ASSERT(IsIdentifier()); |
| 10204 ConsumeToken(); | 10203 ConsumeToken(); |
| 10205 if (CurrentToken() == Token::kPERIOD) { | 10204 if (CurrentToken() == Token::kPERIOD) { |
| 10206 ConsumeToken(); // Consume the kPERIOD token. | 10205 ConsumeToken(); // Consume the kPERIOD token. |
| 10207 ExpectIdentifier("identifier expected after '.'"); | 10206 ExpectIdentifier("identifier expected after '.'"); |
| 10208 } | 10207 } |
| 10209 } | 10208 } |
| 10210 | 10209 |
| 10211 } // namespace dart | 10210 } // namespace dart |
| OLD | NEW |