use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.NativeFunctionInstance in project legend-pure by finos.
the class AntlrContextToM3CoreInstance method nativeFunction.
private void nativeFunction(NativeFunctionContext ctx, ImportGroup importId, String space, MutableList<CoreInstance> coreInstancesResult) {
this.functionCounter++;
NativeFunctionInstance function = NativeFunctionInstance.createPersistent(this.repository, ctx.qualifiedName().identifier().getText() + this.functionCounter, this.sourceInformation.getPureSourceInformation(ctx.NATIVE().getSymbol(), ctx.qualifiedName().identifier().getStart(), ctx.END_LINE().getSymbol()));
MutableList<String> typeParametersNames = Lists.mutable.empty();
MutableList<String> multiplicityParametersNames = Lists.mutable.empty();
if (ctx.typeAndMultiplicityParameters() != null) {
this.typeParametersAndMultiplicityParameters(ctx.typeAndMultiplicityParameters(), typeParametersNames, multiplicityParametersNames);
}
FunctionType signature = functionTypeSignature(ctx.functionTypeSignature(), function, typeParametersNames, multiplicityParametersNames, importId, spacePlusTabs(space, 1));
function._functionName(ctx.qualifiedName().identifier().getText());
PackageInstance packageInstance = this.buildPackage(ctx.qualifiedName().packagePath());
function._package(packageInstance);
packageInstance._childrenAdd(function);
GenericTypeInstance genericTypeInstance = GenericTypeInstance.createPersistent(this.repository);
Type type = (Type) this.processorSupport.package_getByUserPath(M3Paths.NativeFunction);
genericTypeInstance._rawTypeCoreInstance(type);
GenericTypeInstance genericTypeInstanceTa = GenericTypeInstance.createPersistent(this.repository);
genericTypeInstanceTa._rawTypeCoreInstance(signature);
genericTypeInstance._typeArguments(Lists.mutable.<GenericType>of(genericTypeInstanceTa));
function._classifierGenericType(genericTypeInstance);
coreInstancesResult.add(function);
}
Aggregations