allocateArray static method

Pointer<JSStaticValue> allocateArray(
  1. Iterable<JSStaticValueDelegate> delegates
)

Implementation

static Pointer<JSStaticValue> allocateArray(Iterable<JSStaticValueDelegate> delegates) {
  final Pointer<JSStaticValue> result = calloc.call(delegates.length + 1); // +1,不然会报错
  for (int i = 0; i < delegates.length; i++) {
    result[i]
      ..name = delegates.elementAt(i).name
      ..getProperty = delegates.elementAt(i).getProperty ?? nullptr
      ..setProperty = delegates.elementAt(i).setProperty ?? nullptr
      ..attributes = delegates.elementAt(i).attributes;
  }
  return result;
}