2014-01-31 08:23:00 +13:00
|
|
|
|
2019-01-18 15:55:51 +01:00
|
|
|
#include "std.hpp"
|
|
|
|
|
#include "decl.hpp"
|
|
|
|
|
#include "type.hpp"
|
2014-01-31 08:23:00 +13:00
|
|
|
|
|
|
|
|
Decl::~Decl(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeclSeq::DeclSeq(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Decl::getName( char *buff ){
|
|
|
|
|
int sz=name.size();
|
|
|
|
|
memcpy( buff,name.data(),sz );
|
|
|
|
|
buff[sz]=0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeclSeq::~DeclSeq(){
|
|
|
|
|
for( ;decls.size();decls.pop_back() ) delete decls.back();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Decl *DeclSeq::findDecl( const string &s ){
|
|
|
|
|
vector<Decl*>::iterator it;
|
|
|
|
|
for( it=decls.begin();it!=decls.end();++it ){
|
|
|
|
|
if( (*it)->name==s ) return *it;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Decl *DeclSeq::insertDecl( const string &s,Type *t,int kind,ConstType *d ){
|
|
|
|
|
if( findDecl( s ) ) return 0;
|
2016-10-03 17:11:15 +02:00
|
|
|
decls.push_back( new Decl( s,t,kind,d ) );
|
2014-01-31 08:23:00 +13:00
|
|
|
return decls.back();
|
|
|
|
|
}
|
|
|
|
|
|