use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.PropertyStub in project legend-pure by finos.
the class NavigationGraphBuilder method visitPropertyWithParametersBlock.
private void visitPropertyWithParametersBlock(PropertyWithParametersContext ctx, MutableList<PathElement> props, Token firstChar) {
MutableList<ValueSpecification> parameters = FastList.newList();
Token property = ctx.VALID_STRING().getSymbol();
ClassInstance ppeType = (ClassInstance) this.processorSupport.package_getByUserPath(M3Paths.PropertyPathElement);
PropertyPathElement propertyPathElement = (PropertyPathElement) this.repository.newAnonymousCoreInstance(this.sourceInformation.getPureSourceInformation(property), ppeType, true);
GenericType classifierGT = GenericTypeInstance.createPersistent(this.repository);
classifierGT._rawTypeCoreInstance(ppeType);
propertyPathElement._classifierGenericType(classifierGT);
PropertyStub propStub = PropertyStubInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(property), null, property.getText());
propertyPathElement._propertyCoreInstance(propStub);
if (ctx.parameter() != null) {
for (ParameterContext parameterContext : ctx.parameter()) {
parameters.add(visitParameterBlock(parameterContext));
}
}
if (!parameters.isEmpty()) {
propertyPathElement._parameters(parameters);
}
props.add(propertyPathElement);
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.PropertyStub in project legend-pure by finos.
the class RootGraphFetchTreeUnbind method unbindPropertyGraphFetchTree.
private void unbindPropertyGraphFetchTree(PropertyGraphFetchTree propertyGraphFetchTree, RootGraphFetchTree mainTree, MatcherState state, Matcher matcher) {
ProcessorSupport processorSupport = state.getProcessorSupport();
PropertyStub property = (PropertyStub) propertyGraphFetchTree._propertyCoreInstance();
CoreInstance resolved = property._resolvedPropertyCoreInstance();
if (resolved != null) {
ReferenceUsage.removeReferenceUsagesForUser(resolved, mainTree, state.getProcessorSupport());
}
Shared.cleanPropertyStub(property, processorSupport);
property._ownerRemove();
for (ValueSpecification vs : propertyGraphFetchTree._parameters()) {
if (vs instanceof InstanceValue) {
for (CoreInstance value : ((InstanceValue) vs)._valuesCoreInstance()) {
Shared.cleanEnumStub(value, processorSupport);
}
vs._genericTypeRemove();
vs._multiplicityRemove();
}
matcher.fullMatch(vs, state);
}
for (GraphFetchTree subTree : propertyGraphFetchTree._subTrees()) {
this.unbindPropertyGraphFetchTree((PropertyGraphFetchTree) subTree, mainTree, state, matcher);
}
ImportStub subTypeClass = (ImportStub) propertyGraphFetchTree._subTypeCoreInstance();
if (subTypeClass != null) {
CoreInstance resolvedSubTypeClass = subTypeClass._resolvedNodeCoreInstance();
if (resolvedSubTypeClass != null) {
ReferenceUsage.removeReferenceUsagesForUser(resolvedSubTypeClass, mainTree, state.getProcessorSupport());
}
Shared.cleanImportStub(subTypeClass, processorSupport);
}
propertyGraphFetchTree._classifierGenericTypeRemove();
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.PropertyStub in project legend-pure by finos.
the class AntlrContextToM3CoreInstance method propertyRef.
private RouteNodePropertyStub propertyRef(PropertyRefContext ctx, ImportGroup importId, String space, RouteNode routeNode) {
RouteNodePropertyStub routeNodePropertyStub = RouteNodePropertyStubInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(ctx.getStart(), ctx.identifier().getStart(), ctx.getStop()), routeNode);
String propertyName = ctx.identifier().getText();
PropertyStub propertyStub = PropertyStubInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(ctx.identifier().getStart()), null, propertyName);
routeNodePropertyStub._propertyCoreInstance(Lists.mutable.<CoreInstance>with(propertyStub));
if (ctx.treePathPropertyParameterType() != null) {
MutableList<InstanceValue> params = Lists.mutable.of();
for (TreePathPropertyParameterTypeContext fCtx : ctx.treePathPropertyParameterType()) {
GenericType type = this.type(fCtx.type(), Lists.mutable.empty(), spacePlusTabs(space, 3), importId, true);
Multiplicity multiplicity = this.buildMultiplicity(fCtx.multiplicity().multiplicityArgument());
InstanceValue iv = InstanceValueInstance.createPersistent(this.repository, type, multiplicity);
params.add(iv);
}
routeNodePropertyStub._parameters(params);
}
return routeNodePropertyStub;
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.PropertyStub in project legend-pure by finos.
the class RootRouteNodePostProcessor method resolvePropertyStub.
private AbstractProperty<?> resolvePropertyStub(Type _class, RouteNodePropertyStub routeNodePropertyStub, Matcher matcher, ProcessorState state, ProcessorSupport processorSupport) {
PropertyStub propertyStubNonResolved = (PropertyStub) routeNodePropertyStub._propertyCoreInstance().getFirst();
propertyStubNonResolved._ownerCoreInstance(_class);
AbstractProperty<?> property = (AbstractProperty<?>) ImportStub.withImportStubByPass(routeNodePropertyStub._propertyCoreInstance().getFirst(), processorSupport);
ListIterable<? extends VariableExpression> parameters = ((FunctionType) processorSupport.function_getFunctionType(property))._parameters().toList();
for (VariableExpression parameter : ListHelper.tail(parameters)) {
// TODO match the parameters
parameter._genericType();
}
PostProcessor.processElement(matcher, routeNodePropertyStub, state, processorSupport);
return property;
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel._import.PropertyStub in project legend-pure by finos.
the class RootRouteNodeUnbind method cleanRouteNodePropertyStub.
public void cleanRouteNodePropertyStub(RouteNodePropertyStub routeNodePropertyStub, UnbindState state, ProcessorSupport processorSupport) {
PropertyStub propertyStub = (PropertyStub) routeNodePropertyStub._propertyCoreInstance().getFirst();
Shared.cleanPropertyStub(propertyStub, processorSupport);
propertyStub._ownerRemove();
for (InstanceValue parameter : routeNodePropertyStub._parameters()) {
GenericType parameterGenericType = parameter._genericType();
Shared.cleanUpGenericType(parameterGenericType, state, processorSupport);
}
}
Aggregations