| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 4289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4300 if (MatchesAccessorName(function_name, prefix, prefix_length, name)) { | 4300 if (MatchesAccessorName(function_name, prefix, prefix_length, name)) { |
| 4301 return function.raw(); | 4301 return function.raw(); |
| 4302 } | 4302 } |
| 4303 } | 4303 } |
| 4304 | 4304 |
| 4305 // No function found. | 4305 // No function found. |
| 4306 return Function::null(); | 4306 return Function::null(); |
| 4307 } | 4307 } |
| 4308 | 4308 |
| 4309 | 4309 |
| 4310 RawFunction* Class::LookupFunctionAtToken(intptr_t token_pos) const { | |
| 4311 // TODO(hausner): we can shortcut the negative case if we knew the | |
| 4312 // beginning and end token position of the class. | |
| 4313 Thread* thread = Thread::Current(); | |
| 4314 Zone* zone = thread->zone(); | |
| 4315 if (EnsureIsFinalized(thread) != Error::null()) { | |
| 4316 return Function::null(); | |
| 4317 } | |
| 4318 Function& func = Function::Handle(zone); | |
| 4319 func = LookupClosureFunction(token_pos); | |
| 4320 if (!func.IsNull()) { | |
| 4321 return func.raw(); | |
| 4322 } | |
| 4323 Array& funcs = Array::Handle(zone, functions()); | |
| 4324 intptr_t len = funcs.Length(); | |
| 4325 for (intptr_t i = 0; i < len; i++) { | |
| 4326 func ^= funcs.At(i); | |
| 4327 if ((func.token_pos() <= token_pos) && | |
| 4328 (token_pos <= func.end_token_pos())) { | |
| 4329 return func.raw(); | |
| 4330 } | |
| 4331 } | |
| 4332 // No function found. | |
| 4333 return Function::null(); | |
| 4334 } | |
| 4335 | |
| 4336 | |
| 4337 RawField* Class::LookupInstanceField(const String& name) const { | 4310 RawField* Class::LookupInstanceField(const String& name) const { |
| 4338 return LookupField(name, kInstance); | 4311 return LookupField(name, kInstance); |
| 4339 } | 4312 } |
| 4340 | 4313 |
| 4341 | 4314 |
| 4342 RawField* Class::LookupStaticField(const String& name) const { | 4315 RawField* Class::LookupStaticField(const String& name) const { |
| 4343 return LookupField(name, kStatic); | 4316 return LookupField(name, kStatic); |
| 4344 } | 4317 } |
| 4345 | 4318 |
| 4346 | 4319 |
| (...skipping 5487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9834 (script_url.CharAt(start_idx - 1) == '/')) && | 9807 (script_url.CharAt(start_idx - 1) == '/')) && |
| 9835 url.Equals(script_url, start_idx, url_length)) { | 9808 url.Equals(script_url, start_idx, url_length)) { |
| 9836 return script.raw(); | 9809 return script.raw(); |
| 9837 } | 9810 } |
| 9838 } | 9811 } |
| 9839 } | 9812 } |
| 9840 return Script::null(); | 9813 return Script::null(); |
| 9841 } | 9814 } |
| 9842 | 9815 |
| 9843 | 9816 |
| 9844 RawFunction* Library::LookupFunctionInScript(const Script& script, | |
| 9845 intptr_t token_pos) const { | |
| 9846 Class& cls = Class::Handle(); | |
| 9847 Function& func = Function::Handle(); | |
| 9848 ClassDictionaryIterator it(*this, ClassDictionaryIterator::kIteratePrivate); | |
| 9849 while (it.HasNext()) { | |
| 9850 cls = it.GetNextClass(); | |
| 9851 if (script.raw() == cls.script()) { | |
| 9852 func = cls.LookupFunctionAtToken(token_pos); | |
| 9853 if (!func.IsNull()) { | |
| 9854 return func.raw(); | |
| 9855 } | |
| 9856 } | |
| 9857 } | |
| 9858 return Function::null(); | |
| 9859 } | |
| 9860 | |
| 9861 | |
| 9862 RawObject* Library::LookupLocalObject(const String& name) const { | 9817 RawObject* Library::LookupLocalObject(const String& name) const { |
| 9863 intptr_t index; | 9818 intptr_t index; |
| 9864 return LookupEntry(name, &index); | 9819 return LookupEntry(name, &index); |
| 9865 } | 9820 } |
| 9866 | 9821 |
| 9867 | 9822 |
| 9868 RawField* Library::LookupFieldAllowPrivate(const String& name) const { | 9823 RawField* Library::LookupFieldAllowPrivate(const String& name) const { |
| 9869 Object& obj = Object::Handle(LookupObjectAllowPrivate(name)); | 9824 Object& obj = Object::Handle(LookupObjectAllowPrivate(name)); |
| 9870 if (obj.IsField()) { | 9825 if (obj.IsField()) { |
| 9871 return Field::Cast(obj).raw(); | 9826 return Field::Cast(obj).raw(); |
| (...skipping 12061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21933 return tag_label.ToCString(); | 21888 return tag_label.ToCString(); |
| 21934 } | 21889 } |
| 21935 | 21890 |
| 21936 | 21891 |
| 21937 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21892 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21938 Instance::PrintJSONImpl(stream, ref); | 21893 Instance::PrintJSONImpl(stream, ref); |
| 21939 } | 21894 } |
| 21940 | 21895 |
| 21941 | 21896 |
| 21942 } // namespace dart | 21897 } // namespace dart |
| OLD | NEW |