Merge Literal and LiteralExpression
authorJuerg Billeter <j@bitron.ch>
Mon, 31 Mar 2008 19:18:24 +0000 (19:18 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Mon, 31 Mar 2008 19:18:24 +0000 (19:18 +0000)
2008-03-31  Juerg Billeter  <j@bitron.ch>

* vala/Makefile.am, vala/parser.y, vala/vala.h,
  vala/valaattribute.vala, vala/valabooleanliteral.vala,
  vala/valacharacterliteral.vala, vala/valacodecontext.vala,
  vala/valacodegenerator.vala, vala/valacodevisitor.vala,
  vala/valaintegerliteral.vala, vala/valaliteral.vala,
  vala/valanullliteral.vala, vala/valarealliteral.vala,
  vala/valasemanticanalyzer.vala, vala/valastringliteral.vala,
  gobject/valaccodeelementaccessbinding.vala,
  gobject/valaccodegenerator.vala:

  Merge Literal and LiteralExpression

svn path=/trunk/; revision=1165

19 files changed:
ChangeLog
gobject/valaccodeelementaccessbinding.vala
gobject/valaccodegenerator.vala
vala/Makefile.am
vala/parser.y
vala/vala.h
vala/valaattribute.vala
vala/valabooleanliteral.vala
vala/valacharacterliteral.vala
vala/valacodecontext.vala
vala/valacodegenerator.vala
vala/valacodevisitor.vala
vala/valaintegerliteral.vala
vala/valaliteral.vala
vala/valaliteralexpression.vala [deleted file]
vala/valanullliteral.vala
vala/valarealliteral.vala
vala/valasemanticanalyzer.vala
vala/valastringliteral.vala

index 8326378..11677d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2008-03-31  Jürg Billeter  <j@bitron.ch>
 
+       * vala/Makefile.am, vala/parser.y, vala/vala.h,
+         vala/valaattribute.vala, vala/valabooleanliteral.vala,
+         vala/valacharacterliteral.vala, vala/valacodecontext.vala,
+         vala/valacodegenerator.vala, vala/valacodevisitor.vala,
+         vala/valaintegerliteral.vala, vala/valaliteral.vala,
+         vala/valanullliteral.vala, vala/valarealliteral.vala,
+         vala/valasemanticanalyzer.vala, vala/valastringliteral.vala,
+         gobject/valaccodeelementaccessbinding.vala,
+         gobject/valaccodegenerator.vala:
+
+         Merge Literal and LiteralExpression
+
+2008-03-31  Jürg Billeter  <j@bitron.ch>
+
        * vala/valainterfacewriter.vala: fix output of enums with methods
 
 2008-03-30  Jürg Billeter  <j@bitron.ch>
index 28b2184..5c290ad 100644 (file)
@@ -1,6 +1,6 @@
 /* valaccodeelementaccessbinding.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2008  Jürg Billeter, Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -45,12 +45,10 @@ public class Vala.CCodeElementAccessBinding : CCodeExpressionBinding {
                var cindex = (CCodeExpression) indices[0].ccodenode;
                if (expr.container.symbol_reference is ArrayLengthField) {
                        /* Figure if cindex is a constant expression and calculate dim...*/
-                       var lit = indices[0] as LiteralExpression;
+                       var lit = indices[0] as IntegerLiteral;
                        var memberaccess = expr.container as MemberAccess;
-                       if (lit != null &&
-                           lit.literal is IntegerLiteral &&
-                           memberaccess != null) {
-                               int dim = (lit.literal as IntegerLiteral).value.to_int ();
+                       if (lit != null && memberaccess != null) {
+                               int dim = lit.value.to_int ();
                                codenode = codegen.get_array_length_cexpression (memberaccess.inner, dim + 1);
                        }
                } else if (container_type == codegen.string_type.data_type) {
index 80a190f..eade698 100644 (file)
@@ -2328,6 +2328,8 @@ public class Vala.CCodeGenerator : CodeGenerator {
 
        public override void visit_boolean_literal (BooleanLiteral! expr) {
                expr.ccodenode = new CCodeConstant (expr.value ? "TRUE" : "FALSE");
+
+               visit_expression (expr);
        }
 
        public override void visit_character_literal (CharacterLiteral! expr) {
@@ -2336,27 +2338,31 @@ public class Vala.CCodeGenerator : CodeGenerator {
                } else {
                        expr.ccodenode = new CCodeConstant ("%uU".printf (expr.get_char ()));
                }
+
+               visit_expression (expr);
        }
 
        public override void visit_integer_literal (IntegerLiteral! expr) {
                expr.ccodenode = new CCodeConstant (expr.value);
+
+               visit_expression (expr);
        }
 
        public override void visit_real_literal (RealLiteral! expr) {
                expr.ccodenode = new CCodeConstant (expr.value);
+
+               visit_expression (expr);
        }
 
        public override void visit_string_literal (StringLiteral! expr) {
                expr.ccodenode = new CCodeConstant (expr.value);
+
+               visit_expression (expr);
        }
 
        public override void visit_null_literal (NullLiteral! expr) {
                expr.ccodenode = new CCodeConstant ("NULL");
-       }
 
-       public override void visit_literal_expression (LiteralExpression! expr) {
-               expr.ccodenode = expr.literal.ccodenode;
-               
                visit_expression (expr);
        }
 
@@ -2489,11 +2495,8 @@ public class Vala.CCodeGenerator : CodeGenerator {
                                ccall.add_argument (new CCodeIdentifier (constant.get_cname ()));
                                return ccall;
                        }
-               } else if (array_expr is LiteralExpression) {
-                       var lit = (LiteralExpression) array_expr;
-                       if (lit.literal is NullLiteral) {
-                               return new CCodeConstant ("0");
-                       }
+               } else if (array_expr is NullLiteral) {
+                       return new CCodeConstant ("0");
                }
 
                if (!is_out) {
@@ -2697,7 +2700,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
 
                var ccall = new CCodeFunctionCall (dupexpr);
 
-               if (((context.non_null && !expr.static_type.requires_null_check) && expr.static_type.type_parameter == null) || expr is LiteralExpression) {
+               if (((context.non_null && !expr.static_type.requires_null_check) && expr.static_type.type_parameter == null) || expr is StringLiteral) {
                        // expression is non-null
                        ccall.add_argument ((CCodeExpression) expr.ccodenode);
                        
@@ -3737,10 +3740,6 @@ public class Vala.CCodeGenerator : CodeGenerator {
                return null;
        }
 
-       public override CodeBinding create_literal_expression_binding (LiteralExpression! node) {
-               return null;
-       }
-
        public override CodeBinding create_parenthesized_expression_binding (ParenthesizedExpression! node) {
                return null;
        }
index 3bfd7f5..b52b2fe 100644 (file)
@@ -79,7 +79,6 @@ libvalacore_la_VALASOURCES = \
        valainvocationexpression.vala \
        valalambdaexpression.vala \
        valaliteral.vala \
-       valaliteralexpression.vala \
        valalocalvariabledeclaration.vala \
        valalockable.vala \
        valalockstatement.vala \
index bb893e6..cb932a3 100644 (file)
@@ -71,7 +71,6 @@ static gboolean check_is_struct (ValaSymbol *symbol, ValaSourceReference *src);
        int num;
        char *str;
        GList *list;
-       ValaLiteral *literal;
        ValaUnresolvedSymbol *unresolved_symbol;
        ValaDataType *type_reference;
        ValaExpression *expression;
@@ -227,8 +226,8 @@ static gboolean check_is_struct (ValaSymbol *symbol, ValaSourceReference *src);
 %type <str> comment
 %type <str> identifier
 %type <str> identifier_or_keyword
-%type <literal> literal
-%type <literal> boolean_literal
+%type <expression> literal
+%type <expression> boolean_literal
 %type <num> stars
 %type <unresolved_symbol> symbol_name
 %type <type_reference> type_name
@@ -489,35 +488,35 @@ literal
        | INTEGER_LITERAL
          {
                ValaSourceReference *src = src(@1);
-               $$ = VALA_LITERAL (vala_code_context_create_integer_literal (context, $1, src));
+               $$ = VALA_EXPRESSION (vala_code_context_create_integer_literal (context, $1, src));
                g_object_unref (src);
                g_free ($1);
          }
        | REAL_LITERAL
          {
                ValaSourceReference *src = src(@1);
-               $$ = VALA_LITERAL (vala_code_context_create_real_literal (context, $1, src));
+               $$ = VALA_EXPRESSION (vala_code_context_create_real_literal (context, $1, src));
                g_free ($1);
                g_object_unref (src);
          }
        | CHARACTER_LITERAL
          {
                ValaSourceReference *src = src(@1);
-               $$ = VALA_LITERAL (vala_code_context_create_character_literal (context, $1, src));
+               $$ = VALA_EXPRESSION (vala_code_context_create_character_literal (context, $1, src));
                g_object_unref (src);
                g_free ($1);
          }
        | STRING_LITERAL
          {
                ValaSourceReference *src = src(@1);
-               $$ = VALA_LITERAL (vala_code_context_create_string_literal (context, $1, src));
+               $$ = VALA_EXPRESSION (vala_code_context_create_string_literal (context, $1, src));
                g_object_unref (src);
                g_free ($1);
          }
        | VALA_NULL
          {
                ValaSourceReference *src = src(@1);
-               $$ = VALA_LITERAL (vala_code_context_create_null_literal (context, src));
+               $$ = VALA_EXPRESSION (vala_code_context_create_null_literal (context, src));
                g_object_unref (src);
          }
        ;
@@ -526,13 +525,13 @@ boolean_literal
        : VALA_TRUE
          {
                ValaSourceReference *src = src(@1);
-               $$ = VALA_LITERAL (vala_code_context_create_boolean_literal (context, TRUE, src));
+               $$ = VALA_EXPRESSION (vala_code_context_create_boolean_literal (context, TRUE, src));
                g_object_unref (src);
          }
        | VALA_FALSE
          {
                ValaSourceReference *src = src(@1);
-               $$ = VALA_LITERAL (vala_code_context_create_boolean_literal (context, FALSE, src));
+               $$ = VALA_EXPRESSION (vala_code_context_create_boolean_literal (context, FALSE, src));
                g_object_unref (src);
          }
        ;
@@ -796,12 +795,6 @@ comma_list
 
 primary_no_array_creation_expression
        : literal
-         {
-               ValaSourceReference *src = src(@1);
-               $$ = VALA_EXPRESSION (vala_code_context_create_literal_expression (context, $1, src));
-               g_object_unref (src);
-               g_object_unref ($1);
-         }
        | simple_name
        | parenthesized_expression
        | member_access
index 601c4b9..a9697b4 100644 (file)
@@ -41,7 +41,6 @@
 #include <vala/valainvocationexpression.h>
 #include <vala/valalambdaexpression.h>
 #include <vala/valaliteral.h>
-#include <vala/valaliteralexpression.h>
 #include <vala/valalocalvariabledeclaration.h>
 #include <vala/valalockstatement.h>
 #include <vala/valamemberaccess.h>
index cb3b462..45f0033 100644 (file)
@@ -83,11 +83,9 @@ public class Vala.Attribute : CodeNode {
                // FIXME: use hash table
                foreach (NamedArgument arg in args) {
                        if (arg.name == name) {
-                               if (arg.argument is LiteralExpression) {
-                                       var lit = ((LiteralExpression) arg.argument).literal;
-                                       if (lit is StringLiteral) {
-                                               return ((StringLiteral) lit).eval ();
-                                       }
+                               var lit = arg.argument as StringLiteral;
+                               if (lit != null) {
+                                       return lit.eval ();
                                }
                        }
                }
@@ -105,11 +103,9 @@ public class Vala.Attribute : CodeNode {
                // FIXME: use hash table
                foreach (NamedArgument arg in args) {
                        if (arg.name == name) {
-                               if (arg.argument is LiteralExpression) {
-                                       var lit = ((LiteralExpression) arg.argument).literal;
-                                       if (lit is IntegerLiteral) {
-                                               return ((IntegerLiteral) lit).value.to_int ();
-                                       }
+                               var lit = arg.argument as IntegerLiteral;
+                               if (lit != null) {
+                                       return lit.value.to_int ();
                                }
                        }
                }
@@ -127,23 +123,21 @@ public class Vala.Attribute : CodeNode {
                // FIXME: use hash table
                foreach (NamedArgument arg in args) {
                        if (arg.name == name) {
-                               if (arg.argument is LiteralExpression) {
-                                       var lit = ((LiteralExpression) arg.argument).literal;
-                                       if (lit is RealLiteral) {
-                                               return ((RealLiteral) lit).value.to_double ();
-                                       } else if (lit is IntegerLiteral) {
-                                               return ((IntegerLiteral) lit).value.to_int ();
-                                       }
+                               if (arg.argument is RealLiteral) {
+                                       var lit = (RealLiteral) arg.argument;
+                                       return lit.value.to_double ();
+                               } else if (arg.argument is IntegerLiteral) {
+                                       var lit = (IntegerLiteral) arg.argument;
+                                       return lit.value.to_int ();
                                } else if (arg.argument is UnaryExpression) {
                                        var unary = (UnaryExpression) arg.argument;
                                        if (unary.operator == UnaryOperator.MINUS) {
-                                               if (unary.inner is LiteralExpression) {
-                                                       var lit = ((LiteralExpression) unary.inner).literal;
-                                                       if (lit is RealLiteral) {
-                                                               return -((RealLiteral) lit).value.to_double ();
-                                                       } else if (lit is IntegerLiteral) {
-                                                               return -((IntegerLiteral) lit).value.to_int ();
-                                                       }
+                                               if (unary.inner is RealLiteral) {
+                                                       var lit = (RealLiteral) unary.inner;
+                                                       return -lit.value.to_double ();
+                                               } else if (unary.inner is IntegerLiteral) {
+                                                       var lit = (IntegerLiteral) unary.inner;
+                                                       return -lit.value.to_int ();
                                                }
                                        }
                                }
@@ -163,11 +157,9 @@ public class Vala.Attribute : CodeNode {
                // FIXME: use hash table
                foreach (NamedArgument arg in args) {
                        if (arg.name == name) {
-                               if (arg.argument is LiteralExpression) {
-                                       var lit = ((LiteralExpression) arg.argument).literal;
-                                       if (lit is BooleanLiteral) {
-                                               return ((BooleanLiteral) lit).value;
-                                       }
+                               var lit = arg.argument as BooleanLiteral;
+                               if (lit != null) {
+                                       return lit.value;
                                }
                        }
                }
index 1cf116c..fa1a519 100644 (file)
@@ -1,6 +1,6 @@
 /* valabooleanliteral.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter
+ * Copyright (C) 2006-2008  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
@@ -54,4 +54,8 @@ public class Vala.BooleanLiteral : Literal {
                        return "false";
                }
        }
+
+       public override bool is_pure () {
+               return true;
+       }
 }
index 8deccc6..d593e5b 100644 (file)
@@ -1,6 +1,6 @@
 /* valacharacterliteral.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2008  Jürg Billeter, Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -77,4 +77,8 @@ public class Vala.CharacterLiteral : Literal {
        public unichar get_char () {
                return value.next_char ().get_char ();
        }
+
+       public override bool is_pure () {
+               return true;
+       }
 }
index 74a6d3e..0d2ffc4 100644 (file)
@@ -743,12 +743,6 @@ public class Vala.CodeContext : Object {
                return node;
        }
 
-       public LiteralExpression! create_literal_expression (Literal! literal, SourceReference source_reference = null) {
-               var node = new LiteralExpression (literal, source_reference);
-               node.code_binding = codegen.create_literal_expression_binding (node);
-               return node;
-       }
-
        public ParenthesizedExpression! create_parenthesized_expression (Expression! inner, SourceReference source_reference) {
                var node = new ParenthesizedExpression (inner, source_reference);
                node.code_binding = codegen.create_parenthesized_expression_binding (node);
index 58330fc..8a1ebd9 100644 (file)
@@ -234,10 +234,6 @@ public class Vala.CodeGenerator : CodeVisitor {
                return null;
        }
 
-       public virtual CodeBinding create_literal_expression_binding (LiteralExpression! node) {
-               return null;
-       }
-
        public virtual CodeBinding create_parenthesized_expression_binding (ParenthesizedExpression! node) {
                return null;
        }
index 2e465d2..0bce054 100644 (file)
@@ -468,14 +468,6 @@ public abstract class Vala.CodeVisitor : Object {
        }
 
        /**
-        * Visit operation called for literal expressions.
-        *
-        * @param expr a literal expression
-        */
-       public virtual void visit_literal_expression (LiteralExpression! expr) {
-       }
-
-       /**
         * Visit operation called for parenthesized expressions.
         *
         * @param expr a parenthesized expression
index c30833b..ea909f0 100644 (file)
@@ -1,6 +1,6 @@
 /* valaintegerliteral.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter
+ * Copyright (C) 2006-2008  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
@@ -100,4 +100,8 @@ public class Vala.IntegerLiteral : Literal {
                        }
                }
        }
+
+       public override bool is_pure () {
+               return true;
+       }
 }
index 2a766b2..df5e8d4 100644 (file)
@@ -1,6 +1,6 @@
 /* valaliteral.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter
+ * Copyright (C) 2006-2008  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
@@ -25,9 +25,8 @@ using GLib;
 /**
  * Base class for all literals in the source code.
  */
-public abstract class Vala.Literal : CodeNode {
-       /**
-        * Specifies the type of this literal.
-        */
-       public DataType static_type { get; set; }
+public abstract class Vala.Literal : Expression {
+       public override bool is_pure () {
+               return true;
+       }
 }
diff --git a/vala/valaliteralexpression.vala b/vala/valaliteralexpression.vala
deleted file mode 100644 (file)
index 25e5f20..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* valaliteralexpression.vala
- *
- * Copyright (C) 2006-2007  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
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
- *
- * Author:
- *     Jürg Billeter <j@bitron.ch>
- */
-
-using GLib;
-
-/**
- * Represents a literal expression in the source code.
- */
-public class Vala.LiteralExpression : Expression {
-       /**
-        * The literal.
-        */
-       public Literal literal { get; construct; }
-
-       /**
-        * Creates a new literal expression.
-        *
-        * @param literal a literal
-        * @param source  reference to source code
-        * @return        newly created literal expression
-        */
-       public LiteralExpression (Literal! _literal, SourceReference source = null) {
-               literal = _literal;
-               source_reference = source;
-       }
-       
-       public override void accept (CodeVisitor! visitor) {
-               literal.accept (visitor);
-       
-               visitor.visit_literal_expression (this);
-       }
-
-       public override string! to_string () {
-               return literal.to_string ();
-       }
-
-       public override bool is_pure () {
-               return true;
-       }
-}
index 79e5a2e..e162676 100644 (file)
@@ -1,6 +1,6 @@
 /* valanullliteral.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter
+ * Copyright (C) 2006-2008  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
@@ -43,4 +43,8 @@ public class Vala.NullLiteral : Literal {
        public override string! to_string () {
                return "null";
        }
+
+       public override bool is_pure () {
+               return true;
+       }
 }
index 5f72017..778f863 100644 (file)
@@ -1,6 +1,6 @@
 /* valarealliteral.vala
  *
- * Copyright (C) 2006  Jürg Billeter
+ * Copyright (C) 2006-2008  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
@@ -59,4 +59,8 @@ public class Vala.RealLiteral : Literal {
                
                return "double";
        }
+
+       public override bool is_pure () {
+               return true;
+       }
 }
index 4c42914..c27eeb5 100644 (file)
@@ -1166,8 +1166,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                }
        }
 
-       private int create_sizes_from_initializer_list (InitializerList! il, int rank, Gee.List<LiteralExpression>! sl) {
-               var init = new LiteralExpression (new IntegerLiteral (il.size.to_string (), il.source_reference), il.source_reference);
+       private int create_sizes_from_initializer_list (InitializerList! il, int rank, Gee.List<Literal>! sl) {
+               var init = new IntegerLiteral (il.size.to_string (), il.source_reference);
                init.accept (this);
                sl.add (init);
 
@@ -1220,7 +1220,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        e.accept (this);
                }
 
-               var calc_sizes = new ArrayList<LiteralExpression> ();
+               var calc_sizes = new ArrayList<Literal> ();
                if (initlist != null) {
                        initlist.expected_type = new ArrayType (expr.element_type, expr.rank, expr.source_reference);
                        initlist.expected_type.add_type_argument (expr.element_type);
@@ -1312,10 +1312,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                expr.static_type = new NullType (expr.source_reference);
        }
 
-       public override void visit_literal_expression (LiteralExpression! expr) {
-               expr.static_type = expr.literal.static_type;
-       }
-
        private DataType get_static_type_for_symbol (Symbol! sym) {
                if (sym is Field) {
                        var f = (Field) sym;
@@ -1831,10 +1827,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                }
 
                if (diag && prev_arg != null) {
-                       var format_arg = prev_arg;
-                       if (format_arg is LiteralExpression) {
-                               var format_lit = (StringLiteral) ((LiteralExpression) format_arg).literal;
-                               format_lit.value = "\"%s:%d: %s".printf (Path.get_basename (expr.source_reference.file.filename), expr.source_reference.first_line, format_lit.value.offset (1));
+                       var format_arg = prev_arg as StringLiteral;
+                       if (format_arg != null) {
+                               format_arg.value = "\"%s:%d: %s".printf (Path.get_basename (expr.source_reference.file.filename), expr.source_reference.first_line, format_arg.value.offset (1));
                        }
                }
 
@@ -2359,7 +2354,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        }
 
                        var old_value = new MemberAccess (ma.inner, ma.member_name, expr.inner.source_reference);
-                       var bin = new BinaryExpression (expr.operator == UnaryOperator.INCREMENT ? BinaryOperator.PLUS : BinaryOperator.MINUS, old_value, new LiteralExpression (new IntegerLiteral ("1")), expr.source_reference);
+                       var bin = new BinaryExpression (expr.operator == UnaryOperator.INCREMENT ? BinaryOperator.PLUS : BinaryOperator.MINUS, old_value, new IntegerLiteral ("1"), expr.source_reference);
 
                        var assignment = context.create_assignment (ma, bin, AssignmentOperator.SIMPLE, expr.source_reference);
                        var parenthexp = new ParenthesizedExpression (assignment, expr.source_reference);
index 3afc07c..494053a 100644 (file)
@@ -1,6 +1,6 @@
 /* valastringliteral.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter
+ * Copyright (C) 2006-2008  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
@@ -62,4 +62,8 @@ public class Vala.StringLiteral : Literal {
        public override void accept (CodeVisitor! visitor) {
                visitor.visit_string_literal (this);
        }
+
+       public override bool is_pure () {
+               return true;
+       }
 }