Ensures that any method arguments are retained in the context's sphere of influence.
177169
private void retainArg(final Object arg) {
    if (arg instanceof Iterable<?>) {
      for (final Object o : (Iterable<?>) arg) {
        this.retainArg(o);
      }
    } else if (arg instanceof BaseProxy) {
      // Calling edit will validate and set up the tracking we need
      this.edit((BaseProxy) arg);
    }
  }
1356807
def get_context_arguments(self):
        """"""
        cargs = {}
        for context in self.__context_stack:
            cargs.update(context.context_arguments)
        return cargs
180587
function(method) {
		 	if(typeof method === "function") {
				var args = [];
								
				for(var x = 1; x <= arguments.length; x++) {
					if(arguments[x]) {
						args.push(arguments[x]);
					}
				}
				
				method.apply(this, args);
			}
		}
676750
private void updateContext(Container c ,int maxCtx, int ctxSteps, boolean keepCustomValues)
  {

    if(!keepCustomValues)
    {
      c.removeAllItems();
    }
    
    for (Integer i : PREDEFINED_CONTEXTS)
    {
      if (i < maxCtx)
      {
        c.addItem(i);
      }
    }

    for (int step = ctxSteps; step < maxCtx; step += ctxSteps)
    {
      c.addItem(step);
    }

    c.addItem(maxCtx);

  }
159505
def _maybe_apply_history(self, method):
        
        if self.is_historic():
            for kwargs, result_callback in self._call_history:
                res = self._hookexec(self, [method], kwargs)
                if res and result_callback is not None:
                    result_callback(res[0])
38145
def block_call (context, &block)
      args = []
      block.parameters.each do |parameter|
        args << context[parameter[1]]
      end
      block.call(*args)
    end
961457
private boolean overridingMethodFound(ExecutableElement method) {
        TypeElement containingClass = utils.getEnclosingTypeElement(method);
        for (ExecutableElement listmethod : methlist) {
            if (containingClass == utils.getEnclosingTypeElement(listmethod)) {
                // it's the same method.
                return true;
            }
            TypeElement te = utils.overriddenClass(listmethod);
            if (te == null) {
                continue;
            }
            if (te == containingClass || utils.isSubclassOf(te, containingClass)) {
                return true;
            }
        }
        return false;
    }
293903
def clean_params(self):
        
        result = self.params.copy()
        if self.cog is not None:
            # first parameter is self
            result.popitem(last=False)

        try:
            # first/second parameter is context
            result.popitem(last=False)
        except Exception:
            raise ValueError('Missing context parameter') from None

        return result
985032
def referenceable(method):
    """"""

    def wrapper(self, value, *args):
        deref = self._prepare(value)
        if deref is not None:
            return deref
        packer, data = method(self, value, *args)
        return self._preserve(value, packer, data)

    return wrapper
26115
def _attach_arguments(self):
        """"""
        for arg in self.arguments:
            self.parser.add_argument(*arg[0], **arg[1])
621074
def make_context_aware(func, numargs):
    
    try:
        if inspect.ismethod(func):
            arg_count = len(inspect.getargspec(func).args) - 1
        elif inspect.isfunction(func):
            arg_count = len(inspect.getargspec(func).args)
        elif inspect.isclass(func):
            arg_count = len(inspect.getargspec(func.__init__).args) - 1
        else:
            arg_count = len(inspect.getargspec(func.__call__).args) - 1
    except TypeError:
        arg_count = numargs

    if arg_count <= numargs:
        def normalized(*args):
            return func(*args[:-1])

        return normalized

    return func
965551
@Ensures({
    "contextLocal >= 0",
    "checkInvariantsLocal >= 0"
  })
  protected void enterContractedMethod() {
    contextLocal = newLocal(CONTRACT_CONTEXT_TYPE);
    checkInvariantsLocal = newLocal(Type.BOOLEAN_TYPE);
    invokeStatic(CONTRACT_RUNTIME_TYPE, GET_CONTEXT_METHOD);
    dup();
    storeLocal(contextLocal);
    if (statik) {
      loadThisClass();
    } else {
      loadThis();
    }
    invokeVirtual(CONTRACT_CONTEXT_TYPE, TRY_ENTER_METHOD);
    storeLocal(checkInvariantsLocal);
  }
1185429
function context(self, method) {
  if (self instanceof Primus) return;

  var failure = new Error('Primus#'+ method + '\'s context should called with a Primus instance');

  if ('function' !== typeof self.listeners || !self.listeners('error').length) {
    throw failure;
  }

  self.emit('error', failure);
}
866253
def with_args(self, *args, **kwargs):
        

        self.args = args
        self.kwargs = kwargs
        self.verify_arguments()
        return self
782091
def _has_method(arg, method):
    
    return hasattr(arg, method) and callable(getattr(arg, method))
1074070
private void tryEliminateConstantArgs(ArrayList<Node> refs) {
    List<Parameter> parameters = findFixedArguments(refs);
    if (parameters == null) {
      return;
    }

    ImmutableListMultimap<Node, Node> fns = ReferenceMap.getFunctionNodes(refs);
    if (fns.size() > 1) {
      // TODO(johnlenz): support moving simple constants.
      // This requires cloning the tree and avoiding adding additional calls/definitions that will
      // invalidate the reference map
      return;
    }

    // Only one definition is currently supported.
    Node fn = Iterables.getOnlyElement(fns.values());

    boolean continueLooking = adjustForConstraints(fn, parameters);
    if (!continueLooking) {
      return;
    }

    // Found something to do, move the values from the call sites to the function definitions.
    for (Node n : refs) {
      if (ReferenceMap.isCallOrNewTarget(n) && !alreadyRemoved(n)) {
        optimizeCallSite(parameters, n);
      }
    }

    optimizeFunctionDefinition(parameters, fn);
  }
1233006
private function completeArgumentFromTypeHint(Argument $arg, ReflectionMethod $method, ReflectionParameter $param, DocBlockReader $docBlock): void
    {
        if (!$arg->getName()) {
            $arg->setName($param->getName());
        }

        if (!$arg->getDescription()) {
            $arg->setDescription($docBlock->getParameterDescription($param));
        }

        if (!$arg->hasDefaultValue() && $param->isDefaultValueAvailable()) {
            $arg->setDefaultValue($param->getDefaultValue());
        }

        $this->completeArgumentTypeFromTypeHint($arg, $method, $param, $docBlock);
    }