compile method

JsCompiled compile(
  1. String script, [
  2. String filepath = "<inline>"
])
override

Implementation

JsCompiled compile(String script, [String filepath = "<inline>"]) {
  _arguments[0].setString(script, this);
  _arguments[1].setString(filepath, this);
  return _action(JS_ACTION_COMPILE, 2, block: (results, length) {
    if (length == 2 &&
        results[0].isInt &&
        results[1].type == ARG_TYPE_RAW_POINTER) {
      int len = results[0].intValue;
      Pointer pointer = results[1].ptrValue;
      return IOJsCompiled(pointer, len);
    } else {
      throw Exception("Wrong result");
    }
  });
}