Bind parameter values to names based on how the call was invoked (named or
positional) and parameters names from the call signature.

@param sig Signature of call
@param inv Invocation of call
@return Map of String => Object representing call parameters
518037
private Map<String, Object> bindParams(CallableSignatureContext sig, CallableInvocationContext inv) {
    
    if(inv == null) {
      return Collections.emptyMap();
    }

    Map<String, Object> vals = new HashMap<>();
    
    if (inv.posParams != null) {

      //
      // Ensure legality of call
      //

      // Can only use positional or named; not both
      if (inv.namedParams != null) {
        throw new InvocationException("only positional or named parameters are allowed", getLocation(inv));
      }

      //
      // Match up parameters
      //

      ListIterator<ParameterDeclContext> paramDeclIter = sig.paramDecls.listIterator();
      ListIterator<ExpressionContext> paramExprIter = inv.posParams.exprs.listIterator();
      
      ParameterDeclContext allDecl = null;

      while (paramDeclIter.hasNext()) {

        ParameterDeclContext paramDecl = paramDeclIter.next();

        if (paramDecl.flag != null && paramDecl.flag.getText().equals("*")) {
          if (allDecl != null) {
            throw new ExecutionException("only a single parameter can be marked with '*'", getLocation(paramDecl));
          }
          allDecl = paramDecl;
          continue;
        }
        
        String paramName = name(paramDecl);
        
        // Find expression (or use default)
        ExpressionContext paramExpr = paramExprIter.hasNext() ? paramExprIter.next() : paramDecl.expr;

        // Evaluate expression -> value
        Object paramVal = eval(paramExpr);

        vals.put(paramName, paramVal);
        
      }
      
      //
      // Add rest of parameters (if requested)
      //
      
      if (allDecl != null) {
        
        Map<String, Object> otherParams = new LinkedHashMap<>();
        
        while (paramExprIter.hasNext()) {
          
          int paramIdx = paramExprIter.nextIndex();
          
          ExpressionContext paramExpr = paramExprIter.next();
          
          Object paramVal = eval(paramExpr);
          
          otherParams.put(Integer.toString(paramIdx), paramVal);
        }
        
        vals.put(allDecl.id.getText(), otherParams);
      }
      
    }
    else if (inv.namedParams != null) {

      //
      // Ensure legality of call
      //

      // Can only use positional or named; not both
      if (inv.posParams != null) {
        throw new InvocationException("only positional or named parameters are allowed", getLocation(inv));
      }

      //
      // Load parameters
      //

      List<NamedValueContext> namedParameters = new ArrayList<>(inv.namedParams.namedValues);
      Iterator<ParameterDeclContext> paramDeclIter = sig.paramDecls.iterator();
      
      ParameterDeclContext allDecl = null;

      while (paramDeclIter.hasNext()) {

        ParameterDeclContext paramDecl = paramDeclIter.next();
        
        if (paramDecl.flag != null && paramDecl.flag.getText().equals("*")) {
          allDecl = paramDecl;
          continue;
        }
        
        String paramName = name(paramDecl);

        // Find expression
        ExpressionContext paramExpr = findAndRemoveValue(namedParameters, paramName);

        // Assign default (is needed)
        paramExpr = paramExpr != null ? paramExpr : paramDecl.expr;

        // Evaluate expression -> value
        Object paramVal = eval(paramExpr);

        vals.put(paramName, paramVal);
        
      }
      
      //
      // Add rest of parameters (if requested)
      //
      
      if (allDecl != null) {
        
        Map<String, Object> otherParams = new LinkedHashMap<>();
        
        for (NamedValueContext namedValue : namedParameters) {
          
          String paramName = namedValue.name.getText();
          
          Object paramVal = eval(namedValue.expr);
          
          otherParams.put(paramName, paramVal);
          
        }

        vals.put(allDecl.id.getText(), otherParams);
      }
      

    }

    return vals;
  }
1012495
public Object invokeOperation(ObjectName name, String operName, String... paramStrings) throws Exception {
		String[] paramTypes = lookupParamTypes(name, operName, paramStrings);
		Object[] paramObjs;
		if (paramStrings.length == 0) {
			paramObjs = null;
		} else {
			paramObjs = new Object[paramStrings.length];
			for (int i = 0; i < paramStrings.length; i++) {
				paramObjs[i] = ClientUtils.stringToParam(paramStrings[i], paramTypes[i]);
			}
		}
		return invokeOperation(name, operName, paramTypes, paramObjs);
	}
386959
private InjectorMethod createInvoker(String invokeeName, String invokeeTypeName,
      boolean hasInvokee, boolean isNative, boolean isThrowing, String invokerMethodName,
      String invokerPackageName, int invokerParamCount, MethodLiteral<?, ?> method,
      String returnTypeString, boolean returning, boolean isLongAccess)
      throws NoSourceNameException {

    List<String> invokerSignatureParams = new ArrayList<String>(invokerParamCount);

    if (hasInvokee) {
      invokerSignatureParams.add(invokeeTypeName + " invokee");
    }

    List<String> invokeeCallParams = new ArrayList<String>(method.getParameterTypes().size());

    int paramCount = 0;
    for (Key<?> paramKey : method.getParameterKeys()) {
      String paramName = ReflectUtil.formatParameterName(paramCount);
      // We cannot use the type literal of the key here: It is canonicalized
      // during key creation, destroying some information, for example
      // auto-boxing any primitives. This leads to type-mismatches when calling
      // into JSNI. Instead we'll access the parameter's original type.
      TypeLiteral<?> paramLiteral = method.getParameterTypes().get(paramCount);
      invokerSignatureParams.add(ReflectUtil.getSourceName(paramLiteral) + " " + paramName);
      invokeeCallParams.add(paramName);
      paramCount++;
    }

    String annotation = isLongAccess ? "@com.google.gwt.core.client.UnsafeNativeLong " : "";

    String invokerSignature = annotation + "public " + (isNative ? "native " : "")
        + returnTypeString + " " + invokerMethodName + "(" + join(", ", invokerSignatureParams)
        + ")";

    return new InvokerMethod(hasInvokee, invokeeCallParams, invokeeTypeName, invokerPackageName,
        invokerSignature, isNative, isThrowing, method, returning, returnTypeString);
  }
773937
def get_sig(ir, name):
    '''
        
    '''
    sig = '{}({})'

    # list of list of arguments
    argss = convert_arguments(ir.arguments)
    return [sig.format(name, ','.join(args)) for args in argss]
405928
protected final List<String> getStringListValue(final String inPropertyName) {

        List<String> result = null;
        String value = this.properties.getProperty(inPropertyName);
        if (value != null) {
            String[] temp = value.split("\\s+");
            result = new ArrayList<>(temp.length);
            for (String s : temp) {
                String trimmed = s.trim();
                if (trimmed.length() > 0) {
                    result.add(s.trim());
                }
            }
        }
        return result;
    }
917039
private QueryBuilder populateInQuery(InExpression inExpression, EntityMetadata metadata)
    {
        String property = getField(inExpression.getExpression().toParsedText());
        Expression inItemsParameter = inExpression.getInItems();

        log.debug("IN query parameters for field " + property + " is: " + inItemsParameter);
        Iterable inItemsIterable = getInValuesCollection(inItemsParameter);

        return getFilter(kunderaQuery.new FilterClause(property, Expression.IN, inItemsIterable, property), metadata);
    }
699221
private CodeBlock methodCallCodeWithClassParameters( MapperInstance instance, ImmutableList<? extends JType> parameters ) {
        CodeBlock.Builder builder = initMethodCallCode( instance );
        return methodCallParametersCode( builder, Lists.transform( parameters, new Function<JType, CodeBlock>() {

            @Override
            public CodeBlock apply( JType jType ) {
                return CodeBlock.builder().add( "$T.class", typeName( jType ) ).build();
            }
        } ) );
    }
779038
public void initFunctionData(int parametersCount) {
    params = new CallParameter[parametersCount];
    for (int i = 0; i < parametersCount; i++) {
      params[i] = new CallParameter();
      if (i > 0) {
        params[i].setInput(true);
      }
    }
    // the query was in the form {?=call function()}, so the first parameter is always output
    params[0].setOutput(true);
  }
711458
public org.grails.datastore.mapping.query.api.Criteria in(String propertyName, Object[] values) {
        if (!validateSimpleExpression()) {
            throwRuntimeException(new IllegalArgumentException("Call to [in] with propertyName [" +
                    propertyName + "] and values [" + values + "] not allowed here."));
        }

        propertyName = calculatePropertyName(propertyName);
        addToCriteria(Restrictions.in(propertyName, values));
        return this;
    }
226667
@Nullable
    private Comparable<?> getCallingObject() {
        String sig = getSigConstantOperand();
        if (Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) {
            return null;
        }

        int numParameters = SignatureUtils.getNumParameters(sig);

        if (stack.getStackDepth() <= numParameters) {
            return null;
        }

        OpcodeStack.Item caller = stack.getStackItem(numParameters);
        UserObject uo = (UserObject) caller.getUserValue();
        if ((uo != null) && (uo.caller != null)) {
            return uo.caller;
        }

        int reg = caller.getRegisterNumber();
        if (reg >= 0) {
            return Integer.valueOf(reg);
        }

        /*
         * We ignore the possibility of two fields with the same name in different
         * classes
         */
        XField f = caller.getXField();
        if (f != null) {
            return f.getName();
        }
        return null;
    }
1339651
void mapIn(String in, Object comp, String comp_in) {
        if (comp == ca.getComponent()) {
            throw new ComponentException("cannot connect 'In' with itself for " + in);
        }
        ComponentAccess ac_dest = lookup(comp);
        FieldAccess destAccess = (FieldAccess) ac_dest.input(comp_in);
        checkFA(destAccess, comp, comp_in);
        FieldAccess srcAccess = (FieldAccess) ca.input(in);
        checkFA(srcAccess, ca.getComponent(), in);

        FieldContent data = srcAccess.getData();
        data.tagLeaf();
        data.tagIn();

        destAccess.setData(data);
        dataSet.add(data);
        if (log.isLoggable(Level.CONFIG)) {
            log.config(String.format("@In(%s) -> @In(%s)", srcAccess, destAccess));
        }
//        ens.fireMapIn(srcAccess, destAccess);
    }
33377
protected Binding bindAnnotatedWithNameToInstance(TypeReference bind, String name, String to,
			String functionName) {
		String tmpName = Strings.emptyIfNull(name);
		if (tmpName.startsWith(REFERENCE_PREFIX)) {
			tmpName = tmpName.substring(REFERENCE_PREFIX.length()).trim();
		} else {
			tmpName = "\"" + tmpName + "\""; //$NON-NLS-1$//$NON-NLS-2$
		}
		final String unferencedName = tmpName;
		final StringConcatenationClient client = new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation builder) {
				builder.append("binder.bind("); //$NON-NLS-1$
				builder.append(bind);
				builder.append(".class).annotatedWith(Names.named("); //$NON-NLS-1$
				builder.append(unferencedName);
				builder.append(")).toInstance("); //$NON-NLS-1$
				builder.append(to);
				builder.append(".class);"); //$NON-NLS-1$
			}
		};
		String fctname = functionName;
		if (Strings.isEmpty(fctname)) {
			fctname = name;
		}
		final BindKey key = new GuiceModuleAccess.BindKey(formatFunctionName(fctname), null, false, false);
		final BindValue statements = new BindValue(null, null, false, Collections.singletonList(client));
	    return new Binding(key, statements, true, this.name);
	}
130307
@SuppressWarnings("unchecked")
	private static void bindRequestParameters(UriComponentsBuilder builder,
			AnnotatedParametersParameterAccessor.BoundMethodParameter parameter) {

		Object value = parameter.getValue();
		String key = parameter.getVariableName();

		if (value instanceof MultiValueMap) {

			MultiValueMap<String, String> requestParams = (MultiValueMap<String, String>) value;

			for (Map.Entry<String, List<String>> multiValueEntry : requestParams.entrySet()) {
				for (String singleEntryValue : multiValueEntry.getValue()) {
					builder.queryParam(multiValueEntry.getKey(), encodeParameter(singleEntryValue));
				}
			}

		} else if (value instanceof Map) {

			Map<String, String> requestParams = (Map<String, String>) value;

			for (Map.Entry<String, String> requestParamEntry : requestParams.entrySet()) {
				builder.queryParam(requestParamEntry.getKey(), encodeParameter(requestParamEntry.getValue()));
			}

		} else if (value instanceof Collection) {

			for (Object element : (Collection<?>) value) {
				if (key != null) {
					builder.queryParam(key, encodeParameter(element));
				}
			}

		} else if (SKIP_VALUE.equals(value)) {

			if (parameter.isRequired()) {
				if (key != null) {
					builder.queryParam(key, String.format("{%s}", parameter.getVariableName()));
				}
			}

		} else {
			if (key != null) {
				builder.queryParam(key, encodeParameter(parameter.asString()));
			}
		}
	}
1194978
public <X> X invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
        final Map<Class<?>, Method> methods = this.methods;
        Method method = methods.get(instance.getClass());
        if (method == null) {
            // the same method may be written to the map twice, but that is ok
            // lookupMethod is very slow
            Method delegate = annotatedMethod.getJavaMember();
            method = SecurityActions.lookupMethod(instance.getClass(), delegate.getName(), delegate.getParameterTypes());
            SecurityActions.ensureAccessible(method);
            synchronized (this) {
                final Map<Class<?>, Method> newMethods = new HashMap<Class<?>, Method>(methods);
                newMethods.put(instance.getClass(), method);
                this.methods = WeldCollections.immutableMapView(newMethods);
            }
        }
        return cast(method.invoke(instance, parameters));
    }
217431
public String invokeOperationToString(ObjectName name, String operName, String... paramStrings) throws Exception {
		return ClientUtils.valueToString(invokeOperation(name, operName, paramStrings));
	}
97520
def get_init_args(inst_type, init_args: dict, add_kwargs=False) -> Tuple[List, Dict]:
    ''''''
    try:
        parameters = signature(inst_type).parameters.values()
        args_keys = [p.name for p in parameters \
                if p.kind in [Parameter.POSITIONAL_ONLY, Parameter.POSITIONAL_OR_KEYWORD] \
                and p.default == Parameter.empty]
        args = [init_args[key] for key in args_keys]
        kwargs = _get_var_kwargs(parameters, args_keys, init_args)\
                 if add_kwargs else\
                 _get_kwargs(parameters, init_args)
    except KeyError as key_error:
        msg_format = 'parameter with key "{0}" is not found in node args'
        raise RenderingError(msg_format.format(key_error.args[0]))
    return (args, kwargs)
980002
private static String getSignature(MethodLiteral<?, ?> method, String[] paramNames,
      String overrideName, int overrideModifiers) throws NoSourceNameException {
    if (paramNames.length != method.getParameterTypes().size()) {
      throw new IllegalArgumentException(
          String.format("Wrong number of parameters provided for method signature, "
              + "expected %d but got %d.", method.getParameterTypes().size(), paramNames.length));
    }

    StringBuilder sb = new StringBuilder();

    if (overrideModifiers != 0) {
      sb.append(Modifier.toString(overrideModifiers)).append(" ");
    }

    if (method.getTypeParameters().length > 0) {
      List<String> typeParameters = new ArrayList<String>();
      for (TypeVariable<?> typeVariable : method.getTypeParameters()) {
        typeParameters.add(getTypeVariableDefinition(typeVariable));
      }
      sb.append("<").append(join(", ", typeParameters)).append("> ");
    }

    if (!method.isConstructor()) {
      sb.append(getSourceName(method.getReturnType())).append(" ");
      if (overrideName != null) {
        sb.append(overrideName);
      } else {
        sb.append(method.getName());
      }
    } else {
      sb.append(getSourceName(method.getRawDeclaringType()));
    }
    sb.append("(");

    // TODO(schmitt): We are not respecting varargs here.
    List<String> parameters = new ArrayList<String>();
    int i = 0;
    for (TypeLiteral<?> parameterType : method.getParameterTypes()) {
      parameters.add(
          String.format("%s %s", getSourceName(parameterType), paramNames[i]));
      i++;
    }
    sb.append(join(", ", parameters)).append(")");

    if (method.getExceptionTypes().size() > 0) {
      List<String> exceptions = new ArrayList<String>();
      for (TypeLiteral<?> exceptionType : method.getExceptionTypes()) {
        exceptions.add(getSourceName(exceptionType));
      }
      sb.append(" throws ").append(join(", ", exceptions));
    }

    return sb.toString();
  }