import org.simantics.scl.compiler.elaboration.java.JavaMethodDeclaration;
import org.simantics.scl.compiler.elaboration.macros.StandardMacroRule;
import org.simantics.scl.compiler.elaboration.modules.DeprecatedProperty;
+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;
import org.simantics.scl.compiler.environment.Environment;
import org.simantics.scl.compiler.environment.EnvironmentFactory;
import org.simantics.scl.compiler.environment.Environments;
+import org.simantics.scl.compiler.errors.CompilationError;
import org.simantics.scl.compiler.errors.ErrorLog;
+import org.simantics.scl.compiler.errors.ErrorSeverity;
import org.simantics.scl.compiler.errors.Locations;
import org.simantics.scl.compiler.internal.codegen.effects.EffectConstructor;
import org.simantics.scl.compiler.internal.codegen.effects.ThreadLocalVariable;
compilationContext.environment = new EnvironmentOfModule(importedEnvironment, module);
} catch (ImportFailureException e) {
for(ImportFailure failure : e.failures)
- errorLog.log(failure.location, failure.toString());
+ errorLog.log(new CompilationError(failure.location, failure.toString(), ErrorSeverity.IMPORT_ERROR));
return;
}
for(ImportDeclaration importAst : importsAst)
dataTypes.add(dataType);
for(int j=0;j<constructors.length;++j) {
ConstructorAst constructor = dataTypeAst.constructors[j];
- String name = constructor.name;
+ String name = constructor.name.text;
Type[] parameterTypes = new Type[constructor.parameters.length];
for(int i=constructor.parameters.length-1;i>=0;--i)
parameterTypes[i] = context.toType(constructor.parameters[i]);
String fullName = instancePrefix + valueName;
long loc = valueDefs.getDefinition(valueName).get(0).location;
valueDefinitionsAst.addFrom(valueDefs, valueName, fullName);
+ valueDefinitionsAst.setDerived(fullName);
/*valueDefinitionsAst.addAnnotation(fullName, new DAnnotationAst(new EVar("@private"),
Collections.<Expression>emptyList()));*/
TypeClassMethod method = typeClass.methods.get(valueName);
int constructorTag = 0;
for(Constructor constructor : dataType.constructors) {
SCLValue value = new SCLValue(constructor.name);
+ value.definitionLocation = constructor.loc;
SCLConstructor sclConstructor =
new SCLConstructor(
constructor.name.name,
value.definitionLocation = location;
if(module.addValue(value))
errorLog.log(location, "Value " + name + " is already defined.");
+ if(valueDefinitionsAst.isDerived(name))
+ value.addProperty(DerivedProperty.INSTANCE);
}
for(DValueTypeAst valueTypeAst : typeAnnotationsAst)
for(EVar name : valueTypeAst.names) {