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))
);