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

Side by Side Diff: runtime/lib/errors.cc

Issue 21832003: Fix VM implementation of CastError not to extend TypeError (issue 5280). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/lib/error.dart ('k') | runtime/lib/errors_patch.dart » ('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) 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 "lib/error.h"
6
7 #include "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
8 #include "vm/exceptions.h" 6 #include "vm/exceptions.h"
9 #include "vm/object_store.h" 7 #include "vm/object_store.h"
10 #include "vm/runtime_entry.h" 8 #include "vm/runtime_entry.h"
11 #include "vm/stack_frame.h" 9 #include "vm/stack_frame.h"
12 10
13 namespace dart { 11 namespace dart {
14 12
15 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); 13 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks.");
16 14
(...skipping 27 matching lines...) Expand all
44 args.SetAt(1, String::Handle(script.url())); 42 args.SetAt(1, String::Handle(script.url()));
45 args.SetAt(2, Smi::Handle(Smi::New(from_line))); 43 args.SetAt(2, Smi::Handle(Smi::New(from_line)));
46 args.SetAt(3, Smi::Handle(Smi::New(from_column))); 44 args.SetAt(3, Smi::Handle(Smi::New(from_column)));
47 45
48 Exceptions::ThrowByType(Exceptions::kAssertion, args); 46 Exceptions::ThrowByType(Exceptions::kAssertion, args);
49 UNREACHABLE(); 47 UNREACHABLE();
50 return Object::null(); 48 return Object::null();
51 } 49 }
52 50
53 51
54 // Allocate and throw a new TypeError. 52 // Allocate and throw a new TypeError or CastError.
55 // Arg0: index of the token of the failed type check. 53 // Arg0: index of the token of the failed type check.
56 // Arg1: src value. 54 // Arg1: src value.
57 // Arg2: dst type name. 55 // Arg2: dst type name.
58 // Arg3: dst name. 56 // Arg3: dst name.
59 // Arg4: type error message. 57 // Arg4: type error message.
60 // Return value: none, throws an exception. 58 // Return value: none, throws an exception.
61 DEFINE_NATIVE_ENTRY(TypeError_throwNew, 5) { 59 DEFINE_NATIVE_ENTRY(TypeError_throwNew, 5) {
62 // No need to type check the arguments. This function can only be called 60 // No need to type check the arguments. This function can only be called
63 // internally from the VM. 61 // internally from the VM.
64 intptr_t location = Smi::CheckedHandle(arguments->NativeArgAt(0)).Value(); 62 intptr_t location = Smi::CheckedHandle(arguments->NativeArgAt(0)).Value();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 intptr_t line, column; 119 intptr_t line, column;
122 script.GetTokenLocation(error_pos, &line, &column); 120 script.GetTokenLocation(error_pos, &line, &column);
123 args.SetAt(2, Smi::Handle(Smi::New(line))); 121 args.SetAt(2, Smi::Handle(Smi::New(line)));
124 122
125 Exceptions::ThrowByType(Exceptions::kAbstractClassInstantiation, args); 123 Exceptions::ThrowByType(Exceptions::kAbstractClassInstantiation, args);
126 UNREACHABLE(); 124 UNREACHABLE();
127 return Object::null(); 125 return Object::null();
128 } 126 }
129 127
130 } // namespace dart 128 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/error.dart ('k') | runtime/lib/errors_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698