| 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 "include/dart_api.h" | 5 #include "include/dart_api.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/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2738 | 2738 |
| 2739 // Case 3. Lookup the funciton with the getter prefix prepended. | 2739 // Case 3. Lookup the funciton with the getter prefix prepended. |
| 2740 if (func.IsNull()) { | 2740 if (func.IsNull()) { |
| 2741 tmp_name = Field::GetterName(func_name); | 2741 tmp_name = Field::GetterName(func_name); |
| 2742 func = cls.LookupFunction(tmp_name); | 2742 func = cls.LookupFunction(tmp_name); |
| 2743 } | 2743 } |
| 2744 | 2744 |
| 2745 // Case 4. Lookup the function with a . appended to find the | 2745 // Case 4. Lookup the function with a . appended to find the |
| 2746 // unnamed constructor. | 2746 // unnamed constructor. |
| 2747 if (func.IsNull()) { | 2747 if (func.IsNull()) { |
| 2748 const String& dot = String::Handle(Symbols::Dot()); | 2748 tmp_name = String::Concat(func_name, Symbols::DotHandle()); |
| 2749 tmp_name = String::Concat(func_name, dot); | |
| 2750 func = cls.LookupFunction(tmp_name); | 2749 func = cls.LookupFunction(tmp_name); |
| 2751 } | 2750 } |
| 2752 } else if (obj.IsLibrary()) { | 2751 } else if (obj.IsLibrary()) { |
| 2753 const Library& lib = Library::Cast(obj); | 2752 const Library& lib = Library::Cast(obj); |
| 2754 | 2753 |
| 2755 // Case 1. Lookup the unmodified function name. | 2754 // Case 1. Lookup the unmodified function name. |
| 2756 func = lib.LookupFunctionAllowPrivate(func_name); | 2755 func = lib.LookupFunctionAllowPrivate(func_name); |
| 2757 | 2756 |
| 2758 // Case 2. Lookup the function without the external setter suffix | 2757 // Case 2. Lookup the function without the external setter suffix |
| 2759 // '='. Make sure to do this check after the regular lookup, so | 2758 // '='. Make sure to do this check after the regular lookup, so |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3306 String& base_constructor_name = String::Handle(); | 3305 String& base_constructor_name = String::Handle(); |
| 3307 base_constructor_name = cls.Name(); | 3306 base_constructor_name = cls.Name(); |
| 3308 | 3307 |
| 3309 // And get the name of the constructor to invoke. | 3308 // And get the name of the constructor to invoke. |
| 3310 String& dot_name = String::Handle(isolate); | 3309 String& dot_name = String::Handle(isolate); |
| 3311 const Object& name_obj = | 3310 const Object& name_obj = |
| 3312 Object::Handle(isolate, Api::UnwrapHandle(constructor_name)); | 3311 Object::Handle(isolate, Api::UnwrapHandle(constructor_name)); |
| 3313 if (name_obj.IsNull()) { | 3312 if (name_obj.IsNull()) { |
| 3314 dot_name = Symbols::Dot(); | 3313 dot_name = Symbols::Dot(); |
| 3315 } else if (name_obj.IsString()) { | 3314 } else if (name_obj.IsString()) { |
| 3316 const String& dot = String::Handle(isolate, Symbols::Dot()); | 3315 dot_name = String::Concat(Symbols::DotHandle(), String::Cast(name_obj)); |
| 3317 dot_name = String::Concat(dot, String::Cast(name_obj)); | |
| 3318 } else { | 3316 } else { |
| 3319 RETURN_TYPE_ERROR(isolate, constructor_name, String); | 3317 RETURN_TYPE_ERROR(isolate, constructor_name, String); |
| 3320 } | 3318 } |
| 3321 const char* msg = CheckIsolateState(isolate); | 3319 const char* msg = CheckIsolateState(isolate); |
| 3322 if (msg != NULL) { | 3320 if (msg != NULL) { |
| 3323 return Api::NewError("%s", msg); | 3321 return Api::NewError("%s", msg); |
| 3324 } | 3322 } |
| 3325 | 3323 |
| 3326 // Resolve the constructor. | 3324 // Resolve the constructor. |
| 3327 result = ResolveConstructor( | 3325 result = ResolveConstructor( |
| (...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4459 } | 4457 } |
| 4460 { | 4458 { |
| 4461 NoGCScope no_gc; | 4459 NoGCScope no_gc; |
| 4462 RawObject* raw_obj = obj.raw(); | 4460 RawObject* raw_obj = obj.raw(); |
| 4463 isolate->heap()->SetPeer(raw_obj, peer); | 4461 isolate->heap()->SetPeer(raw_obj, peer); |
| 4464 } | 4462 } |
| 4465 return Api::Success(isolate); | 4463 return Api::Success(isolate); |
| 4466 } | 4464 } |
| 4467 | 4465 |
| 4468 } // namespace dart | 4466 } // namespace dart |
| OLD | NEW |