Search in sources :

Example 1 with LetExpressionContext

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;
}
Also used : GenericTypeInstance(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.generics.GenericTypeInstance) FunctionType(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType) Type(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type) GenericType(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.generics.GenericType) SimpleFunctionExpression(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.SimpleFunctionExpression) PrimitiveCoreInstance(org.finos.legend.pure.m4.coreinstance.primitive.PrimitiveCoreInstance) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) ValueSpecification(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.ValueSpecification) InstanceValue(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.InstanceValue) AntlrSourceInformation(org.finos.legend.pure.m4.serialization.grammar.antlr.AntlrSourceInformation) SourceInformation(org.finos.legend.pure.m4.coreinstance.SourceInformation)

Aggregations

FunctionType (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType)1 Type (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type)1 GenericType (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.generics.GenericType)1 GenericTypeInstance (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.generics.GenericTypeInstance)1 InstanceValue (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.InstanceValue)1 SimpleFunctionExpression (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.SimpleFunctionExpression)1 ValueSpecification (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.ValueSpecification)1 CoreInstance (org.finos.legend.pure.m4.coreinstance.CoreInstance)1 SourceInformation (org.finos.legend.pure.m4.coreinstance.SourceInformation)1 PrimitiveCoreInstance (org.finos.legend.pure.m4.coreinstance.primitive.PrimitiveCoreInstance)1 AntlrSourceInformation (org.finos.legend.pure.m4.serialization.grammar.antlr.AntlrSourceInformation)1