Merge pull request #76 from orsonmmz/fixes

Fixes for br985, br986, br987
This commit is contained in:
Stephen Williams 2015-08-11 10:40:59 -07:00
commit 5147105042
4 changed files with 13 additions and 11 deletions

View File

@ -168,6 +168,7 @@ class ExpUnary : public Expression {
inline const Expression*peek_operand() const { return operand1_; } inline const Expression*peek_operand() const { return operand1_; }
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const; const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const;
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
void visit(ExprVisitor& func); void visit(ExprVisitor& func);
protected: protected:
@ -825,7 +826,6 @@ class ExpUNot : public ExpUnary {
Expression*clone() const { return new ExpUNot(peek_operand()->clone()); } Expression*clone() const { return new ExpUNot(peek_operand()->clone()); }
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
void write_to_stream(std::ostream&fd) const; void write_to_stream(std::ostream&fd) const;
int emit(ostream&out, Entity*ent, ScopeBase*scope); int emit(ostream&out, Entity*ent, ScopeBase*scope);
void dump(ostream&out, int indent = 0) const; void dump(ostream&out, int indent = 0) const;

View File

@ -304,6 +304,9 @@ int ExpName::elaborate_rval(Entity*ent, ScopeBase*scope, const InterfacePort*lva
} else if (scope->find_constant(name_, dummy_type, dummy_expr)) { } else if (scope->find_constant(name_, dummy_type, dummy_expr)) {
/* OK */ /* OK */
} else if (scope->is_enum_name(name_)) {
/* OK */
} else { } else {
cerr << get_fileline() << ": error: No port, signal or constant " << name_ cerr << get_fileline() << ": error: No port, signal or constant " << name_
<< " to be used as r-value." << endl; << " to be used as r-value." << endl;
@ -373,6 +376,13 @@ const VType*ExpUnary::fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*aty
return operand1_->fit_type(ent, scope, atype); return operand1_->fit_type(ent, scope, atype);
} }
int ExpUnary::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype)
{
ivl_assert(*this, ltype != 0);
set_type(ltype);
return operand1_->elaborate_expr(ent, scope, ltype);
}
const VType*ExpAggregate::probe_type(Entity*ent, ScopeBase*scope) const const VType*ExpAggregate::probe_type(Entity*ent, ScopeBase*scope) const
{ {
return Expression::probe_type(ent, scope); return Expression::probe_type(ent, scope);
@ -1043,14 +1053,6 @@ int ExpString::elaborate_expr(Entity*, ScopeBase*, const VType*ltype)
return 0; return 0;
} }
int ExpUNot::elaborate_expr(Entity*, ScopeBase*, const VType*ltype)
{
ivl_assert(*this, ltype != 0);
set_type(ltype);
return 0;
}
int ExpTime::elaborate_expr(Entity*, ScopeBase*, const VType*) int ExpTime::elaborate_expr(Entity*, ScopeBase*, const VType*)
{ {
set_type(&primitive_INTEGER); set_type(&primitive_INTEGER);

View File

@ -2273,6 +2273,7 @@ sequence_of_statements
tmp->push_back($1); tmp->push_back($1);
$$ = tmp; $$ = tmp;
} }
| { $$ = NULL; }
; ;
sequential_statement sequential_statement
@ -2531,7 +2532,6 @@ subprogram_specification
list here. */ list here. */
subprogram_statement_part subprogram_statement_part
: sequence_of_statements { $$ = $1; } : sequence_of_statements { $$ = $1; }
| { $$ = 0; }
; ;
subtype_declaration subtype_declaration

View File

@ -89,7 +89,7 @@ int VTypeArray::emit_with_dims_(std::ostream&out, bool packed, perm_string name)
list<const VTypeArray*> dims; list<const VTypeArray*> dims;
const VTypeArray*cur = this; const VTypeArray*cur = this;
while (const VTypeArray*sub = dynamic_cast<const VTypeArray*> (cur->etype_)) { while (const VTypeArray*sub = dynamic_cast<const VTypeArray*> (cur->element_type())) {
dims.push_back(cur); dims.push_back(cur);
cur = sub; cur = sub;
} }