59 {
60 const char* name_;
62 int argument_count_;
64
67 bool* auto_setup_scope) {
68 ASSERT(auto_setup_scope !=
nullptr);
69 *auto_setup_scope = true;
70 TransitionNativeToVM transition(Thread::Current());
71 const Object& obj = Object::Handle(Api::UnwrapHandle(
name));
74 ASSERT(function_name !=
nullptr);
75 int num_entries =
sizeof(
BuiltinEntries) /
sizeof(
struct NativeEntries);
76 for (int i = 0; i < num_entries; i++) {
78 if ((strcmp(function_name, entry->name_) == 0) &&
81 }
82 }
83 return nullptr;
84}
85
86
88 const char* kScriptChars =
89 R"(
90 class UnhandledExceptions {
91 @pragma('vm:external-name', 'Unhandled_equals')
92 external static equals(var obj1, var obj2);
93
94 @pragma('vm:external-name', 'Unhandled_invoke')
95 external static invoke();
96
97 @pragma('vm:external-name', 'Unhandled_invoke2')
98 external static invoke2();
99 }
100 class Second {
101 Second() { }
102 static int method1(int param) {
103 UnhandledExceptions.invoke();
104 return 2;
105 }
106 static int method2() {
107 throw new Second();
108 }
109 static int method3(int param) {
110 try {
111 UnhandledExceptions.invoke2();
112 } on Second catch (e) {
113 return 3;
114 }
115 return 2;
116 }
117 }
118 testMain() {
119 UnhandledExceptions.equals(2, Second.method1(1));
120 UnhandledExceptions.equals(3, Second.method3(1));
121 }
122 )";
123 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, native_lookup);
125}
126
127}
struct _Dart_Handle * Dart_Handle
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
#define UNHANDLED_NATIVE_LIST(V)
#define REGISTER_FUNCTION(name, count)
static Dart_NativeFunction native_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
static struct dart::NativeEntries BuiltinEntries[]
const char *const function_name
Dart_Handle NewString(const char *str)
#define EXPECT_VALID(handle)