--- /dev/null
+*.java text\r
+*.pgraph text\r
+*.scl text\r
+*.xml text\r
+*.svg text\r
+MANIFEST.MF text\r
+\r
+*.tg binary\r
+*.png binary\r
+*.gif binary
\ No newline at end of file
<extension>\r
<groupId>org.eclipse.tycho.extras</groupId>\r
<artifactId>tycho-pomless</artifactId>\r
- <version>0.25.0</version>\r
+ <version>0.26.0</version>\r
</extension>\r
</extensions>
\ No newline at end of file
info.acquireMutex();
try {
info.makeResident();
- return info.getCSSIds();
+ return info.getCCSIds();
} finally {
info.releaseMutex();
}
mainProgram.mutex.release();
}
} catch (IllegalAcornStateException | ProCoreException e) {
- Logger.defaultLogError(e);
+ Logger.defaultLogError("Snapshotting failed", e);
unexpectedClose = true;
} catch (InterruptedException e) {
- Logger.defaultLogError(e);
+ Logger.defaultLogError("Snapshotting interrupted", e);
} finally {
try {
if(tr != null)
try {
support.close();
} catch (DatabaseException e1) {
- Logger.defaultLogError(e1);
+ Logger.defaultLogError("Failed to close database as a safety measure due to failed snapshotting", e1);
}
}
} catch (ProCoreException e) {
- Logger.defaultLogError(e);
+ Logger.defaultLogError("Failed to end snapshotting write transaction", e);
}
}
}
@Override
public long cancelCommit(long transactionId, long changeSetId, byte[] metadata, OnChangeSetUpdate onChangeSetUpdate) throws ProCoreException {
- UnsupportedOperationException e = new UnsupportedOperationException("org.simantics.acorn.GraphClientImpl2.cancelCommit() is not supported operation! Closing down to prevent further havoc");
- clusters.notSafeToMakeSnapshot(new IllegalAcornStateException(e));
- throw e;
-// System.err.println("GraphClientImpl2.cancelCommit() called!! this is experimental and might cause havoc!");
-// try {
-// undo(new long[] {changeSetId}, onChangeSetUpdate);
-// } catch (SDBException e) {
-// e.printStackTrace();
-// throw new ProCoreException(e);
-// }
-// clusters.state.headChangeSetId++;
-// return clusters.state.headChangeSetId;
+ // Accept and finalize current transaction and then undo it
+ acceptCommit(transactionId, changeSetId, metadata);
+
+ try {
+ undo(new long[] {changeSetId+1}, onChangeSetUpdate);
+ clusters.state.headChangeSetId++;
+ return clusters.state.headChangeSetId;
+ } catch (SDBException e) {
+ Logger.defaultLogError("Failed to undo cancelled transaction", e);
+ throw new ProCoreException(e);
+ }
}
@Override
ArrayList<String> ccss = clusters.getChanges(id);
for(int j=0;j<ccss.size();j++) {
+ String ccsid = ccss.get(ccss.size()-j-1);
try {
if(ClusterUpdateProcessorBase.DEBUG)
- System.err.println("performUndo " + ccss.get(ccss.size()-j-1));
- performUndo(ccss.get(ccss.size()-j-1), clusterChanges, support);
+ System.err.println("performUndo " + ccsid);
+ performUndo(ccsid, clusterChanges, support);
} catch (DatabaseException e) {
e.printStackTrace();
}
LRU.insert(this, accessTime);
}
- public ArrayList<String> getCSSIds() throws AcornAccessVerificationException {
+ public ArrayList<String> getCCSIds() throws AcornAccessVerificationException {
if(VERIFY) verifyAccess();
return clusterChangeSetIds;
}
-Xmx500M\r
-Xshare:off\r
-XX:MaxPermSize=192m\r
--Djava.net.preferIPv4Stack=true\r
-Dorg.simantics.workbench.application.showFastViewBars=false\r
-Dorg.simantics.workbench.application.showPerspectiveBar=false\r
-Dorg.simantics.workbench.application.excludePerspectiveFromTitle=true\r
+-Djava.util.Arrays.useLegacyMergeSort=true\r
-Declipse.workaround.bug467000=true\r
</vmArgs>\r
<vmArgsWin>-Dorg.osgi.framework.os.name=win32\r
<feature id="org.simantics.desktop.product" version="1.0.0.qualifier"/>\r
</features>\r
\r
+\r
<preferencesInfo>\r
<targetfile overwrite="false"/>\r
</preferencesInfo>\r
include "Simantics/Entity" hiding (nameOf)\r
import "Simantics/Misc"\r
import "Simantics/Library"\r
-import "Simantics/DrawingTemplate"\r
\r
type Image = Resource\r
\r
Bundle-ManifestVersion: 2
Bundle-Name: General Modeling Workbench Contributions
Bundle-SymbolicName: org.simantics.modeling.ui.workbench;singleton:=true
-Bundle-Version: 1.25.0.qualifier
+Bundle-Version: 1.26.0.qualifier
Bundle-Vendor: Semantum Oy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.ui
"""\r
ACTION_COMPARATOR :: Comparator Action\r
\r
-instance Eq Action where\r
- a == b = compareWithComparator ACTION_COMPARATOR a b == 0\r
-\r
instance Ord Action where\r
compare = compareWithComparator ACTION_COMPARATOR\r
\r
-package org.simantics.modeling.scl;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.Simantics;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.RequestProcessorSpecific;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.request.UnaryRead;\r
-import org.simantics.db.common.request.WriteRequest;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.procedure.SyncListener;\r
-import org.simantics.db.request.Read;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.modeling.ModelingUtils;\r
-import org.simantics.scl.compiler.module.repository.UpdateListener;\r
-import org.simantics.scl.compiler.source.ModuleSource;\r
-import org.simantics.scl.compiler.source.StringModuleSource;\r
-import org.simantics.scl.compiler.source.repository.ModuleSourceRepository;\r
-import org.simantics.scl.runtime.SCLContext;\r
-import org.simantics.structural2.utils.StructuralUtils;\r
-import org.simantics.scl.runtime.tuple.Tuple0;\r
-\r
-import gnu.trove.procedure.TObjectProcedure;\r
-import gnu.trove.set.hash.THashSet;\r
-\r
-public enum GraphModuleSourceRepository implements ModuleSourceRepository {\r
- INSTANCE;\r
-\r
- @Override\r
- public ModuleSource getModuleSource(final String moduleName, UpdateListener listener) {\r
- if(!moduleName.startsWith("http://"))\r
- return null;\r
-\r
- Object graph = SCLContext.getCurrent().get("graph");\r
- RequestProcessorSpecific requestProcessor;\r
- if(graph instanceof ReadGraph)\r
- requestProcessor = (ReadGraph)graph;\r
- else\r
- requestProcessor = Simantics.getSession();\r
-\r
- Read<ModuleSource> request = new ReadModuleSource(moduleName);\r
-\r
- try {\r
- if(listener != null)\r
- return requestProcessor.syncRequest(request, new ModuleListener(listener, moduleName));\r
- else\r
- return requestProcessor.syncRequest(request);\r
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- return null;\r
- }\r
- }\r
-\r
- static class ModuleListener implements SyncListener<ModuleSource> {\r
- UpdateListener listener;\r
- boolean alreadyExecutedOnce;\r
- final String moduleName;\r
- public ModuleListener(UpdateListener listener, String moduleName) {\r
- this.listener = listener;\r
- this.moduleName = moduleName;\r
- }\r
- @Override\r
- public boolean isDisposed() {\r
- return listener == null;\r
- }\r
- private void fireUpdate(ReadGraph graph) {\r
- if(listener != null) {\r
- SCLContext context = SCLContext.getCurrent();\r
- Object oldGraph = context.put("graph", graph);\r
- try {\r
- listener.notifyAboutUpdate();\r
- } finally {\r
- listener = null;\r
- context.put("graph", oldGraph);\r
- }\r
- }\r
- }\r
- @Override\r
- public void execute(ReadGraph graph, ModuleSource result)\r
- throws DatabaseException {\r
- if(alreadyExecutedOnce)\r
- fireUpdate(graph);\r
- else\r
- alreadyExecutedOnce = true;\r
- }\r
- @Override\r
- public void exception(ReadGraph graph, Throwable t)\r
- throws DatabaseException {\r
- t.printStackTrace();\r
- if(alreadyExecutedOnce && listener != null)\r
- fireUpdate(graph);\r
- }\r
- };\r
- \r
- public static class GraphModuleSource extends StringModuleSource {\r
-\r
- private final boolean immutable;\r
-\r
- public GraphModuleSource(String moduleName, ClassLoader classLoader, String moduleText, boolean immutable) {\r
- super(moduleName, classLoader, moduleText);\r
- this.immutable = immutable;\r
- }\r
- \r
- @Override\r
- public boolean isUpdateable() {\r
- return !immutable;\r
- }\r
- \r
- @Override\r
- public void update(String newSourceText) {\r
- try {\r
- Simantics.getSession().syncRequest(new WriteModuleSource(getModuleName(), newSourceText));\r
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
- }\r
-\r
- static class ReadModuleSource extends UnaryRead<String, ModuleSource> {\r
- public ReadModuleSource(String moduleName) {\r
- super(moduleName);\r
- }\r
-\r
- @Override\r
- public ModuleSource perform(ReadGraph graph) throws DatabaseException {\r
- Resource moduleResource = graph.getPossibleResource(parameter);\r
- if(moduleResource == null)\r
- return null;\r
- Layer0 L0 = Layer0.getInstance(graph);\r
- if(!graph.isInstanceOf(moduleResource, L0.SCLModule))\r
- return null;\r
- String text = graph.getRelatedValue(moduleResource, L0.SCLModule_definition);\r
- boolean immutable = StructuralUtils.isImmutable(graph, moduleResource);\r
- return new GraphModuleSource(parameter, getClass().getClassLoader(), text, immutable);\r
- }\r
- }\r
- \r
- static class WriteModuleSource extends WriteRequest {\r
- private final String moduleURI;\r
- private final String sourceText;\r
- \r
- public WriteModuleSource(String moduleURI, String sourceText) {\r
- this.moduleURI = moduleURI;\r
- this.sourceText = sourceText;\r
- }\r
-\r
- @Override\r
- public void perform(WriteGraph graph) throws DatabaseException {\r
- Resource moduleResource = graph.getPossibleResource(moduleURI);\r
- if(moduleResource == null)\r
- return;\r
- Layer0 L0 = Layer0.getInstance(graph);\r
- if(!graph.isInstanceOf(moduleResource, L0.SCLModule))\r
- return;\r
- graph.claimLiteral(moduleResource, L0.SCLModule_definition, sourceText);\r
- }\r
- }\r
-\r
- @Override\r
- public void forAllModules(TObjectProcedure<String> procedure) {\r
- THashSet<String> moduleURIs;\r
- try {\r
- moduleURIs = Simantics.getSession().syncRequest(new Read<THashSet<String>>() {\r
- @Override\r
- public THashSet<String> perform(ReadGraph graph)\r
- throws DatabaseException {\r
- THashSet<String> result = new THashSet<String>(); \r
- Resource projectResource = Simantics.getProjectResource();\r
- Layer0 L0 = Layer0.getInstance(graph);\r
- for(Resource model : graph.getObjects(projectResource, L0.ConsistsOf)) {\r
- if(graph.isInstanceOf(model, L0.IndexRoot)) {\r
- for(Resource module : ModelingUtils.searchByType(graph, model, L0.SCLModule))\r
- result.add(graph.getURI(module));\r
- }\r
- }\r
- \r
- Collection<Resource> ontologies = Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE);\r
- for (Resource ontology : ontologies) {\r
- for(Resource module : ModelingUtils.searchByType(graph, ontology, L0.SCLModule))\r
- result.add(graph.getURI(module));\r
- }\r
- \r
- return result;\r
- }\r
- });\r
- moduleURIs.forEach(procedure);\r
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- @Override\r
- public void checkUpdates() {\r
- }\r
-\r
- @Override\r
- public String getDocumentation(String documentationName) {\r
- return null;\r
- }\r
-\r
- @Override\r
- public void forAllDocumentations(TObjectProcedure<String> procedure) {\r
- }\r
-\r
- @Override\r
- public void clear() {\r
- }\r
-}\r
+package org.simantics.modeling.scl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.simantics.Simantics;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.RequestProcessorSpecific;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.common.request.UnaryRead;
+import org.simantics.db.common.request.WriteRequest;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.procedure.SyncListener;
+import org.simantics.db.request.Read;
+import org.simantics.layer0.Layer0;
+import org.simantics.modeling.ModelingUtils;
+import org.simantics.scl.compiler.module.repository.UpdateListener;
+import org.simantics.scl.compiler.source.ModuleSource;
+import org.simantics.scl.compiler.source.StringModuleSource;
+import org.simantics.scl.compiler.source.repository.ModuleSourceRepository;
+import org.simantics.scl.runtime.SCLContext;
+import org.simantics.structural2.utils.StructuralUtils;
+import org.simantics.scl.runtime.tuple.Tuple0;
+
+import gnu.trove.procedure.TObjectProcedure;
+import gnu.trove.set.hash.THashSet;
+
+public enum GraphModuleSourceRepository implements ModuleSourceRepository {
+ INSTANCE;
+
+ @Override
+ public ModuleSource getModuleSource(final String moduleName, UpdateListener listener) {
+ if(!moduleName.startsWith("http://"))
+ return null;
+
+ Object graph = SCLContext.getCurrent().get("graph");
+ RequestProcessorSpecific requestProcessor;
+ if(graph instanceof ReadGraph)
+ requestProcessor = (ReadGraph)graph;
+ else
+ requestProcessor = Simantics.getSession();
+
+ Read<ModuleSource> request = new ReadModuleSource(moduleName);
+
+ try {
+ if(listener != null)
+ return requestProcessor.syncRequest(request, new ModuleListener(listener, moduleName));
+ else
+ return requestProcessor.syncRequest(request);
+ } catch (DatabaseException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ static class ModuleListener implements SyncListener<ModuleSource> {
+ UpdateListener listener;
+ boolean alreadyExecutedOnce;
+ final String moduleName;
+ public ModuleListener(UpdateListener listener, String moduleName) {
+ this.listener = listener;
+ this.moduleName = moduleName;
+ }
+ @Override
+ public boolean isDisposed() {
+ return listener == null;
+ }
+ private void fireUpdate(ReadGraph graph) {
+ if(listener != null) {
+ SCLContext context = SCLContext.getCurrent();
+ Object oldGraph = context.put("graph", graph);
+ try {
+ listener.notifyAboutUpdate();
+ } finally {
+ listener = null;
+ context.put("graph", oldGraph);
+ }
+ }
+ }
+ @Override
+ public void execute(ReadGraph graph, ModuleSource result)
+ throws DatabaseException {
+ if(alreadyExecutedOnce)
+ fireUpdate(graph);
+ else
+ alreadyExecutedOnce = true;
+ }
+ @Override
+ public void exception(ReadGraph graph, Throwable t)
+ throws DatabaseException {
+ t.printStackTrace();
+ if(alreadyExecutedOnce && listener != null)
+ fireUpdate(graph);
+ }
+ };
+
+ public static class GraphModuleSource extends StringModuleSource {
+
+ private final boolean immutable;
+
+ public GraphModuleSource(String moduleName, ClassLoader classLoader, String moduleText, boolean immutable) {
+ super(moduleName, classLoader, moduleText);
+ this.immutable = immutable;
+ }
+
+ @Override
+ public boolean isUpdateable() {
+ return !immutable;
+ }
+
+ @Override
+ public void update(String newSourceText) {
+ try {
+ Simantics.getSession().syncRequest(new WriteModuleSource(getModuleName(), newSourceText));
+ } catch (DatabaseException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ static class ReadModuleSource extends UnaryRead<String, ModuleSource> {
+ public ReadModuleSource(String moduleName) {
+ super(moduleName);
+ }
+
+ @Override
+ public ModuleSource perform(ReadGraph graph) throws DatabaseException {
+ Resource moduleResource = graph.getPossibleResource(parameter);
+ if(moduleResource == null)
+ return null;
+ Layer0 L0 = Layer0.getInstance(graph);
+ if(!graph.isInstanceOf(moduleResource, L0.SCLModule))
+ return null;
+ String text = graph.getRelatedValue(moduleResource, L0.SCLModule_definition);
+ boolean immutable = StructuralUtils.isImmutable(graph, moduleResource);
+ return new GraphModuleSource(parameter, getClass().getClassLoader(), text, immutable);
+ }
+ }
+
+ static class WriteModuleSource extends WriteRequest {
+ private final String moduleURI;
+ private final String sourceText;
+
+ public WriteModuleSource(String moduleURI, String sourceText) {
+ this.moduleURI = moduleURI;
+ this.sourceText = sourceText;
+ }
+
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+ Resource moduleResource = graph.getPossibleResource(moduleURI);
+ if(moduleResource == null)
+ return;
+ Layer0 L0 = Layer0.getInstance(graph);
+ if(!graph.isInstanceOf(moduleResource, L0.SCLModule))
+ return;
+ graph.claimLiteral(moduleResource, L0.SCLModule_definition, sourceText);
+ }
+ }
+
+ @Override
+ public void forAllModules(TObjectProcedure<String> procedure) {
+ THashSet<String> moduleURIs;
+ try {
+ moduleURIs = Simantics.getSession().syncRequest(new Read<THashSet<String>>() {
+ @Override
+ public THashSet<String> perform(ReadGraph graph)
+ throws DatabaseException {
+ THashSet<String> result = new THashSet<String>();
+ Resource projectResource = Simantics.getProjectResource();
+ Layer0 L0 = Layer0.getInstance(graph);
+ for(Resource model : graph.getObjects(projectResource, L0.ConsistsOf)) {
+ if(graph.isInstanceOf(model, L0.IndexRoot)) {
+ for(Resource module : ModelingUtils.searchByType(graph, model, L0.SCLModule))
+ result.add(graph.getURI(module));
+ }
+ }
+
+ Collection<Resource> ontologies = Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE);
+ for (Resource ontology : ontologies) {
+ for(Resource module : ModelingUtils.searchByType(graph, ontology, L0.SCLModule))
+ result.add(graph.getURI(module));
+ }
+
+ return result;
+ }
+ });
+ moduleURIs.forEach(procedure);
+ } catch (DatabaseException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public Collection<String> getModuleNames() {
+ ArrayList<String> result = new ArrayList<>();
+ forAllModules((String name) -> {
+ result.add(name);
+ return true;
+ });
+ return result;
+ }
+}
\r
import org.simantics.db.Resource;\r
import org.simantics.scl.compiler.common.names.Name;\r
+import org.simantics.scl.compiler.common.names.Names;\r
+import org.simantics.scl.compiler.elaboration.chr.plan.PlanContext;\r
import org.simantics.scl.compiler.elaboration.expressions.EApply;\r
import org.simantics.scl.compiler.elaboration.expressions.EExternalConstant;\r
import org.simantics.scl.compiler.elaboration.expressions.EVariable;\r
import org.simantics.scl.compiler.elaboration.query.compilation.EnforcingContext;\r
import org.simantics.scl.compiler.elaboration.query.compilation.QueryCompilationContext;\r
import org.simantics.scl.compiler.elaboration.relations.SCLRelation;\r
+import org.simantics.scl.compiler.environment.Environment;\r
import org.simantics.scl.compiler.errors.Locations;\r
+import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;\r
import org.simantics.scl.compiler.types.TVar;\r
import org.simantics.scl.compiler.types.Type;\r
import org.simantics.scl.compiler.types.Types;\r
Expression possibleValue = new EApply(\r
Locations.NO_LOCATION,\r
Types.READ_GRAPH,\r
- context.getTypingContext().getConstant(POSSIBLE_RELATED_VALUE, valueType),\r
+ context.getCompilationContext().getConstant(POSSIBLE_RELATED_VALUE, valueType),\r
context.getEvidence(location, Types.pred(Types.SERIALIZABLE, valueType)),\r
new EVariable(parameters[0]),\r
new EExternalConstant(propertyRelation, RESOURCE)\r
case BB: {\r
Variable temp = new Variable("temp", valueType);\r
context.condition(new EApply(\r
- context.getTypingContext().getConstant(Name.create("Prelude", "=="), valueType),\r
+ context.getCompilationContext().getConstant(Names.Builtin_equals, valueType),\r
new Expression[] {\r
- context.getEvidence(location, Types.pred(Types.EQ, valueType)),\r
new EVariable(temp),\r
new EVariable(parameters[1])\r
}\r
return new EApply(\r
Locations.NO_LOCATION,\r
Types.WRITE_GRAPH,\r
- context.getTypingContext().getConstant(CLAIM_RELATED_VALUE, valueType),\r
+ context.getCompilationContext().getConstant(CLAIM_RELATED_VALUE, valueType),\r
context.getEvidence(location, Types.pred(Types.SERIALIZABLE, valueType)),\r
new EVariable(parameters[0]),\r
new EExternalConstant(propertyRelation, RESOURCE),\r
return 0;\r
}\r
\r
+ @Override\r
+ public void generateEnforce(PlanContext context, CodeWriter w, long location, Expression[] parameters) {\r
+ throw new UnsupportedOperationException(getClass().getSimpleName() + " does not support enforce.");\r
+ }\r
+ \r
+ @Override\r
+ public void generateIterate(PlanContext context, CodeWriter w, long location, int boundMask, Variable[] variables,\r
+ Expression[] expressions) {\r
+ throw new UnsupportedOperationException(getClass().getSimpleName() + " does not support iterate.");\r
+ }\r
}\r
\r
import org.simantics.db.Resource;\r
import org.simantics.scl.compiler.common.names.Name;\r
+import org.simantics.scl.compiler.elaboration.chr.plan.PlanContext;\r
import org.simantics.scl.compiler.elaboration.expressions.EApply;\r
import org.simantics.scl.compiler.elaboration.expressions.EExternalConstant;\r
import org.simantics.scl.compiler.elaboration.expressions.EVariable;\r
import org.simantics.scl.compiler.elaboration.query.compilation.EnforcingContext;\r
import org.simantics.scl.compiler.elaboration.query.compilation.QueryCompilationContext;\r
import org.simantics.scl.compiler.elaboration.relations.SCLRelation;\r
+import org.simantics.scl.compiler.environment.Environment;\r
import org.simantics.scl.compiler.errors.Locations;\r
+import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;\r
import org.simantics.scl.compiler.types.TVar;\r
import org.simantics.scl.compiler.types.Type;\r
import org.simantics.scl.compiler.types.Types;\r
context.iterateList(parameters[1], new EApply(\r
Locations.NO_LOCATION,\r
Types.READ_GRAPH,\r
- context.getTypingContext().getConstant(GET_OBJECTS),\r
+ context.getCompilationContext().getConstant(GET_OBJECTS),\r
new EVariable(parameters[0]),\r
new EExternalConstant(relation, Types.RESOURCE)\r
));\r
context.iterateList(parameters[0], new EApply(\r
Locations.NO_LOCATION,\r
Types.READ_GRAPH,\r
- context.getTypingContext().getConstant(GET_OBJECTS),\r
+ context.getCompilationContext().getConstant(GET_OBJECTS),\r
new EVariable(parameters[1]),\r
new EExternalConstant(inverseRelation, Types.RESOURCE)\r
));\r
? new EApply(\r
Locations.NO_LOCATION,\r
Types.READ_GRAPH,\r
- context.getTypingContext().getConstant(HAS_STATEMENT),\r
+ context.getCompilationContext().getConstant(HAS_STATEMENT),\r
new Expression[] {\r
new EVariable(parameters[0]),\r
new EExternalConstant(relation, Types.RESOURCE),\r
: new EApply(\r
Locations.NO_LOCATION,\r
Types.READ_GRAPH,\r
- context.getTypingContext().getConstant(HAS_STATEMENT),\r
+ context.getCompilationContext().getConstant(HAS_STATEMENT),\r
new Expression[] {\r
new EVariable(parameters[1]),\r
new EExternalConstant(inverseRelation, Types.RESOURCE),\r
return new EApply(\r
Locations.NO_LOCATION,\r
Types.WRITE_GRAPH,\r
- context.getTypingContext().getConstant(CLAIM),\r
+ context.getCompilationContext().getConstant(CLAIM),\r
new EVariable(parameters[0]),\r
new EExternalConstant(relation, Types.RESOURCE),\r
new EVariable(parameters[1])\r
return 0;\r
}\r
\r
+ @Override\r
+ public void generateIterate(PlanContext context, CodeWriter w, long location, int boundMask, Variable[] variables,\r
+ Expression[] expressions) {\r
+ Environment env = context.context.environment;\r
+ switch(boundMask) {\r
+ case BF:\r
+ context.iterateList(location, w, variables[1],\r
+ w.apply(location,\r
+ env.getValue(GET_OBJECTS).getValue(),\r
+ expressions[0].toVal(env, w),\r
+ w.getModuleWriter().getExternalConstant(relation, Types.RESOURCE)));\r
+ break;\r
+ case FB:\r
+ if(inverseRelation == null)\r
+ throw new IllegalArgumentException();\r
+ context.iterateList(location, w, variables[0],\r
+ w.apply(location,\r
+ env.getValue(GET_OBJECTS).getValue(),\r
+ expressions[1].toVal(env, w),\r
+ w.getModuleWriter().getExternalConstant(inverseRelation, Types.RESOURCE)));\r
+ break;\r
+ case BB:\r
+ context.check(location, w, \r
+ inverseRelation == null || relationSelectivity <= inverseRelationSelectivity\r
+ ? w.apply(location, env.getValue(HAS_STATEMENT).getValue(), \r
+ expressions[0].toVal(env, w),\r
+ w.getModuleWriter().getExternalConstant(relation, Types.RESOURCE),\r
+ expressions[1].toVal(env, w))\r
+ : w.apply(location, env.getValue(HAS_STATEMENT).getValue(), \r
+ expressions[1].toVal(env, w),\r
+ w.getModuleWriter().getExternalConstant(inverseRelation, Types.RESOURCE),\r
+ expressions[0].toVal(env, w)));\r
+ break;\r
+ default: throw new IllegalArgumentException();\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public void generateEnforce(PlanContext context, CodeWriter w, long location, Expression[] parameters) {\r
+ Environment env = context.context.environment;\r
+ w.apply(location,\r
+ env.getValue(CLAIM).getValue(),\r
+ parameters[0].toVal(env, w),\r
+ w.getModuleWriter().getExternalConstant(relation, Types.RESOURCE),\r
+ parameters[1].toVal(env, w));\r
+ }\r
}\r
-package org.simantics.modeling.scl;\r
-\r
-\r
-import org.simantics.Simantics;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.common.request.UnaryRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.scl.compiler.module.repository.UpdateListener;\r
-import org.simantics.scl.compiler.source.ModuleSource;\r
-import org.simantics.scl.compiler.source.PrecompiledModuleSource;\r
-import org.simantics.scl.compiler.source.repository.ModuleSourceRepository;\r
-import org.simantics.scl.runtime.SCLContext;\r
-\r
-import gnu.trove.procedure.TObjectProcedure;\r
-\r
-public enum OntologyModuleSourceRepository implements ModuleSourceRepository {\r
- INSTANCE;\r
-\r
- static class ModuleSourceRequest extends UnaryRead<String, ModuleSource> {\r
-\r
- public ModuleSourceRequest(String moduleName) {\r
- super(moduleName);\r
- }\r
-\r
- @Override\r
- public ModuleSource perform(ReadGraph graph) throws DatabaseException {\r
- return new PrecompiledModuleSource(new OntologyModule(graph, parameter), -1.0);\r
- }\r
-\r
- };\r
- \r
- @Override\r
- public ModuleSource getModuleSource(final String moduleName,\r
- UpdateListener listener) {\r
- if(!moduleName.startsWith("http://"))\r
- return null; // Don't do a graph request if this cannot be a resource\r
- \r
- ReadGraph graph = (ReadGraph)SCLContext.getCurrent().get("graph");\r
- \r
- try {\r
- if(graph != null) {\r
- return new PrecompiledModuleSource(new OntologyModule(graph, moduleName), -1.0);\r
- }\r
-\r
- return Simantics.getSession().syncRequest(new ModuleSourceRequest(moduleName));\r
- } catch(DatabaseException e) {\r
- e.printStackTrace();\r
- return null;\r
- }\r
- }\r
-\r
- @Override\r
- public void forAllModules(TObjectProcedure<String> procedure) {\r
- }\r
- \r
- @Override\r
- public void checkUpdates() {\r
- }\r
-\r
- @Override\r
- public String getDocumentation(String documentationName) {\r
- return null;\r
- }\r
-\r
- @Override\r
- public void forAllDocumentations(TObjectProcedure<String> procedure) {\r
- }\r
-\r
- @Override\r
- public void clear() {\r
- }\r
-\r
-}\r
+package org.simantics.modeling.scl;
+
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.simantics.Simantics;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.common.request.UnaryRead;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.scl.compiler.module.repository.UpdateListener;
+import org.simantics.scl.compiler.source.ModuleSource;
+import org.simantics.scl.compiler.source.PrecompiledModuleSource;
+import org.simantics.scl.compiler.source.repository.ModuleSourceRepository;
+import org.simantics.scl.runtime.SCLContext;
+
+import gnu.trove.procedure.TObjectProcedure;
+
+public enum OntologyModuleSourceRepository implements ModuleSourceRepository {
+ INSTANCE;
+
+ static class ModuleSourceRequest extends UnaryRead<String, ModuleSource> {
+
+ public ModuleSourceRequest(String moduleName) {
+ super(moduleName);
+ }
+
+ @Override
+ public ModuleSource perform(ReadGraph graph) throws DatabaseException {
+ return new PrecompiledModuleSource(new OntologyModule(graph, parameter), -1.0);
+ }
+
+ };
+
+ @Override
+ public ModuleSource getModuleSource(final String moduleName,
+ UpdateListener listener) {
+ if(!moduleName.startsWith("http://"))
+ return null; // Don't do a graph request if this cannot be a resource
+
+ ReadGraph graph = (ReadGraph)SCLContext.getCurrent().get("graph");
+
+ try {
+ if(graph != null) {
+ return new PrecompiledModuleSource(new OntologyModule(graph, moduleName), -1.0);
+ }
+
+ return Simantics.getSession().syncRequest(new ModuleSourceRequest(moduleName));
+ } catch(DatabaseException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ @Override
+ public void forAllModules(TObjectProcedure<String> procedure) {
+ }
+
+ @Override
+ public Collection<String> getModuleNames() {
+ return Collections.emptyList();
+ }
+
+}
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="src" path="src"/>\r
- <classpathentry kind="src" path="tests"/>\r
- <classpathentry exported="true" kind="lib" path="tools/procyon-decompiler-0.5.29.jar"/>\r
<classpathentry kind="output" path="bin"/>\r
</classpath>\r
+++ /dev/null
-eclipse.preferences.version=1\r
-encoding//tests/org/simantics/scl/compiler/tests/scl/InvalidEncoding.scl=ISO-8859-1\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">\r
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">\r
-<listEntry value="/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/ActiveTests.java"/>\r
-</listAttribute>\r
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">\r
-<listEntry value="1"/>\r
-</listAttribute>\r
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>\r
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>\r
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>\r
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.simantics.scl.compiler.tests.ActiveTests"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.simantics.scl.compiler"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:-UseSplitVerifier"/>\r
-</launchConfiguration>\r
Bundle-ManifestVersion: 2
Bundle-Name: SCL Compiler
Bundle-SymbolicName: org.simantics.scl.compiler
-Bundle-Version: 0.5.0.qualifier
+Bundle-Version: 0.6.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: gnu.trove3;bundle-version="3.0.0",
org.simantics.scl.runtime;bundle-version="0.1.4";visibility:=reexport,
org.junit;bundle-version="4.12.0";resolution:=optional,
org.objectweb.asm;bundle-version="[5.0.0,6.0.0)",
org.objectweb.asm.commons;bundle-version="[5.0.0,6.0.0)",
- org.objectweb.asm.util;bundle-version="[5.0.0,6.0.0)"
+ org.objectweb.asm.util;bundle-version="[5.0.0,6.0.0)",
+ org.slf4j.api;bundle-version="1.7.2"
Export-Package: org.cojen.classfile,
org.simantics.scl.compiler.commands,
org.simantics.scl.compiler.common.datatypes,
org.simantics.scl.compiler.compilation,
org.simantics.scl.compiler.constants,
org.simantics.scl.compiler.constants.generic,
+ org.simantics.scl.compiler.elaboration.chr,
+ org.simantics.scl.compiler.elaboration.chr.plan,
+ org.simantics.scl.compiler.elaboration.chr.planning,
+ org.simantics.scl.compiler.elaboration.chr.relations;x-friends:="org.simantics.scl.compiler.tests",
org.simantics.scl.compiler.elaboration.contexts,
org.simantics.scl.compiler.elaboration.equation,
org.simantics.scl.compiler.elaboration.errors,
org.simantics.scl.compiler.environment.filter,
org.simantics.scl.compiler.environment.specification,
org.simantics.scl.compiler.errors,
+ org.simantics.scl.compiler.internal.codegen.chr;x-friends:="org.simantics.scl.compiler.tests",
+ org.simantics.scl.compiler.internal.codegen.references,
+ org.simantics.scl.compiler.internal.codegen.types;x-friends:="org.simantics.scl.compiler.tests",
+ org.simantics.scl.compiler.internal.codegen.utils;x-friends:="org.simantics.scl.compiler.tests",
+ org.simantics.scl.compiler.internal.codegen.writer,
org.simantics.scl.compiler.internal.elaboration.constraints2,
org.simantics.scl.compiler.internal.elaboration.subsumption,
org.simantics.scl.compiler.internal.parsing,
org.simantics.scl.compiler.types.exceptions,
org.simantics.scl.compiler.types.kinds,
org.simantics.scl.compiler.types.util
-Bundle-ClassPath: tools/procyon-decompiler-0.5.29.jar,
- .
+Bundle-ClassPath: .
Service-Component: OSGI-INF/org.simantics.scl.compiler.source.repository.BuiltinModuleSourceRepository.xml
Import-Package: org.osgi.service.component.annotations
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">\r
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">\r
-<listEntry value="/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/RegressionTests.java"/>\r
-</listAttribute>\r
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">\r
-<listEntry value="1"/>\r
-</listAttribute>\r
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>\r
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>\r
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>\r
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.simantics.scl.compiler.tests.RegressionTests"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.simantics.scl.compiler"/>\r
-</launchConfiguration>\r
output.. = bin/\r
bin.includes = META-INF/,\\r
.,\\r
- tools/procyon-decompiler-0.5.29.jar,\\r
OSGI-INF/org.simantics.scl.compiler.source.repository.BuiltinModuleSourceRepository.xml\r
package org.cojen.classfile;
-import java.io.Serializable;
import java.lang.ref.SoftReference;
import java.lang.reflect.Array;
import java.util.Collections;
* @author Brian S O'Neill
*/
@SuppressWarnings("rawtypes")
-public abstract class TypeDesc extends Descriptor implements Serializable {
+public abstract class TypeDesc extends Descriptor {
/**
* Type code returned from getTypeCode, which can be used with the
* newarray instruction.
+++ /dev/null
-/*
- * Copyright 2004-2010 Brian S O'Neill
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.cojen.util;
-
-import java.util.Arrays;
-
-/**
- * KeyFactory generates keys which can be hashed or compared for any kind of
- * object including arrays, arrays of arrays, and null. All hashcode
- * computations, equality tests, and ordering comparsisons fully recurse into
- * arrays.
- *
- * @author Brian S O'Neill
- */
-@SuppressWarnings({ "rawtypes", "unused", "unchecked", "serial" })
-public class KeyFactory {
- static final Object NULL = new Comparable() {
- public int compareTo(Object obj) {
- return obj == this || obj == null ? 0 : 1;
- }
- };
-
- public static Object createKey(boolean[] obj) {
- return obj == null ? NULL : new BooleanArrayKey(obj);
- }
-
- public static Object createKey(byte[] obj) {
- return obj == null ? NULL : new ByteArrayKey(obj);
- }
-
- public static Object createKey(char[] obj) {
- return obj == null ? NULL : new CharArrayKey(obj);
- }
-
- public static Object createKey(double[] obj) {
- return obj == null ? NULL : new DoubleArrayKey(obj);
- }
-
- public static Object createKey(float[] obj) {
- return obj == null ? NULL : new FloatArrayKey(obj);
- }
-
- public static Object createKey(int[] obj) {
- return obj == null ? NULL : new IntArrayKey(obj);
- }
-
- public static Object createKey(long[] obj) {
- return obj == null ? NULL : new LongArrayKey(obj);
- }
-
- public static Object createKey(short[] obj) {
- return obj == null ? NULL : new ShortArrayKey(obj);
- }
-
- public static Object createKey(Object[] obj) {
- return obj == null ? NULL : new ObjectArrayKey(obj);
- }
-
- public static Object createKey(Object obj) {
- if (obj == null) {
- return NULL;
- }
- if (!obj.getClass().isArray()) {
- return obj;
- }
- if (obj instanceof Object[]) {
- return createKey((Object[])obj);
- } else if (obj instanceof int[]) {
- return createKey((int[])obj);
- } else if (obj instanceof float[]) {
- return createKey((float[])obj);
- } else if (obj instanceof long[]) {
- return createKey((long[])obj);
- } else if (obj instanceof double[]) {
- return createKey((double[])obj);
- } else if (obj instanceof byte[]) {
- return createKey((byte[])obj);
- } else if (obj instanceof char[]) {
- return createKey((char[])obj);
- } else if (obj instanceof boolean[]) {
- return createKey((boolean[])obj);
- } else if (obj instanceof short[]) {
- return createKey((short[])obj);
- } else {
- return obj;
- }
- }
-
- static int hashCode(boolean[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- hash = (hash << 1) + (a[i] ? 0 : 1);
- }
- return hash == 0 ? -1 : hash;
- }
-
- static int hashCode(byte[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- hash = (hash << 1) + a[i];
- }
- return hash == 0 ? -1 : hash;
- }
-
- static int hashCode(char[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- hash = (hash << 1) + a[i];
- }
- return hash == 0 ? -1 : hash;
- }
-
- static int hashCode(double[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- long v = Double.doubleToLongBits(a[i]);
- hash = hash * 31 + (int)(v ^ v >>> 32);
- }
- return hash == 0 ? -1 : hash;
- }
-
- static int hashCode(float[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- hash = hash * 31 + Float.floatToIntBits(a[i]);
- }
- return hash == 0 ? -1 : hash;
- }
-
- static int hashCode(int[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- hash = (hash << 1) + a[i];
- }
- return hash == 0 ? -1 : hash;
- }
-
- static int hashCode(long[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- long v = a[i];
- hash = hash * 31 + (int)(v ^ v >>> 32);
- }
- return hash == 0 ? -1 : hash;
- }
-
- static int hashCode(short[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- hash = (hash << 1) + a[i];
- }
- return hash == 0 ? -1 : hash;
- }
-
- static int hashCode(Object[] a) {
- int hash = 0;
- for (int i = a.length; --i >= 0; ) {
- hash = hash * 31 + hashCode(a[i]);
- }
- return hash == 0 ? -1 : hash;
- }
-
- // Compute object or array hashcode and recurses into arrays within.
- static int hashCode(Object a) {
- if (a == null) {
- return -1;
- }
- if (!a.getClass().isArray()) {
- return a.hashCode();
- }
- if (a instanceof Object[]) {
- return hashCode((Object[])a);
- } else if (a instanceof int[]) {
- return hashCode((int[])a);
- } else if (a instanceof float[]) {
- return hashCode((float[])a);
- } else if (a instanceof long[]) {
- return hashCode((long[])a);
- } else if (a instanceof double[]) {
- return hashCode((double[])a);
- } else if (a instanceof byte[]) {
- return hashCode((byte[])a);
- } else if (a instanceof char[]) {
- return hashCode((char[])a);
- } else if (a instanceof boolean[]) {
- return hashCode((boolean[])a);
- } else if (a instanceof short[]) {
- return hashCode((short[])a);
- } else {
- int hash = a.getClass().hashCode();
- return hash == 0 ? -1 : hash;
- }
- }
-
- // Compares object arrays and recurses into arrays within.
- static boolean equals(Object[] a, Object[] b) {
- if (a == b) {
- return true;
- }
- if (a == null || b == null) {
- return false;
- }
- int i;
- if ((i = a.length) != b.length) {
- return false;
- }
- while (--i >= 0) {
- if (!equals(a[i], b[i])) {
- return false;
- }
- }
- return true;
- }
-
- // Compares objects or arrays and recurses into arrays within.
- static boolean equals(Object a, Object b) {
- if (a == b) {
- return true;
- }
- if (a == null || b == null) {
- return false;
- }
- Class ac = a.getClass();
- if (!(ac.isArray())) {
- return a.equals(b);
- }
- if (ac != b.getClass()) {
- return false;
- }
- if (a instanceof Object[]) {
- return equals((Object[])a, (Object[])b);
- } else if (a instanceof int[]) {
- return Arrays.equals((int[])a, (int[])b);
- } else if (a instanceof float[]) {
- return Arrays.equals((float[])a, (float[])b);
- } else if (a instanceof long[]) {
- return Arrays.equals((long[])a, (long[])b);
- } else if (a instanceof double[]) {
- return Arrays.equals((double[])a, (double[])b);
- } else if (a instanceof byte[]) {
- return Arrays.equals((byte[])a, (byte[])b);
- } else if (a instanceof char[]) {
- return Arrays.equals((char[])a, (char[])b);
- } else if (a instanceof boolean[]) {
- return Arrays.equals((boolean[])a, (boolean[])b);
- } else if (a instanceof short[]) {
- return Arrays.equals((short[])a, (short[])b);
- } else {
- return a.equals(b);
- }
- }
-
- static int compare(boolean[] a, boolean[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- int av = a[i] ? 0 : 1;
- int bv = b[i] ? 0 : 1;
- return av < bv ? -1 : (av > bv ? 1 : 0);
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- static int compare(byte[] a, byte[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- byte av = a[i];
- byte bv = b[i];
- return av < bv ? -1 : (av > bv ? 1 : 0);
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- static int compare(char[] a, char[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- char av = a[i];
- char bv = b[i];
- return av < bv ? -1 : (av > bv ? 1 : 0);
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- static int compare(double[] a, double[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- int v = Double.compare(a[i], b[i]);
- if (v != 0) {
- return v;
- }
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- static int compare(float[] a, float[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- int v = Float.compare(a[i], b[i]);
- if (v != 0) {
- return v;
- }
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- static int compare(int[] a, int[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- int av = a[i];
- int bv = b[i];
- return av < bv ? -1 : (av > bv ? 1 : 0);
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- static int compare(long[] a, long[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- long av = a[i];
- long bv = b[i];
- return av < bv ? -1 : (av > bv ? 1 : 0);
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- static int compare(short[] a, short[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- short av = a[i];
- short bv = b[i];
- return av < bv ? -1 : (av > bv ? 1 : 0);
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- // Compares object arrays and recurses into arrays within.
- static int compare(Object[] a, Object[] b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- int length = Math.min(a.length, b.length);
- for (int i=0; i<length; i++) {
- int v = compare(a[i], b[i]);
- if (v != 0) {
- return v;
- }
- }
- return a.length < b.length ? -1 : (a.length > b.length ? 1 : 0);
- }
-
- // Compares objects or arrays and recurses into arrays within.
- static int compare(Object a, Object b) {
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return 1;
- }
- if (b == null) {
- return -1;
- }
- Class ac = a.getClass();
- if (!(ac.isArray())) {
- return ((Comparable)a).compareTo(b);
- }
- if (ac != b.getClass()) {
- throw new ClassCastException();
- }
- if (a instanceof Object[]) {
- return compare((Object[])a, (Object[])b);
- } else if (a instanceof int[]) {
- return compare((int[])a, (int[])b);
- } else if (a instanceof float[]) {
- return compare((float[])a, (float[])b);
- } else if (a instanceof long[]) {
- return compare((long[])a, (long[])b);
- } else if (a instanceof double[]) {
- return compare((double[])a, (double[])b);
- } else if (a instanceof byte[]) {
- return compare((byte[])a, (byte[])b);
- } else if (a instanceof char[]) {
- return compare((char[])a, (char[])b);
- } else if (a instanceof boolean[]) {
- return compare((boolean[])a, (boolean[])b);
- } else if (a instanceof short[]) {
- return compare((short[])a, (short[])b);
- } else {
- throw new ClassCastException();
- }
- }
-
- protected KeyFactory() {
- }
-
- private static interface ArrayKey extends Comparable, java.io.Serializable {
- int hashCode();
-
- boolean equals(Object obj);
-
- int compareTo(Object obj);
- }
-
- private static class BooleanArrayKey implements ArrayKey {
- protected final boolean[] mArray;
- private transient int mHash;
-
- BooleanArrayKey(boolean[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof BooleanArrayKey ?
- Arrays.equals(mArray, ((BooleanArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((BooleanArrayKey) obj).mArray);
- }
- }
-
- private static class ByteArrayKey implements ArrayKey {
- protected final byte[] mArray;
- private transient int mHash;
-
- ByteArrayKey(byte[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof ByteArrayKey ?
- Arrays.equals(mArray, ((ByteArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((ByteArrayKey) obj).mArray);
- }
- }
-
- private static class CharArrayKey implements ArrayKey {
- protected final char[] mArray;
- private transient int mHash;
-
- CharArrayKey(char[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof CharArrayKey ?
- Arrays.equals(mArray, ((CharArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((CharArrayKey) obj).mArray);
- }
- }
-
- private static class DoubleArrayKey implements ArrayKey {
- protected final double[] mArray;
- private transient int mHash;
-
- DoubleArrayKey(double[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof DoubleArrayKey ?
- Arrays.equals(mArray, ((DoubleArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((DoubleArrayKey) obj).mArray);
- }
- }
-
- private static class FloatArrayKey implements ArrayKey {
- protected final float[] mArray;
- private transient int mHash;
-
- FloatArrayKey(float[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof FloatArrayKey ?
- Arrays.equals(mArray, ((FloatArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((FloatArrayKey) obj).mArray);
- }
- }
-
- private static class IntArrayKey implements ArrayKey {
- protected final int[] mArray;
- private transient int mHash;
-
- IntArrayKey(int[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof IntArrayKey ?
- Arrays.equals(mArray, ((IntArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((IntArrayKey) obj).mArray);
- }
- }
-
- private static class LongArrayKey implements ArrayKey {
- protected final long[] mArray;
- private transient int mHash;
-
- LongArrayKey(long[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof LongArrayKey ?
- Arrays.equals(mArray, ((LongArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((LongArrayKey) obj).mArray);
- }
- }
-
- private static class ShortArrayKey implements ArrayKey {
- protected final short[] mArray;
- private transient int mHash;
-
- ShortArrayKey(short[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof ShortArrayKey ?
- Arrays.equals(mArray, ((ShortArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((ShortArrayKey) obj).mArray);
- }
- }
-
- private static class ObjectArrayKey implements ArrayKey {
- protected final Object[] mArray;
- private transient int mHash;
-
- ObjectArrayKey(Object[] array) {
- mArray = array;
- }
-
- public int hashCode() {
- int hash = mHash;
- return hash == 0 ? mHash = KeyFactory.hashCode(mArray) : hash;
- }
-
- public boolean equals(Object obj) {
- return this == obj ? true :
- (obj instanceof ObjectArrayKey ?
- KeyFactory.equals(mArray, ((ObjectArrayKey) obj).mArray) : false);
- }
-
- public int compareTo(Object obj) {
- return compare(mArray, ((ObjectArrayKey) obj).mArray);
- }
- }
-}
public abstract class ReferencedValueHashMap<K, V> extends AbstractMap<K, V>
implements Map<K, V>, Cloneable
{
+ static final Object NULL = new Comparable() {
+ public int compareTo(Object obj) {
+ return obj == this || obj == null ? 0 : 1;
+ }
+ };
+
private transient Entry<K, V>[] table;
private transient int count;
private int threshold;
public boolean containsValue(Object value) {
if (value == null) {
- value = KeyFactory.NULL;
+ value = NULL;
}
Entry[] tab = this.table;
}
count--;
} else if (e.hash == hash && key.equals(e.key)) {
- return (entryValue == KeyFactory.NULL) ? null : entryValue;
+ return (entryValue == NULL) ? null : entryValue;
} else {
prev = e;
}
}
this.count--;
} else if (e.key == null) {
- return (entryValue == KeyFactory.NULL) ? null : entryValue;
+ return (entryValue == NULL) ? null : entryValue;
} else {
prev = e;
}
public V put(K key, V value) {
if (value == null) {
- value = (V) KeyFactory.NULL;
+ value = (V) NULL;
}
// Makes sure the key is not already in the HashMap.
this.count--;
} else if (e.hash == hash && key.equals(e.key)) {
e.setValue(value);
- return (entryValue == KeyFactory.NULL) ? null : entryValue;
+ return (entryValue == NULL) ? null : entryValue;
} else {
prev = e;
}
this.count--;
} else if (e.key == null) {
e.setValue(value);
- return (entryValue == KeyFactory.NULL) ? null : entryValue;
+ return (entryValue == NULL) ? null : entryValue;
} else {
prev = e;
}
this.count--;
e.setValue(null);
- return (entryValue == KeyFactory.NULL) ? null : entryValue;
+ return (entryValue == NULL) ? null : entryValue;
} else {
prev = e;
}
this.count--;
e.setValue(null);
- return (entryValue == KeyFactory.NULL) ? null : entryValue;
+ return (entryValue == NULL) ? null : entryValue;
} else {
prev = e;
}
public V getValue() {
V value = this.value.get();
- return value == KeyFactory.NULL ? null : value;
+ return value == NULL ? null : value;
}
public V setValue(V value) {
V oldValue = getValue();
- this.value = newReference(value == null ? ((V) KeyFactory.NULL) : value);
+ this.value = newReference(value == null ? ((V) NULL) : value);
return oldValue;
}
Object thisValue = get();
if (thisValue == null) {
return false;
- } else if (thisValue == KeyFactory.NULL) {
+ } else if (thisValue == NULL) {
thisValue = null;
}
return (this.key == null ? e.getKey() == null : this.key.equals(e.getKey())) &&
public boolean containsKey(Object key) {
if (key == null) {
- key = KeyFactory.NULL;
+ key = ReferencedValueHashMap.NULL;
}
Entry[] tab = this.table;
public V get(Object key) {
if (key == null) {
- key = KeyFactory.NULL;
+ key = ReferencedValueHashMap.NULL;
}
Entry<K, V>[] tab = this.table;
public V put(K key, V value) {
if (key == null) {
- key = (K) KeyFactory.NULL;
+ key = (K) ReferencedValueHashMap.NULL;
}
cleanup();
public V remove(Object key) {
if (key == null) {
- key = KeyFactory.NULL;
+ key = ReferencedValueHashMap.NULL;
}
Entry<K, V>[] tab = this.table;
public K getKey() {
K key = Entry.this.get();
- return key == KeyFactory.NULL ? null : key;
+ return key == ReferencedValueHashMap.NULL ? null : key;
}
public V getValue() {
Object thisKey = get();
if (thisKey == null) {
return false;
- } else if (thisKey == KeyFactory.NULL) {
+ } else if (thisKey == ReferencedValueHashMap.NULL) {
thisKey = null;
}
return (thisKey == e.getKey()) &&
import java.util.Map;
import java.util.Set;
-import org.simantics.scl.compiler.common.names.Name;
+import org.simantics.scl.compiler.common.names.Names;
import org.simantics.scl.compiler.constants.StringConstant;
import org.simantics.scl.compiler.elaboration.expressions.EApply;
import org.simantics.scl.compiler.elaboration.expressions.EBlock;
import org.simantics.scl.compiler.top.ExpressionEvaluator;
import org.simantics.scl.compiler.top.LocalStorage;
import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
-import org.simantics.scl.compiler.types.TCon;
import org.simantics.scl.compiler.types.Type;
import org.simantics.scl.compiler.types.Types;
import org.simantics.scl.runtime.SCLContext;
PrintStream fileOutput;
- private static final String CONTEXT_MODULE = "Expressions/Context";
- private static final TCon CONTEXT_TYPE = Types.con(CONTEXT_MODULE, "Context");
- private static final Name CONTEXT_GET = Name.create(CONTEXT_MODULE, "contextGet");
-
public CommandSession(ModuleRepository moduleRepository, SCLReportingHandler handler) {
this.moduleRepository = moduleRepository;
this.defaultHandler = new PrintDecorator(
}, Types.functionE(Types.STRING, Types.PROC, Types.UNIT)));
LOCAL_FUNCTIONS.put("reset", new LocalFunction(new FunctionImpl2<CommandSession, Tuple0, Tuple0>() {
@Override
- public Tuple0 apply(CommandSession commandSession, Tuple0 _) {
+ public Tuple0 apply(CommandSession commandSession, Tuple0 dummy) {
commandSession.removeTransientImports();
commandSession.removeVariables();
commandSession.moduleRepository.getSourceRepository().checkUpdates();
}, Types.functionE(Types.UNIT, Types.PROC, Types.UNIT)));
LOCAL_FUNCTIONS.put("variables", new LocalFunction(new FunctionImpl2<CommandSession, Tuple0, List<String>>() {
@Override
- public List<String> apply(CommandSession commandSession, Tuple0 _) {
+ public List<String> apply(CommandSession commandSession, Tuple0 dummy) {
ArrayList<String> result = new ArrayList<String>(commandSession.variableTypes.keySet());
Collections.sort(result);
return result;
}, Types.functionE(Types.STRING, Types.PROC, Types.UNIT)));
LOCAL_FUNCTIONS.put("stopPrintingToFile", new LocalFunction(new FunctionImpl2<CommandSession, Tuple0, Tuple0>() {
@Override
- public Tuple0 apply(final CommandSession commandSession, Tuple0 _) {
+ public Tuple0 apply(final CommandSession commandSession, Tuple0 dummy) {
if(commandSession.fileOutput != null) {
commandSession.fileOutput.close();
commandSession.fileOutput = null;
private LocalEnvironment createLocalEnvironment() {
return new AbstractLocalEnvironment() {
- Variable contextVariable = new Variable("context", CONTEXT_TYPE);
+ Variable contextVariable = new Variable("context", Names.Expressions_Context_Context);
@Override
public Expression resolve(Environment environment, String localName) {
Type type = variableTypes.get(localName);
if(type != null)
return new EApply(
- new EConstant(environment.getValue(CONTEXT_GET), type),
+ new EConstant(environment.getValue(Names.Expressions_Context_contextGet), type),
new EVariable(contextVariable),
new ELiteral(new StringConstant(localName))
);
--- /dev/null
+package org.simantics.scl.compiler.common.names;\r
+\r
+import org.simantics.scl.compiler.types.TCon;\r
+import org.simantics.scl.compiler.types.Type;\r
+import org.simantics.scl.compiler.types.Types;\r
+\r
+public class Names {\r
+ \r
+ public static final Name ArrayList_add = Name.create("ArrayList", "add");\r
+ public static final Name ArrayList_freeze = Name.create("ArrayList", "freeze");\r
+ public static final Name ArrayList_new = Name.create("ArrayList", "new");\r
+ public static final Name Builtin_equals = Name.create(Types.BUILTIN, "==");\r
+ public static final Name Builtin_fail = Name.create(Types.BUILTIN, "fail");\r
+ public static final Name Builtin_runProc = Name.create(Types.BUILTIN, "runProc");\r
+ public static final Name Data_XML_createElement = Name.create("Data/XML", "createElement");\r
+ public static final Type Data_XML_Element = Types.con("Data/XML", "Element");\r
+ public static final TCon Expressions_Context_Context = Types.con("Expressions/Context", "Context"); \r
+ public static final Name Expressions_Context_contextGet = Name.create("Expressions/Context", "contextGet");\r
+ public static final Name JavaBuiltin_unsafeCoerce = Name.create("JavaBuiltin", "unsafeCoerce");\r
+ public static final Name MList_add = Name.create("MList", "add");\r
+ public static final Name MList_create = Name.create("MList", "create");\r
+ public static final Name MList_removeLast = Name.create("MList", "removeLast");\r
+ public static final TCon MList_T = Types.con("MList", "T");\r
+ public static final Name MSet_add = Name.create("MSet", "add");\r
+ public static final Name MSet_contains = Name.create("MSet", "contains");\r
+ public static final Name MSet_create = Name.create("MSet", "create");\r
+ public static final Name MSet_iter = Name.create("MSet", "iter");\r
+ public static final Name MSet_mapFirst = Name.create("MSet", "mapFirst");\r
+ public static final TCon MSet_T = Types.con("MSet", "T");\r
+ public static final Name Prelude_addList = Name.create("Prelude", "addList");\r
+ public static final Name Prelude_any = Name.create("Prelude", "any");\r
+ public static final Name Prelude_appendList = Name.create("Prelude", "appendList");\r
+ public static final Name Prelude_bind = Name.create("Prelude", ">>=");\r
+ public static final Name Prelude_build = Name.create("Prelude", "build");\r
+ public static final Name Prelude_concatMap = Name.create("Prelude", "concatMap");\r
+ public static final Name Prelude_elem = Name.create("Prelude", "elem");\r
+ public static final Name Prelude_elemMaybe = Name.create("Prelude", "elemMaybe");\r
+ public static final Name Prelude_emptyList = Name.create("Prelude", "emptyList");\r
+ public static final Name Prelude_foldl = Name.create("Prelude", "foldl");\r
+ public static final Name Prelude_fromDouble = Name.create("Prelude", "fromDouble"); \r
+ public static final Name Prelude_fromInteger = Name.create("Prelude", "fromInteger"); \r
+ public static final Name Prelude_guardList = Name.create("Prelude", "guardList");\r
+ public static final Name Prelude_iterList = Name.create("Prelude", "iterList");\r
+ public static final Name Prelude_mapFirst = Name.create("Prelude", "mapFirst");\r
+ public static final Name Prelude_mapList = Name.create("Prelude", "mapList");\r
+ public static final Name Prelude_neg = Name.create("Prelude", "neg");\r
+ public static final Name Prelude_not = Name.create("Prelude", "not");\r
+ public static final Name Prelude_range = Name.create("Prelude", "range");\r
+ public static final Name Prelude_showForPrinting = Name.create("Prelude", "showForPrinting");\r
+ public static final Name Prelude_singletonList = Name.create("Prelude", "singletonList");\r
+ public static final Name R_R_runR = Name.create("R/R", "runR");\r
+ public static final Name Random_runRandom = Name.create("Random", "runRandom");\r
+ public static final Name Serialization_ioSize = Name.create("Serialization", "ioSize");\r
+ public static final Name Serialization_read = Name.create("Serialization", "read");\r
+ public static final Name Serialization_write = Name.create("Serialization", "write");\r
+ public static final Name Simantics_DB_newResource = Name.create("Simantics/DB", "newResource");\r
+ public static final Name Simantics_DB_syncRead = Name.create("Simantics/DB", "syncRead");\r
+ public static final Name Simantics_DB_syncWrite = Name.create("Simantics/DB", "syncWrite");\r
+ public static final Name Simantics_Variables_child_ = Name.create("Simantics/Variables", "child_");\r
+ public static final Name Simantics_Variables_property = Name.create("Simantics/Variables", "property");\r
+ public static final Name Simantics_Variables_untypedPropertyValue = Name.create("Simantics/Variables", "untypedPropertyValue");\r
+ public static final Name Unifiable_createUMap = Name.create("Unification", "createUMap");\r
+ public static final Name Unifiable_extractWithDefault = Name.create("Unification", "extractWithDefault");\r
+ public static final Name Unifiable_getUMapWithDefault = Name.create("Unification", "getUMapWithDefault");\r
+ public static final Name Unifiable_putUMap = Name.create("Unification", "putUMap");\r
+ public static final Name Unifiable_putUMapC = Name.create("Unification", "putUMapC");\r
+ public static final Name Unifiable_uCons = Name.create("Unification", "uCons");\r
+ public static final Name Unifiable_uId = Name.create("Unification", "uId");\r
+ public static final TCon Unifiable_UMap = Types.con("Unification", "UMap");\r
+ public static final TCon Unifiable_Unifiable = Types.con("Unification", "Unifiable");\r
+ public static final Name Unifiable_uPending = Name.create("Unification", "uPending");\r
+ public static final Name Unifiable_uTag = Name.create("Unification", "uTag");\r
+ public static final TCon Unifiable_UTag = Types.con("Unification", "UTag");\r
+ public static final Name Unifiable_uVar = Name.create("Unification", "uVar");\r
+ public static final Name Vector_anyVector = Name.create("Vector", "anyVector");\r
+ public static final Name Vector_concatMapVector = Name.create("Vector", "concatMapVector");\r
+ public static final Name Vector_iterVector = Name.create("Vector", "iterVector");\r
+ public static final Name Vector_mapFirstVector = Name.create("Vector", "mapFirstVector");\r
+ \r
+}\r
import org.simantics.scl.compiler.elaboration.modules.TypeClass;
import org.simantics.scl.compiler.elaboration.modules.TypeClassInstance;
import org.simantics.scl.compiler.elaboration.modules.TypeClassMethod;
-import org.simantics.scl.compiler.environment.Environment;
import org.simantics.scl.compiler.errors.ErrorLog;
import org.simantics.scl.compiler.internal.codegen.references.IVal;
import org.simantics.scl.compiler.internal.codegen.references.Val;
import org.simantics.scl.compiler.internal.codegen.utils.CodeBuilderUtils;
import org.simantics.scl.compiler.internal.codegen.utils.CodeBuildingException;
import org.simantics.scl.compiler.internal.codegen.utils.Constants;
-import org.simantics.scl.compiler.internal.codegen.utils.JavaNamingPolicy;
import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilderBase;
import org.simantics.scl.compiler.internal.codegen.utils.ModuleBuilder;
public static final int OPTIMIZATION_PHASES = 2;
+ CompilationContext compilationContext;
ErrorLog errorLog;
- Environment environment;
- JavaNamingPolicy namingPolicy;
- JavaTypeTranslator javaTypeTranslator;
JavaReferenceValidator<Object, Object, Object, Object> validator;
ConcreteModule module;
ModuleBuilder moduleBuilder;
Map<String, byte[]> classes;
@SuppressWarnings("unchecked")
- public CodeGeneration(ErrorLog errorLog,
- Environment environment,
- JavaNamingPolicy namingPolicy, JavaTypeTranslator javaTypeTranslator,
+ public CodeGeneration(CompilationContext compilationContext,
JavaReferenceValidator<?, ?, ?, ?> javaReferenceValidator,
- ConcreteModule module) {
- this.errorLog = errorLog;
- this.environment = environment;
- this.namingPolicy = namingPolicy;
- this.javaTypeTranslator = javaTypeTranslator;
+ ConcreteModule module) {
+ this.compilationContext = compilationContext;
+ this.errorLog = compilationContext.errorLog;
this.module = module;
this.validator = (JavaReferenceValidator<Object, Object, Object, Object>) javaReferenceValidator;