use of org.finos.legend.pure.m3.serialization.grammar.m3parser.antlr.M3Parser.LetExpressionContext in project legend-pure by finos.
the class AntlrContextToM3CoreInstance method letExpression.
private SimpleFunctionExpression letExpression(LetExpressionContext ctx, MutableList<String> typeParametersNames, ImportGroup importId, LambdaContext lambdaContext, boolean addLines, String space) {
CoreInstance result = this.combinedExpression(ctx.combinedExpression(), "", typeParametersNames, lambdaContext, spacePlusTabs(space, 4), true, importId, addLines);
SourceInformation instanceValueSourceInfo = this.sourceInformation.getPureSourceInformation(ctx.identifier().getStart());
InstanceValue iv = InstanceValueInstance.createPersistent(this.repository, instanceValueSourceInfo, null, null);
iv._values(Lists.mutable.of(this.repository.newStringCoreInstance_cached(ctx.identifier().getText())));
GenericTypeInstance gt = GenericTypeInstance.createPersistent(this.repository, instanceValueSourceInfo);
Type ti = (Type) this.processorSupport.package_getByUserPath("String");
gt._rawTypeCoreInstance(ti);
iv._genericType(gt);
iv._multiplicity(this.getPureOne());
SimpleFunctionExpression sfe = SimpleFunctionExpressionInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(ctx.LET().getSymbol()), null, null, importId, null);
sfe._functionName("letFunction");
sfe._parametersValues(Lists.mutable.of(iv, (ValueSpecification) result));
return sfe;
}
Aggregations