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); }
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); }
private static string GetVariableType(CodeVariable n) { if (n.Type.TypeKind == vsCMTypeRef.vsCMTypeRefArray) { return(GenericNameMangler.MangleParameterName(getArray(n.Type))); } return(GenericNameMangler.MangleParameterName(n.Type.AsFullName)); }
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); }
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)); }
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); }
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); }
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); }