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 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3224 return; | 3224 return; |
| 3225 } | 3225 } |
| 3226 const char* internal_class_name = String::Handle(Name()).ToCString(); | 3226 const char* internal_class_name = String::Handle(Name()).ToCString(); |
| 3227 const char* user_visible_class_name = | 3227 const char* user_visible_class_name = |
| 3228 String::Handle(UserVisibleName()).ToCString(); | 3228 String::Handle(UserVisibleName()).ToCString(); |
| 3229 jsobj.AddProperty("type", JSONType(ref)); | 3229 jsobj.AddProperty("type", JSONType(ref)); |
| 3230 jsobj.AddProperty("id", id()); | 3230 jsobj.AddProperty("id", id()); |
| 3231 jsobj.AddProperty("name", internal_class_name); | 3231 jsobj.AddProperty("name", internal_class_name); |
| 3232 jsobj.AddProperty("user_name", user_visible_class_name); | 3232 jsobj.AddProperty("user_name", user_visible_class_name); |
| 3233 if (!ref) { | 3233 if (!ref) { |
| 3234 const Error& err = Error::Handle(EnsureIsFinalized(Isolate::Current())); | |
| 3235 if (!err.IsNull()) { | |
| 3236 jsobj.AddProperty("error", err); | |
| 3237 } | |
|
siva
2013/11/21 19:11:19
This now means classes which have not been compile
| |
| 3234 jsobj.AddProperty("implemented", is_implemented()); | 3238 jsobj.AddProperty("implemented", is_implemented()); |
| 3235 jsobj.AddProperty("abstract", is_abstract()); | 3239 jsobj.AddProperty("abstract", is_abstract()); |
| 3236 jsobj.AddProperty("patch", is_patch()); | 3240 jsobj.AddProperty("patch", is_patch()); |
| 3237 jsobj.AddProperty("finalized", is_finalized()); | 3241 jsobj.AddProperty("finalized", is_finalized()); |
| 3238 jsobj.AddProperty("const", is_const()); | 3242 jsobj.AddProperty("const", is_const()); |
| 3239 jsobj.AddProperty("super", Class::Handle(SuperClass())); | 3243 jsobj.AddProperty("super", Class::Handle(SuperClass())); |
| 3240 jsobj.AddProperty("library", Object::Handle(library())); | 3244 jsobj.AddProperty("library", Object::Handle(library())); |
| 3241 { | 3245 { |
| 3242 JSONArray fields_array(&jsobj, "fields"); | 3246 JSONArray fields_array(&jsobj, "fields"); |
| 3243 const Array& field_array = Array::Handle(fields()); | 3247 const Array& field_array = Array::Handle(fields()); |
| (...skipping 7375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10619 | 10623 |
| 10620 const char* Error::ToCString() const { | 10624 const char* Error::ToCString() const { |
| 10621 // Error is an abstract class. We should never reach here. | 10625 // Error is an abstract class. We should never reach here. |
| 10622 UNREACHABLE(); | 10626 UNREACHABLE(); |
| 10623 return "Error"; | 10627 return "Error"; |
| 10624 } | 10628 } |
| 10625 | 10629 |
| 10626 | 10630 |
| 10627 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10631 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10628 JSONObject jsobj(stream); | 10632 JSONObject jsobj(stream); |
| 10633 jsobj.AddProperty("type", JSONType(false)); | |
| 10634 jsobj.AddProperty("error_msg", ToErrorCString()); | |
| 10629 } | 10635 } |
| 10630 | 10636 |
| 10631 | 10637 |
| 10632 RawApiError* ApiError::New() { | 10638 RawApiError* ApiError::New() { |
| 10633 ASSERT(Object::api_error_class() != Class::null()); | 10639 ASSERT(Object::api_error_class() != Class::null()); |
| 10634 RawObject* raw = Object::Allocate(ApiError::kClassId, | 10640 RawObject* raw = Object::Allocate(ApiError::kClassId, |
| 10635 ApiError::InstanceSize(), | 10641 ApiError::InstanceSize(), |
| 10636 Heap::kOld); | 10642 Heap::kOld); |
| 10637 return reinterpret_cast<RawApiError*>(raw); | 10643 return reinterpret_cast<RawApiError*>(raw); |
| 10638 } | 10644 } |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 10664 } | 10670 } |
| 10665 | 10671 |
| 10666 | 10672 |
| 10667 const char* ApiError::ToCString() const { | 10673 const char* ApiError::ToCString() const { |
| 10668 return "ApiError"; | 10674 return "ApiError"; |
| 10669 } | 10675 } |
| 10670 | 10676 |
| 10671 | 10677 |
| 10672 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10678 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10673 JSONObject jsobj(stream); | 10679 JSONObject jsobj(stream); |
| 10680 jsobj.AddProperty("type", JSONType(false)); | |
| 10681 jsobj.AddProperty("error_msg", ToErrorCString()); | |
| 10674 } | 10682 } |
| 10675 | 10683 |
| 10676 | 10684 |
| 10677 RawLanguageError* LanguageError::New() { | 10685 RawLanguageError* LanguageError::New() { |
| 10678 ASSERT(Object::language_error_class() != Class::null()); | 10686 ASSERT(Object::language_error_class() != Class::null()); |
| 10679 RawObject* raw = Object::Allocate(LanguageError::kClassId, | 10687 RawObject* raw = Object::Allocate(LanguageError::kClassId, |
| 10680 LanguageError::InstanceSize(), | 10688 LanguageError::InstanceSize(), |
| 10681 Heap::kOld); | 10689 Heap::kOld); |
| 10682 return reinterpret_cast<RawLanguageError*>(raw); | 10690 return reinterpret_cast<RawLanguageError*>(raw); |
| 10683 } | 10691 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10848 } | 10856 } |
| 10849 | 10857 |
| 10850 | 10858 |
| 10851 const char* LanguageError::ToCString() const { | 10859 const char* LanguageError::ToCString() const { |
| 10852 return "LanguageError"; | 10860 return "LanguageError"; |
| 10853 } | 10861 } |
| 10854 | 10862 |
| 10855 | 10863 |
| 10856 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10864 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10857 JSONObject jsobj(stream); | 10865 JSONObject jsobj(stream); |
| 10866 jsobj.AddProperty("type", JSONType(false)); | |
| 10867 jsobj.AddProperty("error_msg", ToErrorCString()); | |
| 10858 } | 10868 } |
| 10859 | 10869 |
| 10860 | 10870 |
| 10861 RawUnhandledException* UnhandledException::New(const Instance& exception, | 10871 RawUnhandledException* UnhandledException::New(const Instance& exception, |
| 10862 const Instance& stacktrace, | 10872 const Instance& stacktrace, |
| 10863 Heap::Space space) { | 10873 Heap::Space space) { |
| 10864 ASSERT(Object::unhandled_exception_class() != Class::null()); | 10874 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 10865 UnhandledException& result = UnhandledException::Handle(); | 10875 UnhandledException& result = UnhandledException::Handle(); |
| 10866 { | 10876 { |
| 10867 RawObject* raw = Object::Allocate(UnhandledException::kClassId, | 10877 RawObject* raw = Object::Allocate(UnhandledException::kClassId, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10922 | 10932 |
| 10923 | 10933 |
| 10924 const char* UnhandledException::ToCString() const { | 10934 const char* UnhandledException::ToCString() const { |
| 10925 return "UnhandledException"; | 10935 return "UnhandledException"; |
| 10926 } | 10936 } |
| 10927 | 10937 |
| 10928 | 10938 |
| 10929 void UnhandledException::PrintToJSONStream(JSONStream* stream, | 10939 void UnhandledException::PrintToJSONStream(JSONStream* stream, |
| 10930 bool ref) const { | 10940 bool ref) const { |
| 10931 JSONObject jsobj(stream); | 10941 JSONObject jsobj(stream); |
| 10942 jsobj.AddProperty("type", JSONType(false)); | |
| 10943 jsobj.AddProperty("error_msg", ToErrorCString()); | |
| 10932 } | 10944 } |
| 10933 | 10945 |
| 10934 | 10946 |
| 10935 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { | 10947 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { |
| 10936 ASSERT(Object::unwind_error_class() != Class::null()); | 10948 ASSERT(Object::unwind_error_class() != Class::null()); |
| 10937 UnwindError& result = UnwindError::Handle(); | 10949 UnwindError& result = UnwindError::Handle(); |
| 10938 { | 10950 { |
| 10939 RawObject* raw = Object::Allocate(UnwindError::kClassId, | 10951 RawObject* raw = Object::Allocate(UnwindError::kClassId, |
| 10940 UnwindError::InstanceSize(), | 10952 UnwindError::InstanceSize(), |
| 10941 space); | 10953 space); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 10958 } | 10970 } |
| 10959 | 10971 |
| 10960 | 10972 |
| 10961 const char* UnwindError::ToCString() const { | 10973 const char* UnwindError::ToCString() const { |
| 10962 return "UnwindError"; | 10974 return "UnwindError"; |
| 10963 } | 10975 } |
| 10964 | 10976 |
| 10965 | 10977 |
| 10966 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10978 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10967 JSONObject jsobj(stream); | 10979 JSONObject jsobj(stream); |
| 10980 jsobj.AddProperty("type", JSONType(false)); | |
| 10981 jsobj.AddProperty("error_msg", ToErrorCString()); | |
| 10968 } | 10982 } |
| 10969 | 10983 |
| 10970 | 10984 |
| 10971 RawObject* Instance::Evaluate(const String& expr) const { | 10985 RawObject* Instance::Evaluate(const String& expr) const { |
| 10972 const Class& cls = Class::Handle(clazz()); | 10986 const Class& cls = Class::Handle(clazz()); |
| 10973 const PatchClass& temp_class = | 10987 const PatchClass& temp_class = |
| 10974 PatchClass::Handle(MakeTempPatchClass(cls, expr)); | 10988 PatchClass::Handle(MakeTempPatchClass(cls, expr)); |
| 10975 const String& eval_func_name = String::Handle(Symbols::New(":eval")); | 10989 const String& eval_func_name = String::Handle(Symbols::New(":eval")); |
| 10976 const Function& eval_func = | 10990 const Function& eval_func = |
| 10977 Function::Handle(Function::New(eval_func_name, | 10991 Function::Handle(Function::New(eval_func_name, |
| (...skipping 4941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15919 return "_MirrorReference"; | 15933 return "_MirrorReference"; |
| 15920 } | 15934 } |
| 15921 | 15935 |
| 15922 | 15936 |
| 15923 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15937 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 15924 JSONObject jsobj(stream); | 15938 JSONObject jsobj(stream); |
| 15925 } | 15939 } |
| 15926 | 15940 |
| 15927 | 15941 |
| 15928 } // namespace dart | 15942 } // namespace dart |
| OLD | NEW |