- Timestamp:
- Oct 19, 2022, 1:42:29 PM (22 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 72b5805e, e874605
- Parents:
- 9511841
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
r9511841 r77de429 105 105 ptr<Init> init; 106 106 ptr<Expr> bitfieldWidth; 107 bool enumInLine = false; // A flag vairable to tell the compile:108 // this is not a real object declaration. It is a place holder for109 // a set of enum value (ObjectDecl).107 bool enumInLine = false; // enum inline is not a real object declaration. 108 // It is a place holder for a set of enum value (ObjectDecl) 109 bool importValue = false; // if the value copied from somewhere else 110 110 111 111 ObjectDecl( const CodeLocation & loc, const std::string & name, const Type * type, -
src/Validate/LinkReferenceToTypes.cpp
r9511841 r77de429 209 209 if ( member->enumInLine ) { 210 210 auto targetEnum = symtab.lookupEnum( member->name ); 211 if ( targetEnum) {212 for ( auto singleMamber : targetEnum->members) {211 if ( targetEnum ) { 212 for ( auto singleMamber : targetEnum->members ) { 213 213 auto tm = singleMamber.as<ast::ObjectDecl>(); 214 214 auto t = new ast::ObjectDecl( … … 224 224 tm->funcSpec 225 225 ); 226 t->importValue = true; 226 227 buffer.push_back(t); 227 228 } 228 229 } 229 230 } else { 231 auto search_it = std::find_if( buffer.begin(), buffer.end(), [member](ast::ptr<ast::Decl> cur) { 232 auto curAsObjDecl = cur.as<ast::ObjectDecl>(); 233 return (curAsObjDecl->importValue) && (curAsObjDecl->name == member->name); 234 }); 235 if ( search_it != buffer.end() ) { 236 buffer.erase( search_it ); // Found an import enum value that has the same name 237 // override the imported value 238 } 230 239 buffer.push_back( *it ); 231 240 }
Note: See TracChangeset
for help on using the changeset viewer.