diff --git a/IDEHelper/Compiler/BfMangler.cpp b/IDEHelper/Compiler/BfMangler.cpp index 1f09abda..81a4df1f 100644 --- a/IDEHelper/Compiler/BfMangler.cpp +++ b/IDEHelper/Compiler/BfMangler.cpp @@ -396,7 +396,7 @@ void BfGNUMangler::MangleTypeInst(MangleContext& mangleContext, StringImpl& name } } -void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType) +void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType, bool isConst) { static int sCallCount = 0; sCallCount++; @@ -549,7 +549,7 @@ void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType } int startIdx = (int)name.length(); Mangle(mangleContext, name, refType->mElementType); - AddPrefix(mangleContext, name, startIdx, "R"); + AddPrefix(mangleContext, name, startIdx, isConst ? "RK" : "R"); return; } else if (type->IsModifiedTypeType()) @@ -683,6 +683,7 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst) } auto methodDef = methodInst->mMethodDef; + auto methodDeclaration = BfNodeDynCastExact(methodDef->mMethodDeclaration); auto typeInst = methodInst->GetOwner(); auto typeDef = typeInst->mTypeDef; @@ -969,12 +970,19 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst) { BfType* paramType = methodInst->GetParamType(paramIdx); + bool isConst = false; + if ((methodDeclaration != NULL) && (paramIdx < methodDeclaration->mParams.mSize)) + { + auto paramDecl = methodDeclaration->mParams[paramIdx]; + HandleParamCustomAttributes(paramDecl->mAttributes, false, isConst); + } + auto paramKind = methodInst->GetParamKind(paramIdx); if (paramKind == BfParamKind_Params) name += "U6params"; else if (paramKind == BfParamKind_DelegateParam) name += "U5param"; - Mangle(mangleContext, name, paramType); + Mangle(mangleContext, name, paramType, NULL, isConst); } if ((methodInst->GetParamCount() == 0) && (!doExplicitThis)) name += 'v'; diff --git a/IDEHelper/Compiler/BfMangler.h b/IDEHelper/Compiler/BfMangler.h index e6c057a2..c3f0794e 100644 --- a/IDEHelper/Compiler/BfMangler.h +++ b/IDEHelper/Compiler/BfMangler.h @@ -124,7 +124,7 @@ public: public: static void MangleTypeInst(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, BfTypeInstance* postfixTypeInst = NULL, bool* isEndOpen = NULL); - static void Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType = NULL); + static void Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType = NULL, bool isConst = false); static String Mangle(BfType* type, BfModule* module = NULL); static String Mangle(BfMethodInstance* methodRef); static String MangleMethodName(BfTypeInstance* type, const StringImpl& methodName);