gboolean _gdart_marshaller_check_argument_string(GdartBridgeContext *self,
    Dart_Handle element,
    gpointer arg_type,
    const TypeInfoKlass *arg_type_klass,
    Dart_Handle *dart_error_out,
    GError **error)
{
  if (!Dart_IsString(element) && !Dart_IsNull(element)) {
    *dart_error_out = gdart_bridge_context_create_error_handle(self,
                      "%s: expected string or null", G_STRFUNC);
    g_set_error(error, GDART_ERROR, 1,
                "%s: expected string or null", G_STRFUNC);
    goto error;
  }
  return TRUE;
error:
  return FALSE;
}
Ejemplo n.º 2
0
Dart_NativeFunction ResolveName(Dart_Handle name,
                                int argc,
                                bool* auto_setup_scope) {
  *auto_setup_scope = true;
  Dart_NativeFunction result;
  if (!Dart_IsString(name)) return NULL;
  Dart_EnterScope();
  const char* cname;
  HandleError(Dart_StringToCString(name, &cname));

  for (int i=0; function_list[i].name != NULL; ++i) {
    if (strcmp(function_list[i].name, cname) == 0) {
      result = function_list[i].function;
      break;
    }
  }
  
  Dart_ExitScope();
  return result; 
  
}