Allow access to length of constant array in constant initializer lists

This commit is contained in:
Michel Alexandre Salim 2011-04-05 20:52:06 +02:00
parent aa722cd705
commit 619c1c5bbb
2 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,27 @@
From 5d74330d6c660ec7bc6caa6b3c23921b93358204 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrg=20Billeter?= <j@bitron.ch>
Date: Tue, 5 Apr 2011 19:28:31 +0200
Subject: [PATCH] Allow access to length of constant array in constant initializer lists
Fixes bug 643010.
---
vala/valamemberaccess.vala | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index dfb0eb6..7f4b6df 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -169,6 +169,9 @@ public class Vala.MemberAccess : Expression {
var method = symbol_reference as Method;
if (symbol_reference is Constant) {
return true;
+ } else if (symbol_reference is ArrayLengthField && inner != null && inner.symbol_reference is Constant) {
+ // length of constant array
+ return true;
} else if (method != null &&
(method.binding == MemberBinding.STATIC || prototype_access)) {
return true;
--
1.7.4.2

View File

@ -2,7 +2,7 @@
Name: vala
Version: 0.12.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A modern programming language for GNOME
Group: Development/Languages
@ -17,6 +17,8 @@ Source0: http://download.gnome.org/sources/vala/0.12/vala-%{version}.tar.
Source1: vala-mode.el
Source2: vala-init.el
Source3: emacs-vala-COPYING
# https://bugzilla.gnome.org/show_bug.cgi?id=643010
Patch0: vala-0.12.0-allow_constant_arrays.patch
BuildRequires: flex
BuildRequires: bison
@ -86,7 +88,7 @@ Summary: Documentation for %{name}
Group: Documentation
License: LGPLv2+
BuildArch: noarch
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
Requires: devhelp
Provides: %{name}-docs = %{version}-%{release}
@ -135,6 +137,7 @@ the emacs-%{name} package to use Vala with GNU Emacs.
%prep
%setup -q
%patch0 -p1 -b .allow_constant_arrays
%build
@ -230,6 +233,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Apr 5 2011 Michel Salim <salimma@fedoraproject.org> - 0.12.0-2
- Allow access to length of constant array in constant initializer lists
* Sun Apr 3 2011 Christopher Aillon <caillon@redhat.com> - 0.12.0-1
- Update to 0.12.0