import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
import org.simantics.scl.compiler.elaboration.expressions.Expression;
import org.simantics.scl.compiler.elaboration.macros.StandardMacroRule;
+import org.simantics.scl.compiler.elaboration.modules.DerivedProperty;
import org.simantics.scl.compiler.elaboration.modules.InlineProperty;
import org.simantics.scl.compiler.elaboration.modules.MethodImplementation;
import org.simantics.scl.compiler.elaboration.modules.PrivateProperty;
}
public void convertToSSA() {
- ModuleWriter mw = new ModuleWriter(compilationContext.namingPolicy.getModuleClassName());
+ ModuleWriter mw = new ModuleWriter(compilationContext.namingPolicy.getModuleClassName(), compilationContext.lineLocator);
for(SCLValue value : module.getValues()) {
//System.out.println(value.getName().name + " :: " + value.getType());
Expression expression = value.getExpression();
decomposed.typeParameters,
decomposed.returnType,
decomposed.parameterTypes));*/
+ boolean isDerived = false;
for(SCLValueProperty prop : value.getProperties()) {
if(prop instanceof InlineProperty) {
InlineProperty inlineProperty = (InlineProperty)prop;
constant.setInlineArity(inlineProperty.arity, inlineProperty.phaseMask);
}
else if(prop == PrivateProperty.INSTANCE)
- constant.setPrivate(true);
+ constant.setPrivate(!isDerived);
+ else if(prop == DerivedProperty.INSTANCE) {
+ constant.setPrivate(false);
+ isDerived = true;
+ }
}
}
// This is quite hackish optimization that can be possibly removed when
continue;
DecomposedExpression decomposed =
- DecomposedExpression.decompose(expression);
+ DecomposedExpression.decompose(errorLog, expression);
CodeWriter w = mw.createFunction((SCLConstant)value.getValue(),
decomposed.typeParameters,
IVal[] parameterVals = w.getParameters();
for(int i=0;i<decomposed.parameters.length;++i)
decomposed.parameters[i].setVal(parameterVals[i]);
- w.return_(decomposed.body.toVal(compilationContext.environment, w));
+ w.return_(expression.location, decomposed.body.toVal(compilationContext, w));
} catch(RuntimeException e) {
long location = value.getExpression().location;
if(location == Locations.NO_LOCATION)