]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/commands/CommandSession.java
Merged changes from feature/scl to master.
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / commands / CommandSession.java
index e463a4e6a4ca420c8308e405c4dc0017dd321d8c..82d615ca89f476e248615ffb158075d5b7fa5826 100644 (file)
@@ -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<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();
@@ -212,7 +207,7 @@ public class CommandSession {
         }, 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;
@@ -255,7 +250,7 @@ public class CommandSession {
         }, 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;
@@ -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))
                             );