All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.tree.function.StatementInvocation Maven / Gradle / Ivy

package org.snapscript.tree.function;

import org.snapscript.core.function.Invocation;
import org.snapscript.core.function.InvocationBuilder;
import org.snapscript.core.scope.Scope;

public class StatementInvocation implements Invocation {

   private final InvocationBuilder builder;

   public StatementInvocation(InvocationBuilder builder) {
      this.builder = builder;
   }
   
   @Override
   public Object invoke(Scope scope, Object object, Object... list) throws Exception {
      Scope outer = scope.getScope(); 
      Invocation invocation = builder.create(outer); // what if the body is compiled
      
      return invocation.invoke(outer, object, list);
   }
}