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

org.snapscript.core.ModuleScopeBinder Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.core;

import org.snapscript.core.function.Function;
import org.snapscript.core.stack.ThreadStack;

public class ModuleScopeBinder {
   
   public ModuleScopeBinder() {
      super();
   }

   public Scope bind(Scope scope) {
      Module module = scope.getModule();
      Context context = module.getContext();
      ThreadStack stack = context.getStack();
      Function function = stack.current(); // we can determine the function type
      
      if(function != null) {
         Type type = function.getType();
         
         if(type != null) {
            Scope current = type.getScope();
            
            if(current != null) {
               return current;
            }
         }
      }
      return scope;
   }  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy