public static RArgsValuesAndNames matchArgumentsEvaluated(RRootNode target,RArgsValuesAndNames evaluatedArgs,S3DefaultArguments s3DefaultArguments,boolean forNextMethod,RBaseNode callingNode){
  FormalArguments formals=target.getFormalArguments();
  MatchPermutation match=permuteArguments(evaluatedArgs.getSignature(),formals.getSignature(),callingNode,forNextMethod,null,null,null);
  Object[] evaledArgs=new Object[match.resultPermutation.length];
  for (int formalIndex=0; formalIndex < match.resultPermutation.length; formalIndex++) {
    int suppliedIndex=match.resultPermutation[formalIndex];
    if (suppliedIndex == MatchPermutation.VARARGS) {
      int varArgsLen=match.varargsPermutation.length;
      Object[] newVarArgs=new Object[varArgsLen];
      boolean nonNull=false;
      for (int i=0; i < varArgsLen; i++) {
        newVarArgs[i]=evaluatedArgs.getArguments()[match.varargsPermutation[i]];
        nonNull|=newVarArgs[i] != null;
      }
      if (nonNull) {
        evaledArgs[formalIndex]=new RArgsValuesAndNames(newVarArgs,match.varargsSignature);
      }
 else {
        evaledArgs[formalIndex]=RArgsValuesAndNames.EMPTY;
      }
    }
 else     if (suppliedIndex == MatchPermutation.UNMATCHED || evaluatedArgs.getArgument(suppliedIndex) == null) {
      Object defaultValue=getS3DefaultArgumentValue(s3DefaultArguments,formals,formalIndex);
      if (defaultValue == null) {
        defaultValue=formals.getInternalDefaultArgumentAt(formalIndex);
      }
      evaledArgs[formalIndex]=defaultValue;
    }
 else {
      evaledArgs[formalIndex]=evaluatedArgs.getArgument(suppliedIndex);
    }
  }
  return new RArgsValuesAndNames(evaledArgs,formals.getSignature());
}

public static RArgsValuesAndNames matchArgumentsEvaluated ( RRootNode target , RArgsValuesAndNames evaluatedArgs , S3DefaultArguments s3DefaultArguments , boolean forNextMethod , RBaseNode callingNode ) { FormalArguments formals = target . getFormalArguments ( ) ; MatchPermutation match = permuteArguments ( evaluatedArgs . getSignature ( ) , formals . getSignature ( ) , callingNode , forNextMethod , null , null , null ) ; Object [ ] evaledArgs = new Object [ match . resultPermutation . length ] ; for ( int formalIndex = 0 ; formalIndex < match . resultPermutation . length ; formalIndex ++ ) { int suppliedIndex = match . resultPermutation [ formalIndex ] ; if ( suppliedIndex == MatchPermutation . VARARGS ) { int varArgsLen = match . varargsPermutation . length ; Object [ ] newVarArgs = new Object [ varArgsLen ] ; boolean nonNull = false ; for ( int i = 0 ; i < varArgsLen ; i ++ ) { newVarArgs [ i ] = evaluatedArgs . getArguments ( ) [ match . varargsPermutation [ i ] ] ; nonNull |= newVarArgs [ i ] != null ; } if ( nonNull ) { evaledArgs [ formalIndex ] = new RArgsValuesAndNames ( newVarArgs , match . varargsSignature ) ; } else { evaledArgs [ formalIndex ] = RArgsValuesAndNames . EMPTY ; } } else if ( suppliedIndex == MatchPermutation . UNMATCHED || evaluatedArgs . getArgument ( suppliedIndex ) == null ) { Object defaultValue = getS3DefaultArgumentValue ( s3DefaultArguments , formals , formalIndex ) ; if ( defaultValue == null ) { defaultValue = formals . getInternalDefaultArgumentAt ( formalIndex ) ; } evaledArgs [ formalIndex ] = defaultValue ; } else { evaledArgs [ formalIndex ] = evaluatedArgs . getArgument ( suppliedIndex ) ; } } return new RArgsValuesAndNames ( evaledArgs , formals . getSignature ( ) ) ; }
used for the implementation of the ' usemethod ' builtin . reorders the arguments passed into the called , generic function and prepares them to be passed into the specific function
