OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/exceptions.h" | 5 #include "vm/exceptions.h" |
6 | 6 |
7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 // Static helpers for allocating, initializing, and throwing an error instance. | 201 // Static helpers for allocating, initializing, and throwing an error instance. |
202 | 202 |
203 // Return the script of the Dart function that called the native entry or the | 203 // Return the script of the Dart function that called the native entry or the |
204 // runtime entry. The frame iterator points to the callee. | 204 // runtime entry. The frame iterator points to the callee. |
205 RawScript* Exceptions::GetCallerScript(DartFrameIterator* iterator) { | 205 RawScript* Exceptions::GetCallerScript(DartFrameIterator* iterator) { |
206 StackFrame* caller_frame = iterator->NextFrame(); | 206 StackFrame* caller_frame = iterator->NextFrame(); |
207 ASSERT(caller_frame != NULL && caller_frame->IsDartFrame()); | 207 ASSERT(caller_frame != NULL && caller_frame->IsDartFrame()); |
208 const Function& caller = Function::Handle(caller_frame->LookupDartFunction()); | 208 const Function& caller = Function::Handle(caller_frame->LookupDartFunction()); |
209 ASSERT(!caller.IsNull()); | 209 ASSERT(!caller.IsNull()); |
210 const Class& caller_class = Class::Handle(caller.owner()); | 210 return caller.script(); |
211 return caller_class.script(); | |
212 } | 211 } |
213 | 212 |
214 | 213 |
215 // Allocate a new instance of the given class name. | 214 // Allocate a new instance of the given class name. |
216 // TODO(hausner): Rename this NewCoreInstance to call out the fact that | 215 // TODO(hausner): Rename this NewCoreInstance to call out the fact that |
217 // the class name is resolved in the core library implicitly? | 216 // the class name is resolved in the core library implicitly? |
218 RawInstance* Exceptions::NewInstance(const char* class_name) { | 217 RawInstance* Exceptions::NewInstance(const char* class_name) { |
219 const String& cls_name = String::Handle(Symbols::New(class_name)); | 218 const String& cls_name = String::Handle(Symbols::New(class_name)); |
220 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 219 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
221 Class& cls = Class::Handle(core_lib.LookupClass(cls_name)); | 220 Class& cls = Class::Handle(core_lib.LookupClass(cls_name)); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 case kIsolateSpawn: | 434 case kIsolateSpawn: |
436 library = Library::IsolateLibrary(); | 435 library = Library::IsolateLibrary(); |
437 class_name = Symbols::New("IsolateSpawnException"); | 436 class_name = Symbols::New("IsolateSpawnException"); |
438 break; | 437 break; |
439 } | 438 } |
440 | 439 |
441 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); | 440 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); |
442 } | 441 } |
443 | 442 |
444 } // namespace dart | 443 } // namespace dart |
OLD | NEW |