[vala] Fix (!) non-null cast for structs
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Fix (!) non-null cast for structs
- Date: Wed, 10 Mar 2010 06:53:15 +0000 (UTC)
commit db0b66630d8edd216916dec20a8bbabe894b2499
Author: Jürg Billeter <j bitron ch>
Date: Wed Mar 10 07:52:06 2010 +0100
Fix (!) non-null cast for structs
Fixes bug 612380.
codegen/valaccodebasemodule.vala | 6 ------
vala/valacastexpression.vala | 10 +++-------
2 files changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 32a43cb..42a1fc7 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 864c409..83b7f41 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]