Ignore:
Timestamp:
Mar 6, 2024, 12:34:15 PM (4 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
b93c544, e72fc60
Parents:
1df26c3
Message:

Return 'TypeData? *' from some parse rules. Moved TypeData? construction over to that file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cc

    r1df26c3 r6cef439  
    478478}
    479479
    480 
    481480TypeData * TypeData::getLastBase() {
    482481        TypeData * cur = this;
     
    487486void TypeData::setLastBase( TypeData * newBase ) {
    488487        getLastBase()->base = newBase;
     488}
     489
     490
     491TypeData * build_type_qualifier( ast::CV::Qualifiers tq ) {
     492        TypeData * type = new TypeData;
     493        type->qualifiers = tq;
     494        return type;
     495}
     496
     497TypeData * build_basic_type( DeclarationNode::BasicType basic ) {
     498        TypeData * type = new TypeData( TypeData::Basic );
     499        type->basictype = basic;
     500        return type;
     501}
     502
     503TypeData * build_complex_type( DeclarationNode::ComplexType complex ) {
     504        TypeData * type = new TypeData( TypeData::Basic );
     505        type->complextype = complex;
     506        return type;
     507}
     508
     509TypeData * build_signedness( DeclarationNode::Signedness signedness ) {
     510        TypeData * type = new TypeData( TypeData::Basic );
     511        type->signedness = signedness;
     512        return type;
     513}
     514
     515TypeData * build_builtin_type( DeclarationNode::BuiltinType bit ) {
     516        TypeData * type = new TypeData( TypeData::Builtin );
     517        type->builtintype = bit;
     518        return type;
     519}
     520
     521TypeData * build_length( DeclarationNode::Length length ) {
     522        TypeData * type = new TypeData( TypeData::Basic );
     523        type->length = length;
     524        return type;
     525}
     526
     527TypeData * build_forall( DeclarationNode * forall ) {
     528        TypeData * type = new TypeData( TypeData::Unknown );
     529        type->forall = forall;
     530        return type;
     531}
     532
     533TypeData * build_global_scope() {
     534        return new TypeData( TypeData::GlobalScope );
     535}
     536
     537TypeData * build_qualified_type( TypeData * parent, TypeData * child ) {
     538        TypeData * type = new TypeData( TypeData::Qualified );
     539        type->qualified.parent = parent;
     540        type->qualified.child = child;
     541        return type;
     542}
     543
     544TypeData * build_typedef( const std::string * name ) {
     545        TypeData * type = new TypeData( TypeData::SymbolicInst );
     546        type->symbolic.name = name;
     547        type->symbolic.isTypedef = true;
     548        type->symbolic.actuals = nullptr;
     549        return type;
     550}
     551
     552TypeData * build_type_gen( const std::string * name, ExpressionNode * params ) {
     553        TypeData * type = new TypeData( TypeData::SymbolicInst );
     554        type->symbolic.name = name;
     555        type->symbolic.isTypedef = false;
     556        type->symbolic.actuals = params;
     557        return type;
     558}
     559
     560TypeData * build_vtable_type( TypeData * base ) {
     561        TypeData * type = new TypeData( TypeData::Vtable );
     562        type->base = base;
     563        return type;
    489564}
    490565
     
    627702                return rtype;
    628703        } // if
     704}
     705
     706TypeData * addType( TypeData * ltype, TypeData * rtype ) {
     707        std::vector<ast::ptr<ast::Attribute>> attributes;
     708        return addType( ltype, rtype, attributes );
    629709}
    630710
Note: See TracChangeset for help on using the changeset viewer.