vhdlpp: Implemented ReturnStmt::elaborate() method.
This commit is contained in:
parent
00f5785f2c
commit
f1c07b86a3
|
|
@ -135,6 +135,7 @@ class ReturnStmt : public SequentialStmt {
|
|||
~ReturnStmt();
|
||||
|
||||
public:
|
||||
int elaborate(Entity*ent, ScopeBase*scope);
|
||||
int emit(ostream&out, Entity*entity, ScopeBase*scope);
|
||||
void write_to_stream(std::ostream&fd);
|
||||
void dump(ostream&out, int indent) const;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,22 @@ int IfSequential::Elsif::elaborate(Entity*ent, ScopeBase*scope)
|
|||
return errors;
|
||||
}
|
||||
|
||||
int ReturnStmt::elaborate(Entity*ent, ScopeBase*scope)
|
||||
{
|
||||
const VType*ltype = NULL;
|
||||
|
||||
// Try to determine the expression type by
|
||||
// looking up the function return type.
|
||||
const SubprogramBody*subp = dynamic_cast<const SubprogramBody*>(scope);
|
||||
if(subp) {
|
||||
if(const SubprogramHeader*header = subp->header()) {
|
||||
ltype = header->peek_return_type();
|
||||
}
|
||||
}
|
||||
|
||||
return val_->elaborate_expr(ent, scope, ltype);
|
||||
}
|
||||
|
||||
int SignalSeqAssignment::elaborate(Entity*ent, ScopeBase*scope)
|
||||
{
|
||||
int errors = 0;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ class SubprogramBody : public LineInfo, public ScopeBase {
|
|||
void write_to_stream(std::ostream&fd) const;
|
||||
void dump(std::ostream&fd) const;
|
||||
|
||||
const SubprogramHeader*header() const { return header_; }
|
||||
|
||||
private:
|
||||
std::list<SequentialStmt*>*statements_;
|
||||
SubprogramHeader*header_;
|
||||
|
|
|
|||
Loading…
Reference in New Issue