| 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 "lib/error.h" | 5 #include "lib/error.h" |
| 6 | 6 |
| 7 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" |
| 8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // Initialize field 'dstType'. | 136 // Initialize field 'dstType'. |
| 137 SetField(type_error, cls, "dstType", dst_type_name); | 137 SetField(type_error, cls, "dstType", dst_type_name); |
| 138 | 138 |
| 139 // Initialize field 'dstName'. | 139 // Initialize field 'dstName'. |
| 140 SetField(type_error, cls, "dstName", dst_name); | 140 SetField(type_error, cls, "dstName", dst_name); |
| 141 | 141 |
| 142 // Type errors in the core library may be difficult to diagnose. | 142 // Type errors in the core library may be difficult to diagnose. |
| 143 // Print type error information before throwing the error when debugging. | 143 // Print type error information before throwing the error when debugging. |
| 144 if (FLAG_print_stack_trace_at_throw) { | 144 if (FLAG_print_stack_trace_at_throw) { |
| 145 OS::Print("Type %s is not assignable to type %s of %s.\n", | 145 intptr_t line, column; |
| 146 script.GetTokenLocation(location, &line, &column); |
| 147 OS::Print("'%s': Failed type check: line %d pos %d: " |
| 148 "type '%s' is not assignable to type '%s' of '%s'.\n", |
| 149 String::Handle(script.url()).ToCString(), |
| 150 line, column, |
| 146 src_type_name.ToCString(), | 151 src_type_name.ToCString(), |
| 147 dst_type_name.ToCString(), | 152 dst_type_name.ToCString(), |
| 148 dst_name.ToCString()); | 153 dst_name.ToCString()); |
| 149 } | 154 } |
| 150 // Throw TypeError instance. | 155 // Throw TypeError instance. |
| 151 Exceptions::Throw(type_error); | 156 Exceptions::Throw(type_error); |
| 152 UNREACHABLE(); | 157 UNREACHABLE(); |
| 153 } | 158 } |
| 154 | 159 |
| 155 | 160 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 dst_type_name = element_type.Name(); | 301 dst_type_name = element_type.Name(); |
| 297 } | 302 } |
| 298 const String& dst_name = String::Handle(String::New(buf)); | 303 const String& dst_name = String::Handle(String::New(buf)); |
| 299 ThrowTypeError(location, src_type_name, dst_type_name, dst_name); | 304 ThrowTypeError(location, src_type_name, dst_type_name, dst_name); |
| 300 UNREACHABLE(); | 305 UNREACHABLE(); |
| 301 } | 306 } |
| 302 } | 307 } |
| 303 } | 308 } |
| 304 | 309 |
| 305 } // namespace dart | 310 } // namespace dart |
| OLD | NEW |