Changeset c194661 for src/Parser
- Timestamp:
- Jun 20, 2018, 11:23:42 AM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 0b3b2ae
- Parents:
- 9a7a3b6
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r9a7a3b6 rc194661 261 261 262 262 DeclarationNode * DeclarationNode::newQualifiedType( DeclarationNode * parent, DeclarationNode * child) { 263 return child; 264 // return parent->add_last( child ); 263 DeclarationNode * newnode = new DeclarationNode; 264 newnode->type = new TypeData( TypeData::Qualified ); 265 newnode->type->qualified.parent = parent->type; 266 newnode->type->qualified.child = child->type; 267 parent->type = nullptr; 268 child->type = nullptr; 269 delete parent; 270 delete child; 271 return newnode; 265 272 } 266 273 -
src/Parser/TypeData.cc
r9a7a3b6 rc194661 99 99 case Builtin: 100 100 // builtin = new Builtin_t; 101 case Qualified: 102 qualified.parent = nullptr; 103 qualified.child = nullptr; 101 104 break; 102 105 } // switch … … 167 170 // delete builtin; 168 171 break; 172 case Qualified: 173 delete qualified.parent; 174 delete qualified.child; 169 175 } // switch 170 176 } // TypeData::~TypeData … … 240 246 assert( builtintype == DeclarationNode::Zero || builtintype == DeclarationNode::One ); 241 247 newtype->builtintype = builtintype; 248 break; 249 case Qualified: 250 newtype->qualified.parent = maybeClone( qualified.parent ); 251 newtype->qualified.child = maybeClone( qualified.child ); 242 252 break; 243 253 } // switch … … 468 478 return new EnumInstType( buildQualifiers( td ), "" ); 469 479 case TypeData::SymbolicInst: 470 return buildSymbolicInst( td ); ;480 return buildSymbolicInst( td ); 471 481 case TypeData::Tuple: 472 482 return buildTuple( td ); … … 483 493 return new VarArgsType( buildQualifiers( td ) ); 484 494 } 495 case TypeData::GlobalScope: 496 return new GlobalScopeType(); 497 case TypeData::Qualified: 498 return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) ); 485 499 case TypeData::Symbolic: 486 500 case TypeData::Enum: … … 488 502 assert( false ); 489 503 } // switch 504 490 505 return nullptr; 491 506 } // typebuild -
src/Parser/TypeData.h
r9a7a3b6 rc194661 27 27 struct TypeData { 28 28 enum Kind { Basic, Pointer, Array, Reference, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic, 29 SymbolicInst, Tuple, Typeof, Builtin, GlobalScope, Unknown };29 SymbolicInst, Tuple, Typeof, Builtin, GlobalScope, Qualified, Unknown }; 30 30 31 31 struct Aggregate_t { … … 75 75 }; 76 76 77 struct Qualified_t { // qualified type S.T 78 TypeData * parent; 79 TypeData * child; 80 }; 81 77 82 CodeLocation location; 78 83 … … 94 99 Function_t function; 95 100 Symbolic_t symbolic; 101 Qualified_t qualified; 96 102 DeclarationNode * tuple; 97 103 ExpressionNode * typeexpr;
Note: See TracChangeset
for help on using the changeset viewer.