createObject method

HTStruct createObject({
  1. List positionalArgs = const [],
  2. Map<String, dynamic> namedArgs = const {},
  3. List<HTType> typeArgs = const [],
})

Implementation

HTStruct createObject({
  List<dynamic> positionalArgs = const [],
  Map<String, dynamic> namedArgs = const {},
  List<HTType> typeArgs = const [],
}) {
  if (!isResolved) {
    throw HTError.unresolvedNamedStruct(id!);
  }
  if (_self!.containsKey(InternalIdentifier.defaultConstructor)) {
    final constructor =
        _self!.memberGet(InternalIdentifier.defaultConstructor) as HTFunction;
    return constructor.call(
      positionalArgs: positionalArgs,
      namedArgs: namedArgs,
      typeArgs: typeArgs,
    );
  } else {
    return _self!.clone();
  }
}