>From 4351b1448d5036c5087e954ca84246a9bb4012a0 Mon Sep 17 00:00:00 2001 From: Yu Feng Date: Fri, 26 Jun 2009 10:37:32 +0800 Subject: [PATCH] Deduce whether the typeof expression is const --- vala/valatypeofexpression.vala | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala index 99d9145..76b49a7 100644 --- a/vala/valatypeofexpression.vala +++ b/vala/valatypeofexpression.vala @@ -39,6 +39,7 @@ public class Vala.TypeofExpression : Expression { private DataType _data_type; + private bool _is_constant = false; /** * Creates a new typeof expression. * @@ -78,8 +79,25 @@ public class Vala.TypeofExpression : Expression { type_reference.check (analyzer); + _is_constant = false; + if(type_reference.data_type is Class) { + var cl = type_reference.data_type as Class; + _is_constant = cl.type_id_const; + } + if(type_reference.data_type is Struct) { + var st = type_reference.data_type as Struct; + _is_constant = st.type_id_const; + } + if(type_reference.data_type is Enum) { + var en = type_reference.data_type as Enum; + _is_constant = en.type_id_const; + } value_type = analyzer.type_type; return !error; } + + public override bool is_constant() { + return _is_constant; + } } -- 1.6.0.6