import org.simantics.scl.compiler.common.names.Names;
import org.simantics.scl.compiler.constants.StringConstant;
+import org.simantics.scl.compiler.dynamic.SafeDynamic;
import org.simantics.scl.compiler.elaboration.expressions.EApply;
import org.simantics.scl.compiler.elaboration.expressions.EBlock;
import org.simantics.scl.compiler.elaboration.expressions.EConstant;
*/
private boolean validateOnly;
+ public CommandSession(ModuleRepository moduleRepository) {
+ this(moduleRepository, SCLReporting.getCurrentReportingHandler());
+ }
+
public CommandSession(ModuleRepository moduleRepository, SCLReportingHandler handler) {
this.moduleRepository = moduleRepository;
this.defaultHandler = new PrintDecorator(
variableTypes.put(name, type);
}
+ public void setVariable(String name, SafeDynamic typeAndValue) {
+ variableValues.put(name, typeAndValue.value);
+ variableTypes.put(name, typeAndValue.type_);
+ }
+
public Object getVariableValue(String name) {
return variableValues.get(name);
}
return variableTypes.get(name);
}
+ public SafeDynamic getVariableValueAndType(String name) {
+ Type type = variableTypes.get(name);
+ if(type == null)
+ return null;
+ Object value = variableValues.get(name);
+ return new SafeDynamic(type, value);
+ }
+
public void removeVariable(String name) {
variableValues.remove(name);
variableTypes.remove(name);