MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / parseTypeFromMangledName

Method parseTypeFromMangledName

src/ast/ast_typedecl.cpp:3870–4186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3868 }
3869
3870 TypeDeclPtr MangledNameParser::parseTypeFromMangledName ( const char * & ch, const ModuleLibrary & library, Module * thisModule ) {
3871 switch ( *ch ) {
3872 case '[': {
3873 ch ++;
3874 string numT = "";
3875 bool neg = false;
3876 if ( *ch=='-' ) {
3877 ch ++;
3878 neg = true;
3879 }
3880 while ( isdigit(*ch) ) {
3881 numT += *ch;
3882 ch ++;
3883 }
3884 if ( *ch!=']' ) error("expecting ']", ch);
3885 ch ++;
3886 int di = atoi(numT.c_str());
3887 if ( neg ) di = -di;
3888 auto pt = parseTypeFromMangledName(ch,library,thisModule);
3889 pt->dim.insert(pt->dim.begin(), di);
3890 return pt;
3891 }
3892 case '1': {
3893 ch ++;
3894 if ( *ch!='<' ) error("expecting '<'", ch);
3895 ch ++;
3896 auto ft = parseTypeFromMangledName(ch,library,thisModule);
3897 if ( *ch!='>' ) error("expecting '>'", ch);
3898 ch ++;
3899 auto pt = parseTypeFromMangledName(ch,library,thisModule);
3900 pt->firstType = das::move(ft);
3901 return pt;
3902 };
3903 case '2': {
3904 ch ++;
3905 if ( *ch!='<' ) error("expecting '<'", ch);
3906 ch ++;
3907 auto ft = parseTypeFromMangledName(ch,library,thisModule);
3908 if ( *ch!='>' ) error("expecting '>'", ch);
3909 ch ++;
3910 auto pt = parseTypeFromMangledName(ch,library,thisModule);
3911 pt->secondType = das::move(ft);
3912 return pt;
3913 };
3914 case 'H': {
3915 ch ++;
3916 auto pt = new TypeDecl(Type::tHandle);
3917 auto annName = parseAnyNameInBrackets(ch,true);
3918 auto ann = library.findAnnotation(annName,thisModule);
3919 if ( thisModule && ann.size()==0 ) {
3920 if ( auto tann = thisModule->findAnnotation(annName) ) {
3921 ann.push_back(tann);
3922 }
3923 }
3924 if ( ann.size()==0 ) {
3925 // Fallback: resolve module-qualified names globally (e.g. "rtti_core::TypeInfo")
3926 string modName, shortName;
3927 splitTypeName(annName, modName, shortName);

Calls 12

parseTypeFromMangledNameFunction · 0.85
splitTypeNameFunction · 0.85
c_strMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
findAnnotationMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45
findStructureMethod · 0.45
findEnumMethod · 0.45

Tested by

no test coverage detected