[vala] Set target_type for start and stop values of slice expressions



commit d1145ab86d6eb11fab5d9d813300b57812b2ba18
Author: Jürg Billeter <j bitron ch>
Date:   Sat Apr 27 17:31:02 2013 +0200

    Set target_type for start and stop values of slice expressions
    
    This ensures type conversions are generated as needed.
    
    Fixes bug 698997.

 vala/valasliceexpression.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/vala/valasliceexpression.vala b/vala/valasliceexpression.vala
index 7b741a3..5b1675b 100644
--- a/vala/valasliceexpression.vala
+++ b/vala/valasliceexpression.vala
@@ -1,7 +1,7 @@
 /* valasliceexpression.vala
  *
  * Copyright (C) 2009 Robin Sonefors
- * Copyright (C) 2009-2010 Jürg Billeter
+ * Copyright (C) 2009-2013 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
@@ -110,6 +110,11 @@ public class Vala.SliceExpression : Expression {
                        return false;
                }
 
+               if (container.value_type is ArrayType) {
+                       start.target_type = context.analyzer.int_type.copy ();
+                       stop.target_type = context.analyzer.int_type.copy ();
+               }
+
                if (!start.check (context)) {
                        error = true;
                        return false;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]