Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(989)

Side by Side Diff: runtime/vm/exceptions.cc

Issue 10977078: Rename CastException to CastError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Now without the TODO. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "vm/stack_frame.h" 11 #include "vm/stack_frame.h"
12 #include "vm/stub_code.h" 12 #include "vm/stub_code.h"
13 #include "vm/symbols.h" 13 #include "vm/symbols.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 DEFINE_FLAG(bool, print_stacktrace_at_throw, false, 17 DEFINE_FLAG(bool, print_stacktrace_at_throw, false,
18 "Prints a stack trace everytime a throw occurs."); 18 "Prints a stack trace everytime a throw occurs.");
19 19
20 20
21 const char* Exceptions::kCastExceptionDstName = "type cast"; 21 const char* Exceptions::kCastErrorDstName = "type cast";
22 22
23 23
24 // Iterate through the stack frames and try to find a frame with an 24 // Iterate through the stack frames and try to find a frame with an
25 // exception handler. Once found, set the pc, sp and fp so that execution 25 // exception handler. Once found, set the pc, sp and fp so that execution
26 // can continue in that frame. 26 // can continue in that frame.
27 static bool FindExceptionHandler(uword* handler_pc, 27 static bool FindExceptionHandler(uword* handler_pc,
28 uword* handler_sp, 28 uword* handler_sp,
29 uword* handler_fp, 29 uword* handler_fp,
30 const GrowableObjectArray& func_list, 30 const GrowableObjectArray& func_list,
31 const GrowableObjectArray& code_list, 31 const GrowableObjectArray& code_list,
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 SetField(instance, cls, "column", Smi::Handle(Smi::New(column))); 249 SetField(instance, cls, "column", Smi::Handle(Smi::New(column)));
250 } 250 }
251 251
252 252
253 // Allocate, initialize, and throw a TypeError. 253 // Allocate, initialize, and throw a TypeError.
254 void Exceptions::CreateAndThrowTypeError(intptr_t location, 254 void Exceptions::CreateAndThrowTypeError(intptr_t location,
255 const String& src_type_name, 255 const String& src_type_name,
256 const String& dst_type_name, 256 const String& dst_type_name,
257 const String& dst_name, 257 const String& dst_name,
258 const String& malformed_error) { 258 const String& malformed_error) {
259 // Allocate a new instance of TypeError or CastException. 259 // Allocate a new instance of TypeError or CastError.
260 Instance& type_error = Instance::Handle(); 260 Instance& type_error = Instance::Handle();
261 Class& cls = Class::Handle(); 261 Class& cls = Class::Handle();
262 if (dst_name.Equals(kCastExceptionDstName)) { 262 if (dst_name.Equals(kCastErrorDstName)) {
263 type_error = NewInstance("CastExceptionImplementation"); 263 type_error = NewInstance("CastErrorImplementation");
264 cls = type_error.clazz(); 264 cls = type_error.clazz();
265 cls = cls.SuperClass(); 265 cls = cls.SuperClass();
266 } else { 266 } else {
267 type_error = NewInstance("TypeErrorImplementation"); 267 type_error = NewInstance("TypeErrorImplementation");
268 cls = type_error.clazz(); 268 cls = type_error.clazz();
269 } 269 }
270 270
271 // Initialize 'url', 'line', and 'column' fields. 271 // Initialize 'url', 'line', and 'column' fields.
272 DartFrameIterator iterator; 272 DartFrameIterator iterator;
273 const Script& script = Script::Handle(GetCallerScript(&iterator)); 273 const Script& script = Script::Handle(GetCallerScript(&iterator));
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 case kIsolateSpawn: 432 case kIsolateSpawn:
433 library = Library::IsolateLibrary(); 433 library = Library::IsolateLibrary();
434 class_name = Symbols::New("IsolateSpawnException"); 434 class_name = Symbols::New("IsolateSpawnException");
435 break; 435 break;
436 } 436 }
437 437
438 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); 438 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments);
439 } 439 }
440 440
441 } // namespace dart 441 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698