Bind the context of a method to the executing objects `this` context.
We must override the descriptor as `value()` doesn't use the correct `this` context.
331138
function bindMethod(
  target: DecoratorTarget,
  name: string,
  descriptor: Descriptor,
): Descriptor {
  const func = getValueFunc('bind', descriptor);

  return {
    configurable: true,
    enumerable: false,
    get() {
      // This happens if someone accesses the property directly on the prototype
      // Thanks to jayphelps/core-decorators.js for the snippet
      if (this === target) {
        return func;
      }

      // The `this` here is the current class prototype
      // While `target` is the parent class prototype
      const boundFunc = func.bind(this);

      // Define a function on the target so that `get()` is only called once
      // Inherit the original methods descriptor as well
      Object.defineProperty(this, name, {
        ...descriptor,
        enumerable: true,
        value: boundFunc,
      });

      return boundFunc;
    },
    set(value) {
      Object.defineProperty(this, name, {
        ...descriptor,
        value,
      });
    },
  };
}
1374388
public void setContext(Context context) {
        context.put(JavacTypes.class, this);
        syms = Symtab.instance(context);
        types = Types.instance(context);
    }
484815
def _bind(self, _descriptor):
        

        # If the method has a default code, use it
        self._defcode = getattr(_descriptor.method, '_wsgi_code', 200)

        # Set up content type and serializer
        self.content_type, self.serializer = _descriptor.serializer(self.req)
1051036
public static void setLocalVar(ExecutionContext context, String name, Object value) {
        LexicalEnvironment localEnv = context.getLexicalEnvironment();
        localEnv.getRecord().createMutableBinding(context, name, false);
        localEnv.getRecord().setMutableBinding(context, name, value, false);
    }
1256491
function(obj) {
                if (!obj.constructor.Bind) {
                    try {
                        var descr = {};
                        Bind.each(obj, function(name, method) {
                            descr[name] = {
                                get : function() {
                                    return this[name] = method.bind(this.self);
                                },
                                set : function(val) {
                                    Object.defineProperty(this, name, {
                                        value : val
                                    });
                                },
                                configurable : true
                            };
                        });
                        obj.constructor.Bind = Bind.Object.inherit(descr);
                    } catch (e) {
                        obj.constructor.Bind = Bind.Object.inherit({});
                    }
                }

                return new obj.constructor.Bind(obj);
            }
887145
def bind(self, func: Callable[[Any], Maybe]) -> Maybe:
        """"""

        value = self._value
        return func(value)
313579
function bind (obj, method) {
    var fn = obj[method];
    obj[method] = function () {
      fn.apply(obj, arguments);
    };
  }
634073
def context_binding(variables)
      context = TemplateEvaluationContext.new

      helpers.each { |helper| context.extend(helper) }

      variables.each do |k, v|
        context.instance_variable_set("@#{k}", v)
      end

      context.__get_binding
    end
827650
def inject_context(self, __context_dict__=None, **context):
        
        context = context or __context_dict__
        self.context_keys |= set(context.keys())
        for key, value in context.items():
            setattr(self, key, value)
        for command in self.subcommands.values():
            command.inject_context(context)
238483
function (iterator, context) {
        _.forEach(this.members, _.isFunction(iterator) ? iterator.bind(context || this.__parent) : iterator);
    }
683663
def context(&block)
      # Include the context
      context = @context
      machine.owner_class.class_eval { include context }
      
      # Evaluate the method definitions and track which ones were added
      old_methods = context_methods
      context.class_eval(&block)
      new_methods = context_methods.to_a.select {|(name, method)| old_methods[name] != method}
      
      # Alias new methods so that the only execute when the object is in this state
      new_methods.each do |(method_name, method)|
        context_name = context_name_for(method_name)
        context.class_eval <<-end_eval, __FILE__, __LINE__ + 1
          alias_method :"#{context_name}", :#{method_name}
          def #{method_name}(*args, &block)
            state = self.class.state_machine(#{machine.name.inspect}).states.fetch(#{name.inspect})
            options = {:method_missing => lambda {super(*args, &block)}, :method_name => #{method_name.inspect}}
            state.call(self, :"#{context_name}", *(args + [options]), &block)
          end
        end_eval
      end
      
      true
    end
237386
function setValue(descriptor,key,set,update)
        {
          var _descriptor = descriptor,
              _key = key,
              _set = set,
              _update = update,
              _oldValue;
          return function valueSet(v)
          {
            _oldValue = _descriptor.value;
            if(_set(this,_key,v,_oldValue,arguments,this._stopChange))
            {
              _descriptor.value = v;
            }
            if(!this._stopChange)
            {
              _update(this,_key,v,_oldValue,arguments);
            }
            this._stopChange = undefined;
          }
        }
1193424
@SuppressWarnings("unchecked")
	public <T> T defineContextualValue(String key, Object value) {
		return (T) this.values.put(key,  value);
	}
840830
def value_call(method_name, *args, **kwargs):
    

    def value_call(value, context, **_params):
        method = getattr(value, method_name)
        return _call(method, args, kwargs)

    return value_call
1058503
def update_context(self, ctx):
        
        assert isinstance(ctx, dict)
        ctx[str(self.context_id)] = self.value
261565
@Deprecated
	public void bind(String name, Object value)
	{
		if (name2Index == null)
		{
			throw new RuntimeException("申明的绑定和代码里实际绑定不一致");
		}
		Integer index = name2Index.get(name);
		if (index == null)
		{
			throw new RuntimeException("申明的绑定和代码里实际绑定不一致:试图绑定未申明的变量" + name);
		}
		ctx.vars[index] = value;
	}
1214421
function bind (fn, context) {
  return fn.bind ? fn.bind(context) : function () {
    fn.apply(context, arguments)
  }
}