]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/SCLComputationalValue.java
Fix errors with procedural user components for computational values
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / adapter / SCLComputationalValue.java
index 83382adb3325eaa128087ff3161c44f18755b54c..743f8e4454600edd28e8e33847616e8ddbfa5a82 100644 (file)
@@ -24,11 +24,14 @@ import org.simantics.scl.runtime.function.Function1;
  */
 public class SCLComputationalValue extends ContextualRelatedValue {
 
+    // TODO: unify and merge CompileValueRequest and CompileResourceValueRequest as one
     @Override
     public Function1<Object,Object> getFunction(ReadGraph graph, Resource s, Resource o, Resource p) throws DatabaseException {
-        if (s != null && p != null && o != null) {
-            return CompileValueRequest.compile(graph, s, o, p);
+        if (p != null && o != null) {
+            // we are now at Variable context
+            return CompileValueRequest.compile(graph, o, p);
         } else if (o != null) {
+            // we are now at Resource context
             return CompileResourceValueRequest.compile(graph, o);
         } else {
             throw new DatabaseException("Could not compile SCL expression: s=" + s + " p=" + p + " o=" + o);