Changeset 294647b for src/Parser
- Timestamp:
- Feb 14, 2017, 2:54:51 PM (8 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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 138e29e
- Parents:
- eafb094
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
reafb094 r294647b 921 921 Declaration * decl = extr->build(); 922 922 if ( decl ) { 923 decl->location = cur->location; 923 924 * out++ = decl; 924 925 } // if … … 928 929 Declaration * decl = cur->build(); 929 930 if ( decl ) { 931 decl->location = cur->location; 930 932 * out++ = decl; 931 933 } // if 932 934 } catch( SemanticError &e ) { 935 e.set_location( cur->location ); 933 936 errors.append( e ); 934 937 } // try … … 950 953 if ( decl ) { 951 954 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 955 dwt->location = cur->location; 952 956 * out++ = dwt; 953 957 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) { 954 958 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() ); 955 * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 959 auto obj = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 960 obj->location = cur->location; 961 * out++ = obj; 956 962 delete agg; 957 963 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) { 958 964 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() ); 959 * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 965 auto obj = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 966 obj->location = cur->location; 967 * out++ = obj; 960 968 } // if 961 969 } // if 962 970 } catch( SemanticError &e ) { 971 e.set_location( cur->location ); 963 972 errors.append( e ); 964 973 } // try -
src/Parser/ParseNode.h
reafb094 r294647b 39 39 //############################################################################## 40 40 41 extern char* yyfilename; 42 extern int yylineno; 43 41 44 class ParseNode { 42 45 public: … … 65 68 ParseNode * next = nullptr; 66 69 std::string * name = nullptr; 70 CodeLocation location = { yyfilename, yylineno }; 67 71 }; // ParseNode 68 72 … … 410 414 while ( cur ) { 411 415 try { 412 // SynTreeType * result = dynamic_cast< SynTreeType * >( maybeBuild< typename std::result_of< decltype(&NodeType::build)(NodeType)>::type >( cur ) );413 416 SynTreeType * result = dynamic_cast< SynTreeType * >( maybeBuild< typename std::pointer_traits< decltype(cur->build())>::element_type >( cur ) ); 414 417 if ( result ) { 418 result->location = cur->location; 415 419 * out++ = result; 416 420 } // if 417 421 } catch( SemanticError &e ) { 422 e.set_location( cur->location ); 418 423 errors.append( e ); 419 424 } // try
Note: See TracChangeset
for help on using the changeset viewer.