[vala/staging] Make sure type checked expression has valid type
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] Make sure type checked expression has valid type
- Date: Sun, 24 Aug 2014 10:41:12 +0000 (UTC)
commit 8d016b59efcb192bb7f790c2461ccbbd9787efb6
Author: Simon Werbeck <simon werbeck gmail com>
Date: Wed Aug 13 02:51:11 2014 +0200
Make sure type checked expression has valid type
Fixes bug 696729
codegen/valaccodebasemodule.vala | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index dae3334..14fff5a 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5456,7 +5456,15 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
public override void visit_type_check (TypeCheck expr) {
generate_type_declaration (expr.type_reference, cfile);
- set_cvalue (expr, create_type_check (get_cvalue (expr.expression), expr.type_reference));
+ var sym = expr.expression.value_type.data_type;
+ var cl = sym as Class;
+ var iface = sym as Interface;
+ if ((cl != null && !cl.is_compact) || iface != null || expr.expression.value_type is
GenericType) {
+ set_cvalue (expr, create_type_check (get_cvalue (expr.expression),
expr.type_reference));
+ } else {
+ set_cvalue (expr, new CCodeInvalidExpression ());
+ }
+
if (get_cvalue (expr) is CCodeInvalidExpression) {
Report.error (expr.source_reference, "type check expressions not supported for
compact classes, structs, and enums");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]