| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 Isolate* isolate = Isolate::Current(); | 291 Isolate* isolate = Isolate::Current(); |
| 292 DARTSCOPE(isolate); | 292 DARTSCOPE(isolate); |
| 293 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | 293 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
| 294 if (obj.IsError()) { | 294 if (obj.IsError()) { |
| 295 Error& error = Error::Handle(isolate); | 295 Error& error = Error::Handle(isolate); |
| 296 error ^= obj.raw(); | 296 error ^= obj.raw(); |
| 297 const char* str = error.ToErrorCString(); | 297 const char* str = error.ToErrorCString(); |
| 298 intptr_t len = strlen(str) + 1; | 298 intptr_t len = strlen(str) + 1; |
| 299 char* str_copy = reinterpret_cast<char*>(Api::Allocate(isolate, len)); | 299 char* str_copy = reinterpret_cast<char*>(Api::Allocate(isolate, len)); |
| 300 strncpy(str_copy, str, len); | 300 strncpy(str_copy, str, len); |
| 301 // Strip a possible trailing '\n'. |
| 302 if ((len > 1) && (str_copy[len - 2] == '\n')) { |
| 303 str_copy[len - 2] = '\0'; |
| 304 } |
| 301 return str_copy; | 305 return str_copy; |
| 302 } else { | 306 } else { |
| 303 return ""; | 307 return ""; |
| 304 } | 308 } |
| 305 } | 309 } |
| 306 | 310 |
| 307 | 311 |
| 308 DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle) { | 312 DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle) { |
| 309 Isolate* isolate = Isolate::Current(); | 313 Isolate* isolate = Isolate::Current(); |
| 310 DARTSCOPE(isolate); | 314 DARTSCOPE(isolate); |
| (...skipping 3321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3632 *buffer_size = 0; | 3636 *buffer_size = 0; |
| 3633 } | 3637 } |
| 3634 } | 3638 } |
| 3635 | 3639 |
| 3636 | 3640 |
| 3637 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { | 3641 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { |
| 3638 Dart::set_flow_graph_writer(function); | 3642 Dart::set_flow_graph_writer(function); |
| 3639 } | 3643 } |
| 3640 | 3644 |
| 3641 } // namespace dart | 3645 } // namespace dart |
| OLD | NEW |