createJsClass method

Pointer<JsClass> createJsClass()

Implementation

Pointer<JsClass> createJsClass() {
  Pointer<JsClass> jsClass = malloc.allocate(sizeOf<JsClass>());
  jsClass.ref.name = name.toNativeUtf8();
  int len = members.length;
  jsClass.ref.membersLength = len;
  jsClass.ref.members = malloc.allocate(len * sizeOf<JsMember>());
  for (int i = 0; i < len; ++i) {
    var member = jsClass.ref.members[i];
    var memberInfo = members[i];
    member.name = memberInfo.name.toNativeUtf8();
    member.type = memberInfo.type;
  }
  return jsClass;
}