public FunctionMethodTerm(FunctionMethod meth, IOperandTerm[] args)
     : base(meth.ReturnType)
 {
     method    = meth;
     arguments = args;
 }
 private FunctionIdentifier(string methodName, FunctionMethod method, AbstractInstruction instruction)
 {
     this.code = FunctionCode.__NULL__;
     this.arg = instruction.ArgBuilder;
     this.flag = instruction.Flag;
     this.method = method;
     Name = methodName;
     Instruction = instruction;
 }
 private FunctionIdentifier(string name, FunctionCode code, ArgumentBuilder arg, int flag)
 {
     this.code = code;
     this.arg = arg;
     this.flag = flag;
     this.method = null;
     Name = name;
     Instruction = null;
 }
 private FunctionIdentifier(string name, FunctionCode code, AbstractInstruction instruction, int additionalFlag)
 {
     this.code = code;
     this.arg = instruction.ArgBuilder;
     this.flag = instruction.Flag | additionalFlag;
     this.method = null;
     Name = name;
     Instruction = instruction;
 }
 /// <summary>
 /// 1803beta005 予め引数の数を合わせて規定値を代入しておく
 /// 1806+v6.99 式中関数の引数に無効な#DIM変数を与えている場合に例外になるのを修正
 /// 1808beta009 REF型に対応
 /// </summary>
 public UserDefinedFunctionArgument ConvertArg(IOperandTerm[] srcArgs, out string errMes)
 {
     errMes = null;
     if (TopLabel.IsError)
     {
         errMes = TopLabel.ErrMes;
         return null;
     }
     FunctionLabelLine func = TopLabel;
     IOperandTerm[] convertedArg = new IOperandTerm[func.Arg.Length];
     if(convertedArg.Length < srcArgs.Length)
     {
         errMes = "引数の数が関数\"@" + func.LabelName + "\"に設定された数を超えています";
         return null;
     }
     IOperandTerm term = null;
     VariableTerm destArg = null;
     bool isString = false;
     for (int i = 0; i < func.Arg.Length; i++)
     {
         term = (i < srcArgs.Length) ? srcArgs[i] : null;
         destArg = func.Arg[i];
         isString = destArg.IsString;
         if (destArg.Identifier.IsReference)//参照渡しの場合
         {
             if (term == null)
             {
                 errMes = "\"@" + func.LabelName + "\"の" + (i + 1).ToString() + "番目の引数は参照渡しのため省略できません";
                 return null;
             }
             VariableTerm vTerm = term as VariableTerm;
             if (vTerm == null|| vTerm.Identifier.Readonly || vTerm.Identifier.IsCalc)
             {
                 errMes = "\"@" + func.LabelName + "\"の" + (i + 1).ToString() + "番目の引数は参照渡しのための配列変数でなければなりません";
                 return null;
             }
             //変数の型と次元数が一致すればいい。キャラ型については後に判断
             VariableCode destCodeFlag = destArg.Identifier.Code &
                 (VariableCode.__ARRAY_1D__ | VariableCode.__ARRAY_2D__ | VariableCode.__ARRAY_3D__ | VariableCode.__INTEGER__ | VariableCode.__STRING__);
             VariableCode srcCodeFlag = vTerm.Identifier.Code &
                 (VariableCode.__ARRAY_1D__ | VariableCode.__ARRAY_2D__ | VariableCode.__ARRAY_3D__ | VariableCode.__INTEGER__ | VariableCode.__STRING__);
             if (destCodeFlag != srcCodeFlag)
             {
                 errMes = "\"@" + func.LabelName + "\"の" + (i + 1).ToString() + "番目の引数の型が一致しません";
                 return null;
             }
         }
         else if (term == null)//引数が省略されたとき
         {
             term = func.Def[i];//デフォルト値を代入
             //1808beta001 デフォルト値がない場合はエラーにする
             //一応逃がす
             if (term == null && !Config.CompatiFuncArgOptional)
             {
                 errMes = "\"@" + func.LabelName + "\"の" + (i + 1).ToString() + "番目の引数は省略できません";
                 return null;
             }
         }
         else if (term.GetOperandType() != destArg.GetOperandType())
         {
             if (term.GetOperandType() == typeof(string))
             {
                 errMes = "\"@" + func.LabelName + "\"の" + (i + 1).ToString() + "番目の引数を文字列型から整数型に変換できません";
                 return null;
             }
             else
             {
                 if (Config.CompatiFuncArgAutoConvert)
                 {
                     errMes = "\"@" + func.LabelName + "\"の" + (i + 1).ToString() + "番目の引数を整数型から文字列型に変換できません";
                     return null;
                 }
                 if (tostrMethod == null)
                     tostrMethod = FunctionMethodCreator.GetMethodList()["TOSTR"];
                 term = new FunctionMethodTerm(tostrMethod, new IOperandTerm[] { term });
             }
         }
         convertedArg[i] = term;
     }
     return new UserDefinedFunctionArgument(convertedArg, func.Arg);
 }
 public FunctionMethodTerm(FunctionMethod meth, IOperandTerm[] args)
     : base(meth.ReturnType)
 {
     method = meth;
     arguments = args;
 }