コード例 #1
0
        private static string GetMethodName(CodeFunction function)
        {
            var    typeName = GetTypeName(function.Parent);
            var    typename = GenericNameMangler.MangleTypeName(typeName);
            string method;

            switch (function.FunctionKind)
            {
            case vsCMFunction.vsCMFunctionConstructor:
                method = function.IsShared ? ".cctor" : ".ctor";
                break;

            case vsCMFunction.vsCMFunctionDestructor:
                method = "Finalize";
                break;

            case vsCMFunction.vsCMFunctionPropertyGet:
                method = "get_" + function.Name;
                break;

            case vsCMFunction.vsCMFunctionPropertySet:
                method = "set_" + function.Name;
                break;

            default:
                method = GenericNameMangler.MangleMethodName(function.Name);
                break;
            }
            AutoTest.Core.DebugLog.Debug.WriteDebug("Method name is " + typename + "::" + method);
            return(typename + "::" + method);
        }
コード例 #2
0
        private static string GetMethodStringFromElement(CodeFunction justfunction)
        {
            string all   = null;
            var    first = true;

            if (justfunction != null)
            {
                if (justfunction.FunctionKind == vsCMFunction.vsCMFunctionPropertySet)
                {
                    return(GetSetterNameFrom(justfunction));
                }
                all = GetReturnType(justfunction) + " " + GetMethodName(justfunction) + "(";
                foreach (CodeParameter2 param in justfunction.Parameters)
                {
                    if (!first)
                    {
                        all += ",";
                    }
                    var type = param.Type.AsFullName;
                    if (param.Type.TypeKind == vsCMTypeRef.vsCMTypeRefArray)
                    {
                        type = getArray(param.Type);
                    }
                    type = GenericNameMangler.MangleParameterName(type);
                    if (param.ParameterKind == vsCMParameterKind.vsCMParameterKindOut || param.ParameterKind == vsCMParameterKind.vsCMParameterKindRef)
                    {
                        type += "&";
                    }
                    all  += type;
                    first = false;
                }
                all += ")";
            }
            return(all);
        }
コード例 #3
0
 private static string GetVariableType(CodeVariable n)
 {
     if (n.Type.TypeKind == vsCMTypeRef.vsCMTypeRefArray)
     {
         return(GenericNameMangler.MangleParameterName(getArray(n.Type)));
     }
     return(GenericNameMangler.MangleParameterName(n.Type.AsFullName));
 }
コード例 #4
0
        private static string GetFieldStringFromElement(CodeElement elem)
        {
            var v        = (CodeVariable)elem;
            var typeName = GenericNameMangler.MangleTypeName(GetTypeName(v.Parent));
            var oftype   = GetVariableType(v);

            return(oftype + " " + typeName + "::" + v.Name);
        }
コード例 #5
0
 private static string GetReturnType(CodeFunction n)
 {
     if (n.Type.TypeKind == vsCMTypeRef.vsCMTypeRefArray)
     {
         return(GenericNameMangler.MangleParameterName(getArray(n.Type)));
     }
     if (n.Type.AsFullName == "")
     {
         return("System.Void");
     }
     return(GenericNameMangler.MangleParameterName(n.Type.AsFullName));
 }
コード例 #6
0
        private static string GetSetterNameFrom(CodeFunction justfunction)
        {
            var ret = "System.Void ";

            ret += GetMethodName(justfunction) + "(";

            var type = justfunction.Type.AsFullName;

            if (justfunction.Type.TypeKind == vsCMTypeRef.vsCMTypeRefArray)
            {
                type = getArray(justfunction.Type);
            }
            type = GenericNameMangler.MangleParameterName(type);
            ret += type + ")";
            return(ret);
        }
コード例 #7
0
        private static string GetParameterName(CodeParameter2 param)
        {
            var typeString = param.Type.AsFullName;

            GetTypeName(param.Type);
            if (param.Type.TypeKind == vsCMTypeRef.vsCMTypeRefArray)
            {
                typeString = getArray(param.Type);
            }
            typeString = GenericNameMangler.MangleParameterName(typeString);
            if (param.ParameterKind == vsCMParameterKind.vsCMParameterKindOut || param.ParameterKind == vsCMParameterKind.vsCMParameterKindRef)
            {
                typeString += "&";
            }
            return(typeString);
        }
コード例 #8
0
        private static string GetMethodName(CodeFunction function)
        {
            var    typeName = GetTypeName(function.Parent);
            var    typename = GenericNameMangler.MangleTypeName(typeName);
            string method;

            switch (function.FunctionKind)
            {
            case vsCMFunction.vsCMFunctionConstructor:
                method = function.IsShared ? ".cctor" : ".ctor";
                break;

            case vsCMFunction.vsCMFunctionDestructor:
                method = "Finalize";
                break;

            case vsCMFunction.vsCMFunctionPropertyGet:
                method = "get_" + function.Name;
                break;

            case vsCMFunction.vsCMFunctionPropertySet:
                method = "set_" + function.Name;
                break;

            case vsCMFunction.vsCMFunctionOperator:
                string translated;
                ops.TryGetValue(function.Name.Replace("operator ", ""), out translated);
                method = translated;
                break;

            default:
                method = GenericNameMangler.MangleMethodName(function.Name);
                break;
            }
            return(typename + "::" + method);
        }