X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fcommands%2FCommandSession.java;h=82d615ca89f476e248615ffb158075d5b7fa5826;hp=e463a4e6a4ca420c8308e405c4dc0017dd321d8c;hb=a8758de5bc19e5adb3f618d3038743a164f09912;hpb=12d9af17384d960b75d58c3935d2b7b46d93e87b diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/commands/CommandSession.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/commands/CommandSession.java index e463a4e6a..82d615ca8 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/commands/CommandSession.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/commands/CommandSession.java @@ -16,7 +16,7 @@ import java.util.List; 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; @@ -47,7 +47,6 @@ import org.simantics.scl.compiler.runtime.RuntimeEnvironment; 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; @@ -78,10 +77,6 @@ public class CommandSession { 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( @@ -202,7 +197,7 @@ public class CommandSession { }, Types.functionE(Types.STRING, Types.PROC, Types.UNIT))); LOCAL_FUNCTIONS.put("reset", new LocalFunction(new FunctionImpl2() { @Override - public Tuple0 apply(CommandSession commandSession, Tuple0 _) { + public Tuple0 apply(CommandSession commandSession, Tuple0 dummy) { commandSession.removeTransientImports(); commandSession.removeVariables(); commandSession.moduleRepository.getSourceRepository().checkUpdates(); @@ -212,7 +207,7 @@ public class CommandSession { }, Types.functionE(Types.UNIT, Types.PROC, Types.UNIT))); LOCAL_FUNCTIONS.put("variables", new LocalFunction(new FunctionImpl2>() { @Override - public List apply(CommandSession commandSession, Tuple0 _) { + public List apply(CommandSession commandSession, Tuple0 dummy) { ArrayList result = new ArrayList(commandSession.variableTypes.keySet()); Collections.sort(result); return result; @@ -255,7 +250,7 @@ public class CommandSession { }, Types.functionE(Types.STRING, Types.PROC, Types.UNIT))); LOCAL_FUNCTIONS.put("stopPrintingToFile", new LocalFunction(new FunctionImpl2() { @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; @@ -267,13 +262,13 @@ public class CommandSession { 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)) );