Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r6cef439 raf60383  
    177177}
    178178
    179 DeclarationNode * DeclarationNode::newFromTypeData( TypeData * type ) {
    180         DeclarationNode * newnode = new DeclarationNode;
    181         newnode->type = type;
    182         return newnode;
    183 } // DeclarationNode::newFromTypeData
    184 
    185179DeclarationNode * DeclarationNode::newStorageClass( ast::Storage::Classes sc ) {
    186180        DeclarationNode * newnode = new DeclarationNode;
     
    194188        return newnode;
    195189} // DeclarationNode::newFuncSpecifier
     190
     191DeclarationNode * DeclarationNode::newTypeQualifier( ast::CV::Qualifiers tq ) {
     192        DeclarationNode * newnode = new DeclarationNode;
     193        newnode->type = new TypeData();
     194        newnode->type->qualifiers = tq;
     195        return newnode;
     196} // DeclarationNode::newQualifier
     197
     198DeclarationNode * DeclarationNode::newBasicType( BasicType bt ) {
     199        DeclarationNode * newnode = new DeclarationNode;
     200        newnode->type = new TypeData( TypeData::Basic );
     201        newnode->type->basictype = bt;
     202        return newnode;
     203} // DeclarationNode::newBasicType
     204
     205DeclarationNode * DeclarationNode::newComplexType( ComplexType ct ) {
     206        DeclarationNode * newnode = new DeclarationNode;
     207        newnode->type = new TypeData( TypeData::Basic );
     208        newnode->type->complextype = ct;
     209        return newnode;
     210} // DeclarationNode::newComplexType
     211
     212DeclarationNode * DeclarationNode::newSignedNess( Signedness sn ) {
     213        DeclarationNode * newnode = new DeclarationNode;
     214        newnode->type = new TypeData( TypeData::Basic );
     215        newnode->type->signedness = sn;
     216        return newnode;
     217} // DeclarationNode::newSignedNess
     218
     219DeclarationNode * DeclarationNode::newLength( Length lnth ) {
     220        DeclarationNode * newnode = new DeclarationNode;
     221        newnode->type = new TypeData( TypeData::Basic );
     222        newnode->type->length = lnth;
     223        return newnode;
     224} // DeclarationNode::newLength
     225
     226DeclarationNode * DeclarationNode::newForall( DeclarationNode * forall ) {
     227        DeclarationNode * newnode = new DeclarationNode;
     228        newnode->type = new TypeData( TypeData::Unknown );
     229        newnode->type->forall = forall;
     230        return newnode;
     231} // DeclarationNode::newForall
     232
     233DeclarationNode * DeclarationNode::newFromGlobalScope() {
     234        DeclarationNode * newnode = new DeclarationNode;
     235        newnode->type = new TypeData( TypeData::GlobalScope );
     236        return newnode;
     237}
     238
     239DeclarationNode * DeclarationNode::newQualifiedType( DeclarationNode * parent, DeclarationNode * child) {
     240        DeclarationNode * newnode = new DeclarationNode;
     241        newnode->type = new TypeData( TypeData::Qualified );
     242        newnode->type->qualified.parent = parent->type;
     243        newnode->type->qualified.child = child->type;
     244        parent->type = nullptr;
     245        child->type = nullptr;
     246        delete parent;
     247        delete child;
     248        return newnode;
     249}
    196250
    197251DeclarationNode * DeclarationNode::newAggregate( ast::AggregateDecl::Aggregate kind, const string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {
     
    258312}
    259313
     314DeclarationNode * DeclarationNode::newFromTypedef( const string * name ) {
     315        DeclarationNode * newnode = new DeclarationNode;
     316        newnode->type = new TypeData( TypeData::SymbolicInst );
     317        newnode->type->symbolic.name = name;
     318        newnode->type->symbolic.isTypedef = true;
     319        newnode->type->symbolic.params = nullptr;
     320        return newnode;
     321} // DeclarationNode::newFromTypedef
     322
     323DeclarationNode * DeclarationNode::newFromTypeGen( const string * name, ExpressionNode * params ) {
     324        DeclarationNode * newnode = new DeclarationNode;
     325        newnode->type = new TypeData( TypeData::SymbolicInst );
     326        newnode->type->symbolic.name = name;
     327        newnode->type->symbolic.isTypedef = false;
     328        newnode->type->symbolic.actuals = params;
     329        return newnode;
     330} // DeclarationNode::newFromTypeGen
     331
    260332DeclarationNode * DeclarationNode::newTypeParam( ast::TypeDecl::Kind tc, const string * name ) {
    261333        DeclarationNode * newnode = newName( name );
     
    351423        return newnode;
    352424}
     425
     426DeclarationNode * DeclarationNode::newVtableType( DeclarationNode * decl ) {
     427        DeclarationNode * newnode = new DeclarationNode;
     428        newnode->type = new TypeData( TypeData::Vtable );
     429        newnode->setBase( decl->type );
     430        return newnode;
     431}
     432
     433DeclarationNode * DeclarationNode::newBuiltinType( BuiltinType bt ) {
     434        DeclarationNode * newnode = new DeclarationNode;
     435        newnode->type = new TypeData( TypeData::Builtin );
     436        newnode->type->builtintype = bt;
     437        return newnode;
     438} // DeclarationNode::newBuiltinType
    353439
    354440DeclarationNode * DeclarationNode::newFunction( const string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ) {
Note: See TracChangeset for help on using the changeset viewer.