Esempio n. 1
0
        private static void VerifyTypeIndexes(ITypeDataCollection typeDatas, FunctionData functionData)
        {
            if (functionData?.ClassType == null)
            {
                if (null != functionData)
                {
                    functionData.ClassTypeIndex = Constants.UnverifiedTypeIndex;
                }
                return;
            }
            int index = typeDatas.IndexOf(functionData.ClassType);

            if (-1 == index)
            {
                index = typeDatas.Count;
                typeDatas.Add(functionData.ClassType);
            }

            functionData.ClassTypeIndex = index;
            foreach (IArgument argument in functionData.ParameterType)
            {
                VerifyTypeIndexes(typeDatas, argument as Argument);
            }

            VerifyTypeIndexes(typeDatas, functionData.ReturnType as Argument);
        }
Esempio n. 2
0
 private void RefreshUsedTypeDatas(ITypeDataCollection typeDatas, HashSet <ITypeData> usedTypeDatas)
 {
     for (int i = typeDatas.Count - 1; i >= 0; i--)
     {
         if (usedTypeDatas.Contains(typeDatas[i]))
         {
             continue;
         }
         typeDatas.RemoveAt(i);
     }
     foreach (ITypeData usedTypeData in usedTypeDatas)
     {
         // 如果已存在add方法内部会进行判断
         typeDatas.Add(usedTypeData);
     }
 }
Esempio n. 3
0
        private static void VerifyTypeIndexes(ITypeDataCollection typeDatas, Argument argument)
        {
            if (null == argument.Type || VariableType.Undefined == argument.VariableType)
            {
                argument.TypeIndex = Constants.UnverifiedTypeIndex;
                return;
            }
            int index = typeDatas.IndexOf(argument.Type);

            if (-1 == index)
            {
                index = typeDatas.Count;
                typeDatas.Add(argument.Type);
            }
            argument.TypeIndex = index;
        }
Esempio n. 4
0
        private static void VerifyTypeIndexes(ITypeDataCollection typeDatas, Variable variable)
        {
            if (null == variable.Type || VariableType.Undefined == variable.VariableType)
            {
                variable.TypeIndex = Constants.UnverifiedTypeIndex;
                return;
            }
            int index = typeDatas.IndexOf(variable.Type);

            if (-1 == index)
            {
                index = typeDatas.Count;
                typeDatas.Add(variable.Type);
            }
            variable.TypeIndex = index;
        }