Exemple #1
0
 public CodeConverter(ProjectConverter projectConverter, EocClass classItem, MethodInfo methodItem)
 {
     this.P                 = projectConverter;
     this.Name              = P.GetUserDefinedName_SimpleCppName(methodItem.Id);
     this.ClassItem         = classItem;
     this.MethodItem        = methodItem;
     this.RawStatementBlock = CodeDataParser.ParseStatementBlock(methodItem.CodeData.ExpressionData, methodItem.CodeData.Encoding);
     this.Info              = InferEocCmdInfo(P, methodItem, RawStatementBlock);
     this.TemplatedMethod   = Info.Parameters.Find(x => x.DataType == EocDataTypes.Auto) != null;
     this.IsClassMember     = classItem is EocObjectClass;
     this.ParamMap          = new SortedDictionary <int, EocParameterInfo>();
     for (int i = 0; i < Info.Parameters.Count; i++)
     {
         this.ParamMap.Add(methodItem.Parameters[i].Id, Info.Parameters[i]);
     }
     this.LocalMap = methodItem.Variables.ToSortedDictionary(x => x.Id, x => new EocLocalVariableInfo()
     {
         CppName  = P.GetUserDefinedName_SimpleCppName(x.Id),
         DataType = EocDataTypes.Translate(P, x.DataType, x.UBound),
         UBound   = x.UBound.ToList()
     });
     if (IsClassMember)
     {
         this.RefId = $"{ClassItem.CppName}|{Info.CppName}";
     }
     else
     {
         this.RefId = Info.CppName;
     }
 }
 public CodeConverter(ProjectConverter projectConverter, EocClass classItem, MethodInfo methodItem)
 {
     this.P             = projectConverter;
     this.Name          = P.GetUserDefinedName_SimpleCppName(methodItem.Id);
     this.EocCmdInfo    = P.GetEocCmdInfo(methodItem);
     this.IsClassMember = classItem is EocObjectClass;
     this.ClassItem     = classItem;
     this.MethodItem    = methodItem;
     this.Parameters    = methodItem.Parameters;
     this.ParamIdMap    = methodItem.Parameters.ToDictionary(x => x.Id);
     this.LocalIdMap    = methodItem.Variables.ToDictionary(x => x.Id);
     if (IsClassMember)
     {
         this.RefId = $"{ClassItem.CppName}|{EocCmdInfo.CppName}";
     }
     else
     {
         this.RefId = EocCmdInfo.CppName;
     }
 }