Add error recovery for invalid cast expressions.
(cherry picked from commit 9f7dc732ab)
This commit is contained in:
parent
c965e14cd7
commit
daf6b7a132
|
|
@ -2542,6 +2542,8 @@ NetExpr* PECastSize::elaborate_expr(Design*des, NetScope*scope,
|
||||||
cast_width = expr_width_;
|
cast_width = expr_width_;
|
||||||
|
|
||||||
NetExpr*sub = base_->elaborate_expr(des, scope, cast_width, flags);
|
NetExpr*sub = base_->elaborate_expr(des, scope, cast_width, flags);
|
||||||
|
if (sub == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
// Perform the cast. The extension method (zero/sign), if needed,
|
// Perform the cast. The extension method (zero/sign), if needed,
|
||||||
// depends on the type of the base expression.
|
// depends on the type of the base expression.
|
||||||
|
|
@ -2622,6 +2624,8 @@ NetExpr* PECastType::elaborate_expr(Design*des, NetScope*scope,
|
||||||
cast_width = expr_width_;
|
cast_width = expr_width_;
|
||||||
|
|
||||||
NetExpr*sub = base_->elaborate_expr(des, scope, cast_width, flags);
|
NetExpr*sub = base_->elaborate_expr(des, scope, cast_width, flags);
|
||||||
|
if (sub == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (dynamic_cast<const real_type_t*>(target_)) {
|
if (dynamic_cast<const real_type_t*>(target_)) {
|
||||||
return cast_to_real(sub);
|
return cast_to_real(sub);
|
||||||
|
|
@ -2669,6 +2673,7 @@ NetExpr* PECastType::elaborate_expr(Design*des, NetScope*scope,
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr << get_fileline() << ": sorry: This cast operation is not yet supported." << endl;
|
cerr << get_fileline() << ": sorry: This cast operation is not yet supported." << endl;
|
||||||
|
des->errors += 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue