summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2010-03-10 07:52:06 +0100
committerJürg Billeter <j@bitron.ch>2010-03-10 07:52:06 +0100
commitdb0b66630d8edd216916dec20a8bbabe894b2499 (patch)
tree315bc160687f4cfaba0e649d28cdc6970aa47bf9
parented08578b700621042a7b081853f2ae72cf106ae2 (diff)
downloadvala-db0b66630d8edd216916dec20a8bbabe894b2499.tar.gz
Fix (!) non-null cast for structs
Fixes bug 612380.
-rw-r--r--codegen/valaccodebasemodule.vala6
-rw-r--r--vala/valacastexpression.vala10
2 files changed, 3 insertions, 13 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 32a43cb1b..42a1fc75e 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4311,12 +4311,6 @@ internal class Vala.CCodeBaseModule : CCodeModule {
}
public override void visit_cast_expression (CastExpression expr) {
- if (expr.is_non_null_cast) {
- // TODO add NULL runtime check
- expr.ccodenode = expr.inner.ccodenode;
- return;
- }
-
var valuecast = try_cast_value_to_type ((CCodeExpression) expr.inner.ccodenode, expr.inner.value_type, expr.type_reference, expr);
if (valuecast != null) {
expr.ccodenode = valuecast;
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index 864c40925..83b7f41e9 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -1,6 +1,6 @@
/* valacastexpression.vala
*
- * Copyright (C) 2006-2009 Jürg Billeter
+ * Copyright (C) 2006-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -127,12 +127,8 @@ public class Vala.CastExpression : Expression {
if (is_non_null_cast) {
// (!) non-null cast
- value_type = inner.value_type.copy ();
- value_type.nullable = false;
-
- inner.target_type = inner.value_type.copy ();
-
- return !error;
+ type_reference = inner.value_type.copy ();
+ type_reference.nullable = false;
}
type_reference.check (analyzer);