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

Unified Diff: runtime/vm/snapshot_test.cc

Issue 8380020: Refactor the dart api a bit: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot_test.cc
===================================================================
--- runtime/vm/snapshot_test.cc (revision 775)
+++ runtime/vm/snapshot_test.cc (working copy)
@@ -325,7 +325,7 @@
" return obj;\n"
" }\n"
"}\n";
- Dart_Result result;
+ Dart_Handle result;
uint8_t* buffer;
@@ -367,9 +367,8 @@
Dart_NewString("testMain"),
0,
NULL);
- EXPECT(Dart_IsValidResult(result));
- Dart_Handle retobj = Dart_GetResult(result);
- EXPECT(!Dart_ExceptionOccurred(retobj));
+ EXPECT(Dart_IsValid(result));
+ EXPECT(!Dart_ExceptionOccurred(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
@@ -410,14 +409,13 @@
writer.WriteFullSnapshot();
// Invoke a function which returns an object.
- Dart_Result result = Dart_InvokeStatic(lib,
+ Dart_Handle result = Dart_InvokeStatic(lib,
Dart_NewString("FieldsTest"),
Dart_NewString("testMain"),
0,
NULL);
- EXPECT(Dart_IsValidResult(result));
- Dart_Handle retobj = Dart_GetResult(result);
- EXPECT(!Dart_ExceptionOccurred(retobj));
+ EXPECT(Dart_IsValid(result));
+ EXPECT(!Dart_ExceptionOccurred(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
@@ -434,25 +432,25 @@
OS::PrintErr("From Snapshot: %dus\n", timer2.TotalElapsedTime());
// Invoke a function which returns an object.
- Dart_Result result = Dart_InvokeStatic(TestCase::lib(),
+ Dart_Handle result = Dart_InvokeStatic(TestCase::lib(),
Dart_NewString("FieldsTest"),
Dart_NewString("testMain"),
0,
NULL);
- EXPECT(Dart_IsValidResult(result));
- Dart_Handle retobj = Dart_GetResult(result);
- if (Dart_ExceptionOccurred(retobj)) {
+ EXPECT(Dart_IsValid(result));
+ if (Dart_ExceptionOccurred(result)) {
// Print the exception object.
fprintf(stderr, "An unhandled exception has been thrown\n");
- Dart_Result exception_result = Dart_GetException(retobj);
- assert(Dart_IsValidResult(exception_result));
- Dart_Handle retval_string = Dart_GetResult(exception_result);
- Dart_Result retstr = Dart_StringToCString(retval_string);
- const char* obj_cstring = Dart_IsValidResult(retstr) ?
- Dart_GetResultAsCString(retstr) : Dart_GetErrorCString(retstr);
+ Dart_Handle exception_result = Dart_GetException(result);
+ assert(Dart_IsValid(exception_result));
+ const char* obj_cstring = NULL;
+ Dart_Handle retstr = Dart_StringToCString(exception_result, &obj_cstring);
+ if (!Dart_IsValid(retstr)) {
+ obj_cstring = Dart_GetError(retstr);
+ }
fprintf(stderr, "%s", obj_cstring);
}
- EXPECT(!Dart_ExceptionOccurred(retobj));
+ EXPECT(!Dart_ExceptionOccurred(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698