Chromium Code Reviews| 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 6644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6655 } | 6655 } |
| 6656 if (obj.IsFunction()) { | 6656 if (obj.IsFunction()) { |
| 6657 return Function::Cast(obj).raw(); | 6657 return Function::Cast(obj).raw(); |
| 6658 } | 6658 } |
| 6659 | 6659 |
| 6660 // No function found. | 6660 // No function found. |
| 6661 return Function::null(); | 6661 return Function::null(); |
| 6662 } | 6662 } |
| 6663 | 6663 |
| 6664 | 6664 |
| 6665 // TODO(regis): This should take an Error* ambiguity_error parameter. | |
| 6665 RawObject* Library::LookupObject(const String& name) const { | 6666 RawObject* Library::LookupObject(const String& name) const { |
| 6666 // First check if name is found in the local scope of the library. | 6667 // First check if name is found in the local scope of the library. |
| 6667 Object& obj = Object::Handle(LookupLocalObject(name)); | 6668 Object& obj = Object::Handle(LookupLocalObject(name)); |
| 6668 if (!obj.IsNull()) { | 6669 if (!obj.IsNull()) { |
| 6669 return obj.raw(); | 6670 return obj.raw(); |
| 6670 } | 6671 } |
| 6671 // Now check if name is found in any imported libs. | 6672 // Now check if name is found in any imported libs. |
| 6673 // TODO(regis): This does not seem correct. It should be an error if the name | |
| 6674 // is found in more than one import and actually used. | |
|
hausner
2013/07/11 22:18:27
This error check is done in the parser. It verifie
regis
2013/07/12 00:02:38
Understood. My comment relates to the fact that th
| |
| 6672 const Array& imports = Array::Handle(this->imports()); | 6675 const Array& imports = Array::Handle(this->imports()); |
| 6673 Namespace& import = Namespace::Handle(); | 6676 Namespace& import = Namespace::Handle(); |
| 6674 for (intptr_t j = 0; j < this->num_imports(); j++) { | 6677 for (intptr_t j = 0; j < this->num_imports(); j++) { |
| 6675 import ^= imports.At(j); | 6678 import ^= imports.At(j); |
| 6676 obj = import.Lookup(name); | 6679 obj = import.Lookup(name); |
| 6677 if (!obj.IsNull()) { | 6680 if (!obj.IsNull()) { |
| 6678 return obj.raw(); | 6681 return obj.raw(); |
| 6679 } | 6682 } |
| 6680 } | 6683 } |
| 6681 return Object::null(); | 6684 return Object::null(); |
| 6682 } | 6685 } |
| 6683 | 6686 |
| 6684 | 6687 |
| 6688 // TODO(regis): This should take an Error* ambiguity_error parameter. | |
| 6685 RawClass* Library::LookupClass(const String& name) const { | 6689 RawClass* Library::LookupClass(const String& name) const { |
| 6686 Object& obj = Object::Handle(LookupObject(name)); | 6690 Object& obj = Object::Handle(LookupObject(name)); |
| 6687 if (!obj.IsNull() && obj.IsClass()) { | 6691 if (!obj.IsNull() && obj.IsClass()) { |
| 6688 return Class::Cast(obj).raw(); | 6692 return Class::Cast(obj).raw(); |
| 6689 } | 6693 } |
| 6690 return Class::null(); | 6694 return Class::null(); |
| 6691 } | 6695 } |
| 6692 | 6696 |
| 6693 | 6697 |
| 6694 RawClass* Library::LookupLocalClass(const String& name) const { | 6698 RawClass* Library::LookupLocalClass(const String& name) const { |
| (...skipping 7450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14145 } | 14149 } |
| 14146 | 14150 |
| 14147 | 14151 |
| 14148 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14152 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14149 stream->OpenObject(); | 14153 stream->OpenObject(); |
| 14150 stream->CloseObject(); | 14154 stream->CloseObject(); |
| 14151 } | 14155 } |
| 14152 | 14156 |
| 14153 | 14157 |
| 14154 } // namespace dart | 14158 } // namespace dart |
| OLD | NEW |