diff --git a/vhdlpp/expression.h b/vhdlpp/expression.h index 803b63b49..553c6b9c4 100644 --- a/vhdlpp/expression.h +++ b/vhdlpp/expression.h @@ -168,6 +168,7 @@ class ExpUnary : public Expression { inline const Expression*peek_operand() const { return operand1_; } 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); protected: @@ -825,7 +826,6 @@ class ExpUNot : public ExpUnary { 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; int emit(ostream&out, Entity*ent, ScopeBase*scope); void dump(ostream&out, int indent = 0) const; diff --git a/vhdlpp/expression_elaborate.cc b/vhdlpp/expression_elaborate.cc index c2d334af2..98f8f1c65 100644 --- a/vhdlpp/expression_elaborate.cc +++ b/vhdlpp/expression_elaborate.cc @@ -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)) { /* OK */ + } else if (scope->is_enum_name(name_)) { + /* OK */ + } else { cerr << get_fileline() << ": error: No port, signal or constant " << name_ << " 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); } +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 { return Expression::probe_type(ent, scope); @@ -1043,14 +1053,6 @@ int ExpString::elaborate_expr(Entity*, ScopeBase*, const VType*ltype) 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*) { set_type(&primitive_INTEGER); diff --git a/vhdlpp/parse.y b/vhdlpp/parse.y index 6a7fb2295..e3153a9ba 100644 --- a/vhdlpp/parse.y +++ b/vhdlpp/parse.y @@ -2273,6 +2273,7 @@ sequence_of_statements tmp->push_back($1); $$ = tmp; } + | { $$ = NULL; } ; sequential_statement @@ -2531,7 +2532,6 @@ subprogram_specification list here. */ subprogram_statement_part : sequence_of_statements { $$ = $1; } - | { $$ = 0; } ; subtype_declaration diff --git a/vhdlpp/vtype_emit.cc b/vhdlpp/vtype_emit.cc index d54cce23a..35d3ef2e6 100644 --- a/vhdlpp/vtype_emit.cc +++ b/vhdlpp/vtype_emit.cc @@ -89,7 +89,7 @@ int VTypeArray::emit_with_dims_(std::ostream&out, bool packed, perm_string name) list dims; const VTypeArray*cur = this; - while (const VTypeArray*sub = dynamic_cast (cur->etype_)) { + while (const VTypeArray*sub = dynamic_cast (cur->element_type())) { dims.push_back(cur); cur = sub; }