| Index: runtime/vm/dart_api_impl.cc
|
| ===================================================================
|
| --- runtime/vm/dart_api_impl.cc (revision 6193)
|
| +++ runtime/vm/dart_api_impl.cc (working copy)
|
| @@ -81,13 +81,12 @@
|
|
|
|
|
| void SetupErrorResult(Isolate* isolate, Dart_Handle* handle) {
|
| - const Error& error = Error::Handle(
|
| + *handle = Api::NewHandle(
|
| isolate, Isolate::Current()->object_store()->sticky_error());
|
| - *handle = Api::NewLocalHandle(isolate, error);
|
| }
|
|
|
|
|
| -Dart_Handle Api::NewLocalHandle(Isolate* isolate, const Object& object) {
|
| +Dart_Handle Api::NewHandle(Isolate* isolate, RawObject* raw) {
|
| ASSERT(isolate != NULL);
|
| ApiState* state = isolate->api_state();
|
| ASSERT(state != NULL);
|
| @@ -96,7 +95,7 @@
|
| LocalHandles* local_handles = scope->local_handles();
|
| ASSERT(local_handles != NULL);
|
| LocalHandle* ref = local_handles->AllocateHandle();
|
| - ref->set_raw(object);
|
| + ref->set_raw(raw);
|
| return reinterpret_cast<Dart_Handle>(ref);
|
| }
|
|
|
| @@ -191,8 +190,7 @@
|
| va_end(args2);
|
|
|
| const String& message = String::Handle(isolate, String::New(buffer));
|
| - const Object& obj = Object::Handle(isolate, ApiError::New(message));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, ApiError::New(message));
|
| }
|
|
|
|
|
| @@ -297,8 +295,7 @@
|
| if (obj.IsUnhandledException()) {
|
| UnhandledException& error = UnhandledException::Handle(isolate);
|
| error ^= obj.raw();
|
| - const Object& exception = Object::Handle(isolate, error.exception());
|
| - return Api::NewLocalHandle(isolate, exception);
|
| + return Api::NewHandle(isolate, error.exception());
|
| } else if (obj.IsError()) {
|
| return Api::NewError("This error is not an unhandled exception error.");
|
| } else {
|
| @@ -314,8 +311,7 @@
|
| if (obj.IsUnhandledException()) {
|
| UnhandledException& error = UnhandledException::Handle(isolate);
|
| error ^= obj.raw();
|
| - const Object& stacktrace = Object::Handle(isolate, error.stacktrace());
|
| - return Api::NewLocalHandle(isolate, stacktrace);
|
| + return Api::NewHandle(isolate, error.stacktrace());
|
| } else if (obj.IsError()) {
|
| return Api::NewError("This error is not an unhandled exception error.");
|
| } else {
|
| @@ -342,8 +338,7 @@
|
| va_end(args2);
|
|
|
| const String& message = String::Handle(isolate, String::New(buffer));
|
| - const Object& obj = Object::Handle(isolate, ApiError::New(message));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, ApiError::New(message));
|
| }
|
|
|
|
|
| @@ -388,18 +383,16 @@
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
|
| - Object& result = Object::Handle(isolate);
|
| if (obj.IsString()) {
|
| - result = obj.raw();
|
| + return Api::NewHandle(isolate, obj.raw());
|
| } else if (obj.IsInstance()) {
|
| Instance& receiver = Instance::Handle(isolate);
|
| receiver ^= obj.raw();
|
| - result = DartLibraryCalls::ToString(receiver);
|
| + return Api::NewHandle(isolate, DartLibraryCalls::ToString(receiver));
|
| } else {
|
| // This is a VM internal object. Call the C++ method of printing.
|
| - result = String::New(obj.ToCString());
|
| + return Api::NewHandle(isolate, String::New(obj.ToCString()));
|
| }
|
| - return Api::NewLocalHandle(isolate, result);
|
| }
|
|
|
|
|
| @@ -780,7 +773,7 @@
|
| DARTSCOPE(isolate);
|
| const Object& obj = Object::Handle(isolate, isolate->StandardRunLoop());
|
| if (obj.IsError()) {
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, obj.raw());
|
| }
|
| ASSERT(obj.IsNull());
|
| return Api::Success(isolate);
|
| @@ -824,7 +817,7 @@
|
| delete message;
|
| if (result.IsError()) {
|
| // TODO(turnidge): Propagating the error is probably wrong here.
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, result.raw());
|
| }
|
| ASSERT(result.IsNull());
|
| } else {
|
| @@ -834,7 +827,7 @@
|
| message->dest_port(), message->reply_port(), msg));
|
| delete message;
|
| if (result.IsError()) {
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, result.raw());
|
| }
|
| ASSERT(result.IsNull());
|
| }
|
| @@ -930,9 +923,7 @@
|
| DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const Object& result =
|
| - Object::Handle(isolate, DartLibraryCalls::NewSendPort(port_id));
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id));
|
| }
|
|
|
|
|
| @@ -959,9 +950,8 @@
|
| Resolver::kIsQualified));
|
| GrowableArray<const Object*> arguments(kNumArguments);
|
| arguments.Add(&Integer::Handle(isolate, Integer::New(port_id)));
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate, DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| }
|
|
|
|
|
| @@ -1048,7 +1038,7 @@
|
| *value = b.value();
|
| return Api::Success(isolate);
|
| } else if (result.IsError()) {
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, result.raw());
|
| } else {
|
| return Api::NewError("Expected boolean result from ==");
|
| }
|
| @@ -1153,8 +1143,7 @@
|
| DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const Integer& obj = Integer::Handle(isolate, Integer::New(value));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, Integer::New(value));
|
| }
|
|
|
|
|
| @@ -1162,8 +1151,7 @@
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| const String& str_obj = String::Handle(isolate, String::New(str));
|
| - const Integer& obj = Integer::Handle(isolate, Integer::New(str_obj));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, Integer::New(str_obj));
|
| }
|
|
|
|
|
| @@ -1304,8 +1292,7 @@
|
| DART_EXPORT Dart_Handle Dart_NewDouble(double value) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const Double& obj = Double::Handle(isolate, Double::New(value));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, Double::New(value));
|
| }
|
|
|
|
|
| @@ -1367,8 +1354,7 @@
|
| DART_EXPORT Dart_Handle Dart_NewString(const char* str) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const String& obj = String::Handle(isolate, String::New(str));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, String::New(str));
|
| }
|
|
|
|
|
| @@ -1376,8 +1362,7 @@
|
| intptr_t length) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const String& obj = String::Handle(isolate, String::New(codepoints, length));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, String::New(codepoints, length));
|
| }
|
|
|
|
|
| @@ -1385,8 +1370,7 @@
|
| intptr_t length) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const String& obj = String::Handle(isolate, String::New(codepoints, length));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, String::New(codepoints, length));
|
| }
|
|
|
|
|
| @@ -1394,8 +1378,7 @@
|
| intptr_t length) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const String& obj = String::Handle(isolate, String::New(codepoints, length));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, String::New(codepoints, length));
|
| }
|
|
|
|
|
| @@ -1446,10 +1429,8 @@
|
| return Api::NewError("%s expects argument 'length' to be greater than 0.",
|
| CURRENT_FUNC);
|
| }
|
| - const String& obj =
|
| - String::Handle(isolate,
|
| - String::NewExternal(codepoints, length, peer, callback));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(
|
| + isolate, String::NewExternal(codepoints, length, peer, callback));
|
| }
|
|
|
|
|
| @@ -1467,10 +1448,8 @@
|
| return Api::NewError("%s expects argument 'length' to be greater than 0.",
|
| CURRENT_FUNC);
|
| }
|
| - const String& obj =
|
| - String::Handle(isolate,
|
| - String::NewExternal(codepoints, length, peer, callback));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(
|
| + isolate, String::NewExternal(codepoints, length, peer, callback));
|
| }
|
|
|
|
|
| @@ -1488,10 +1467,8 @@
|
| return Api::NewError("%s expects argument 'length' to be greater than 0.",
|
| CURRENT_FUNC);
|
| }
|
| - const String& obj =
|
| - String::Handle(isolate,
|
| - String::NewExternal(codepoints, length, peer, callback));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(
|
| + isolate, String::NewExternal(codepoints, length, peer, callback));
|
| }
|
|
|
|
|
| @@ -1622,8 +1599,7 @@
|
| DART_EXPORT Dart_Handle Dart_NewList(intptr_t length) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const Array& obj = Array::Handle(isolate, Array::New(length));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, Array::New(length));
|
| }
|
|
|
|
|
| @@ -1679,7 +1655,7 @@
|
| "maximum value that 'len' parameter can hold");
|
| }
|
| } else if (retval.IsError()) {
|
| - return Api::NewLocalHandle(isolate, retval);
|
| + return Api::NewHandle(isolate, retval.raw());
|
| } else {
|
| return Api::NewError("Length of List object is not an integer");
|
| }
|
| @@ -1694,8 +1670,7 @@
|
| Array& array_obj = Array::Handle(isolate);
|
| array_obj ^= obj.raw();
|
| if ((index >= 0) && (index < array_obj.Length())) {
|
| - const Object& element = Object::Handle(isolate, array_obj.At(index));
|
| - return Api::NewLocalHandle(isolate, element);
|
| + return Api::NewHandle(isolate, array_obj.At(index));
|
| }
|
| return Api::NewError("Invalid index passed in to access array element");
|
| }
|
| @@ -1714,10 +1689,9 @@
|
| indexobj = Integer::New(index);
|
| args.Add(&indexobj);
|
| const Array& kNoArgumentNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeDynamic(instance, function, args, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| }
|
| }
|
| return Api::NewError("Object does not implement the 'List' interface");
|
| @@ -1760,10 +1734,9 @@
|
| args.Add(&index_obj);
|
| args.Add(&value_obj);
|
| const Array& kNoArgumentNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeDynamic(instance, function, args, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| }
|
| }
|
| return Api::NewError("Object does not implement the 'List' interface");
|
| @@ -1828,7 +1801,7 @@
|
| result = DartEntry::InvokeDynamic(
|
| instance, function, args, kNoArgumentNames);
|
| if (result.IsError()) {
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, result.raw());
|
| }
|
| if (!result.IsInteger()) {
|
| return Api::NewError("%s expects the argument 'list' to be "
|
| @@ -1903,7 +1876,7 @@
|
| DartEntry::InvokeDynamic(
|
| instance, function, args, kNoArgumentNames));
|
| if (result.IsError()) {
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, result.raw());
|
| }
|
| }
|
| return Api::Success(isolate);
|
| @@ -1927,9 +1900,7 @@
|
| DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| - const InternalByteArray& obj =
|
| - InternalByteArray::Handle(isolate, InternalByteArray::New(length));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(isolate, InternalByteArray::New(length));
|
| }
|
|
|
|
|
| @@ -1947,13 +1918,8 @@
|
| return Api::NewError("%s expects argument 'length' to be greater than 0.",
|
| CURRENT_FUNC);
|
| }
|
| - const ExternalByteArray& obj =
|
| - ExternalByteArray::Handle(isolate,
|
| - ExternalByteArray::New(data,
|
| - length,
|
| - peer,
|
| - callback));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + return Api::NewHandle(
|
| + isolate, ExternalByteArray::New(data, length, peer, callback));
|
| }
|
|
|
|
|
| @@ -2186,10 +2152,9 @@
|
| dart_arguments.Add(&arg);
|
| }
|
| const Array& kNoArgumentNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeClosure(closure_obj, dart_arguments, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| }
|
|
|
|
|
| @@ -2240,7 +2205,7 @@
|
| Object::Handle(isolate, Api::UnwrapHandle(arguments[i]));
|
| if (!arg.IsNull() && !arg.IsInstance()) {
|
| if (arg.IsError()) {
|
| - return Api::NewLocalHandle(isolate, arg);
|
| + return Api::NewHandle(isolate, arg.raw());
|
| } else {
|
| return Api::NewError(
|
| "%s expects argument %d to be an instance of Object.",
|
| @@ -2272,10 +2237,9 @@
|
| cls_name.ToCString(),
|
| function_name.ToCString());
|
| }
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeDynamic(instance, function, dart_args, kNoArgNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
|
|
| } else if (obj.IsClass()) {
|
| // Finalize all classes.
|
| @@ -2300,10 +2264,9 @@
|
| cls_name.ToCString(),
|
| function_name.ToCString());
|
| }
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeStatic(function, dart_args, kNoArgNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
|
|
| } else if (obj.IsLibrary()) {
|
| // Check whether class finalization is needed.
|
| @@ -2334,9 +2297,8 @@
|
| CURRENT_FUNC,
|
| function_name.ToCString());
|
| }
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate, DartEntry::InvokeStatic(function, dart_args, kNoArgNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
|
|
| } else {
|
| return Api::NewError(
|
| @@ -2416,10 +2378,9 @@
|
| dart_arguments.Add(&arg);
|
| }
|
| const Array& kNoArgumentNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeStatic(function, dart_arguments, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| }
|
|
|
|
|
| @@ -2464,11 +2425,10 @@
|
| dart_arguments.Add(&arg);
|
| }
|
| const Array& kNoArgumentNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeDynamic(
|
| receiver, function, dart_arguments, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| }
|
|
|
|
|
| @@ -2511,14 +2471,14 @@
|
| const Function& function =
|
| Function::Handle(isolate, cls.LookupStaticFunction(func_name));
|
| if (!function.IsNull()) {
|
| - return Api::NewLocalHandle(isolate, function);
|
| + return Api::NewHandle(isolate, function.raw());
|
| }
|
| return Api::NewError("Specified field is not found in the class");
|
| }
|
| if (fld.IsNull()) {
|
| return Api::NewError("Specified field is not found in the class");
|
| }
|
| - return Api::NewLocalHandle(isolate, fld);
|
| + return Api::NewHandle(isolate, fld.raw());
|
| }
|
|
|
|
|
| @@ -2549,7 +2509,7 @@
|
| if (function.IsNull()) {
|
| return Api::NewError("Unable to find accessor function in the class");
|
| }
|
| - return Api::NewLocalHandle(isolate, function);
|
| + return Api::NewHandle(isolate, function.raw());
|
| }
|
| cls = cls.SuperClass();
|
| }
|
| @@ -2598,10 +2558,9 @@
|
| // Invoke the getter and return the result.
|
| GrowableArray<const Object*> args;
|
| const Array& kNoArgNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeDynamic(instance, getter, args, kNoArgNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
|
|
| } else if (obj.IsClass()) {
|
| // To access a static field we may need to use the Field or the
|
| @@ -2619,12 +2578,10 @@
|
| // Invoke the getter and return the result.
|
| GrowableArray<const Object*> args;
|
| const Array& kNoArgNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate, DartEntry::InvokeStatic(getter, args, kNoArgNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| } else if (!field.IsNull()) {
|
| - const Object& result = Object::Handle(isolate, field.value());
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, field.value());
|
| } else {
|
| return Api::NewError("%s: did not find static field '%s'.",
|
| CURRENT_FUNC, field_name.ToCString());
|
| @@ -2654,12 +2611,10 @@
|
| // Invoke the getter and return the result.
|
| GrowableArray<const Object*> args;
|
| const Array& kNoArgNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate, DartEntry::InvokeStatic(getter, args, kNoArgNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| } else if (!field.IsNull()) {
|
| - const Object& result = Object::Handle(isolate, field.value());
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, field.value());
|
| } else {
|
| return Api::NewError("%s: did not find top-level variable '%s'.",
|
| CURRENT_FUNC, field_name.ToCString());
|
| @@ -2729,10 +2684,9 @@
|
| GrowableArray<const Object*> args(1);
|
| args.Add(&value_instance);
|
| const Array& kNoArgNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeDynamic(instance, setter, args, kNoArgNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
|
|
| } else if (obj.IsClass()) {
|
| // To access a static field we may need to use the Field or the
|
| @@ -2755,7 +2709,7 @@
|
| isolate,
|
| DartEntry::InvokeStatic(setter, args, kNoArgNames));
|
| if (result.IsError()) {
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, result.raw());
|
| } else {
|
| return Api::Success(isolate);
|
| }
|
| @@ -2793,7 +2747,7 @@
|
| const Object& result = Object::Handle(
|
| isolate, DartEntry::InvokeStatic(setter, args, kNoArgNames));
|
| if (result.IsError()) {
|
| - return Api::NewLocalHandle(isolate, result);
|
| + return Api::NewHandle(isolate, result.raw());
|
| } else {
|
| return Api::Success(isolate);
|
| }
|
| @@ -2826,21 +2780,18 @@
|
| if (::Dart_IsError(result)) {
|
| return result;
|
| }
|
| - Object& retval = Object::Handle(isolate);
|
| const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(result));
|
| if (obj.IsField()) {
|
| Field& fld = Field::Handle(isolate);
|
| fld ^= obj.raw();
|
| - retval = fld.value();
|
| - return Api::NewLocalHandle(isolate, retval);
|
| + return Api::NewHandle(isolate, fld.value());
|
| } else {
|
| Function& func = Function::Handle(isolate);
|
| func ^= obj.raw();
|
| GrowableArray<const Object*> args;
|
| const Array& kNoArgumentNames = Array::Handle(isolate);
|
| - const Object& result = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate, DartEntry::InvokeStatic(func, args, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, result);
|
| }
|
| }
|
|
|
| @@ -2866,7 +2817,7 @@
|
| Instance& instance = Instance::Handle(isolate);
|
| instance ^= val.raw();
|
| fld.set_value(instance);
|
| - return Api::NewLocalHandle(isolate, val);
|
| + return Api::NewHandle(isolate, val.raw());
|
| }
|
|
|
|
|
| @@ -2888,10 +2839,9 @@
|
| func ^= Api::UnwrapHandle(result);
|
| GrowableArray<const Object*> arguments;
|
| const Array& kNoArgumentNames = Array::Handle(isolate);
|
| - const Object& retval = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeDynamic(object, func, arguments, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, retval);
|
| }
|
|
|
|
|
| @@ -2916,10 +2866,9 @@
|
| const Object& arg = Object::Handle(isolate, Api::UnwrapHandle(value));
|
| arguments.Add(&arg);
|
| const Array& kNoArgumentNames = Array::Handle(isolate);
|
| - const Object& retval = Object::Handle(
|
| + return Api::NewHandle(
|
| isolate,
|
| DartEntry::InvokeDynamic(object, func, arguments, kNoArgumentNames));
|
| - return Api::NewLocalHandle(isolate, retval);
|
| }
|
|
|
|
|
| @@ -2948,7 +2897,7 @@
|
| return Api::NewError(
|
| "Unable to create native wrapper class : already exists");
|
| }
|
| - return Api::NewLocalHandle(isolate, cls);
|
| + return Api::NewHandle(isolate, cls.raw());
|
| }
|
|
|
|
|
| @@ -3053,15 +3002,13 @@
|
| CURRENT_FUNC, arguments->Count() - 1, index);
|
| }
|
| Isolate* isolate = arguments->isolate();
|
| - DARTSCOPE(isolate);
|
| - const Object& obj = Object::Handle(isolate, arguments->At(index));
|
| - return Api::NewLocalHandle(isolate, obj);
|
| + CHECK_ISOLATE(isolate);
|
| + return Api::NewHandle(isolate, arguments->At(index));
|
| }
|
|
|
|
|
| DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args) {
|
| NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
|
| - CHECK_ISOLATE(arguments->isolate());
|
| return arguments->Count();
|
| }
|
|
|
| @@ -3097,12 +3044,12 @@
|
| ASSERT(isolate != NULL);
|
| const Error& error = Error::Handle(isolate, Compiler::Compile(lib, script));
|
| if (error.IsNull()) {
|
| - *result = Api::NewLocalHandle(isolate, lib);
|
| + *result = Api::NewHandle(isolate, lib.raw());
|
| if (update_lib_status) {
|
| lib.SetLoaded();
|
| }
|
| } else {
|
| - *result = Api::NewLocalHandle(isolate, error);
|
| + *result = Api::NewHandle(isolate, error.raw());
|
| if (update_lib_status) {
|
| lib.SetLoadError();
|
| }
|
| @@ -3181,7 +3128,7 @@
|
| }
|
| library ^= tmp.raw();
|
| isolate->object_store()->set_root_library(library);
|
| - return Api::NewLocalHandle(isolate, library);
|
| + return Api::NewHandle(isolate, library.raw());
|
| }
|
|
|
|
|
| @@ -3191,7 +3138,7 @@
|
| if (error.IsNull()) {
|
| *result = Api::Success(isolate);
|
| } else {
|
| - *result = Api::NewLocalHandle(isolate, error);
|
| + *result = Api::NewHandle(isolate, error.raw());
|
| }
|
| }
|
|
|
| @@ -3237,7 +3184,7 @@
|
| return Api::NewError("Class '%s' not found in library '%s'.",
|
| cls_name.ToCString(), lib_name.ToCString());
|
| }
|
| - return Api::NewLocalHandle(isolate, cls);
|
| + return Api::NewHandle(isolate, cls.raw());
|
| }
|
|
|
|
|
| @@ -3250,7 +3197,7 @@
|
| }
|
| const String& url = String::Handle(isolate, lib.url());
|
| ASSERT(!url.IsNull());
|
| - return Api::NewLocalHandle(isolate, url);
|
| + return Api::NewHandle(isolate, url.raw());
|
| }
|
|
|
|
|
| @@ -3267,7 +3214,7 @@
|
| return Api::NewError("%s: library '%s' not found.",
|
| CURRENT_FUNC, url_str.ToCString());
|
| } else {
|
| - return Api::NewLocalHandle(isolate, library);
|
| + return Api::NewHandle(isolate, library.raw());
|
| }
|
| }
|
|
|
|
|