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 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1492 RETURN_TYPE_ERROR(isolate, str, String); | 1492 RETURN_TYPE_ERROR(isolate, str, String); |
1493 } | 1493 } |
1494 *len = str_obj.Length(); | 1494 *len = str_obj.Length(); |
1495 return Api::Success(isolate); | 1495 return Api::Success(isolate); |
1496 } | 1496 } |
1497 | 1497 |
1498 | 1498 |
1499 DART_EXPORT Dart_Handle Dart_NewString(const char* str) { | 1499 DART_EXPORT Dart_Handle Dart_NewString(const char* str) { |
1500 Isolate* isolate = Isolate::Current(); | 1500 Isolate* isolate = Isolate::Current(); |
1501 DARTSCOPE(isolate); | 1501 DARTSCOPE(isolate); |
1502 if (str == NULL) { | |
1503 return Api::NewError("%s expects argument 'str' to be non-null.", | |
hausner
2012/06/20 22:05:25
You can use the macro CHECK_NOT_NULL() for this.
cshapiro
2012/06/20 22:09:06
This turns out to be part of the debugger API. I
| |
1504 CURRENT_FUNC); | |
1505 } | |
1506 if (!Utf8::IsValid(str)) { | |
1507 return Api::NewError("%s expects argument 'str' to be valid UTF-8.", | |
1508 CURRENT_FUNC); | |
1509 } | |
1502 return Api::NewHandle(isolate, String::New(str)); | 1510 return Api::NewHandle(isolate, String::New(str)); |
1503 } | 1511 } |
1504 | 1512 |
1505 | 1513 |
1506 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints, | 1514 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints, |
1507 intptr_t length) { | 1515 intptr_t length) { |
1508 Isolate* isolate = Isolate::Current(); | 1516 Isolate* isolate = Isolate::Current(); |
1509 DARTSCOPE(isolate); | 1517 DARTSCOPE(isolate); |
1510 return Api::NewHandle(isolate, String::New(codepoints, length)); | 1518 return Api::NewHandle(isolate, String::New(codepoints, length)); |
1511 } | 1519 } |
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3648 *buffer_size = 0; | 3656 *buffer_size = 0; |
3649 } | 3657 } |
3650 } | 3658 } |
3651 | 3659 |
3652 | 3660 |
3653 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { | 3661 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { |
3654 Dart::set_flow_graph_writer(function); | 3662 Dart::set_flow_graph_writer(function); |
3655 } | 3663 } |
3656 | 3664 |
3657 } // namespace dart | 3665 } // namespace dart |
OLD | NEW |