Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted minor fixes and clean-ups #894

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.finos.legend.pure.m3.navigation.function.Function;
import org.finos.legend.pure.m3.navigation.function.FunctionDescriptor;
import org.finos.legend.pure.m3.navigation.function.FunctionType;
import org.finos.legend.pure.m3.navigation.property.Property;
import org.finos.legend.pure.m4.coreinstance.CoreInstance;
import org.finos.legend.pure.m4.coreinstance.SourceInformation;
import org.finos.legend.pure.m4.exception.PureException;
Expand Down Expand Up @@ -137,40 +138,39 @@ public <T extends Appendable> T printPureStackTrace(T appendable, String indent,
this.callStack.toList().reverseForEach(x ->
{
safeAppendable.append('\n').append(indent).append(" ");
CoreInstance func = x.getValueForMetaPropertyToOne(M3Properties.func);
if (func != null)
try
{
if (processorSupport.instance_instanceOf(func, M3Paths.ConcreteFunctionDefinition) || processorSupport.instance_instanceOf(func, M3Paths.NativeFunction))
CoreInstance func = x.getValueForMetaPropertyToOne(M3Properties.func);
if (func == null)
{
FunctionDescriptor.writeFunctionDescriptor(appendable, func, false, processorSupport);
safeAppendable.append("NULL / TODO");
}
else if (processorSupport.instance_instanceOf(func, M3Paths.ConcreteFunctionDefinition) || processorSupport.instance_instanceOf(func, M3Paths.NativeFunction))
{
FunctionDescriptor.writeFunctionDescriptor(safeAppendable, func, false, processorSupport);
}
else if (processorSupport.instance_instanceOf(func, M3Paths.LambdaFunction))
{
safeAppendable.append("Lambda ");
FunctionType.print(appendable, Function.computeFunctionType(func, processorSupport), processorSupport);
FunctionType.print(safeAppendable.append("Lambda "), Function.computeFunctionType(func, processorSupport), processorSupport);
}
else if (processorSupport.instance_instanceOf(func, M3Paths.Property))
else if (Property.isProperty(func, processorSupport))
{
safeAppendable.append("Property ");
safeAppendable.append(func.getValueForMetaPropertyToOne(M3Properties.name).getName());
FunctionType.print(appendable, Function.computeFunctionType(func, processorSupport), processorSupport);
safeAppendable.append("Property ").append(Property.getPropertyName(func));
FunctionType.print(safeAppendable, Function.computeFunctionType(func, processorSupport), processorSupport);
}
else if (processorSupport.instance_instanceOf(func, M3Paths.Column))
{
safeAppendable.append("Column ");
safeAppendable.append(func.getValueForMetaPropertyToOne(M3Properties.name).getName());
FunctionType.print(appendable, Function.computeFunctionType(func, processorSupport), processorSupport);
safeAppendable.append("Column ").append(func.getValueForMetaPropertyToOne(M3Properties.name).getName());
FunctionType.print(safeAppendable, Function.computeFunctionType(func, processorSupport), processorSupport);
}
else
{
safeAppendable.append("Unknown Function Type '");
safeAppendable.append(func.getClassifier().getName());
safeAppendable.append("'");
safeAppendable.append("Unknown Function Type '").append(func.getClassifier().getName()).append("'");
}
}
else
catch (Exception ignore)
{
safeAppendable.append("NULL / TODO");
safeAppendable.append("Error Printing Function");
}
writeSourceInformationMessage(safeAppendable.append(" <- "), x.getSourceInformation(), false);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public void testPackagedElementsContainAllOthers()
.forEach(classifierElementsPair ->
{
MutableList<CoreInstance> classifierElements = classifierElementsPair.getTwo();
builder.append("\n\t\t").append(sourceElementsPair.getOne()).append(" (").append(classifierElements.size()).append(')');
builder.append("\n\t\t").append(classifierElementsPair.getOne()).append(" (").append(classifierElements.size()).append(')');
classifierElements.sortThisBy(CoreInstance::getSourceInformation).forEach(e ->
{
builder.append("\n\t\t\t").append(e);
Expand Down
Loading
Loading