Support "global::" for object creation expressions.
authorJared Moore <jaredm@svn.gnome.org>
Tue, 22 Jul 2008 01:26:40 +0000 (01:26 +0000)
committerJared William Moore <jaredm@src.gnome.org>
Tue, 22 Jul 2008 01:26:40 +0000 (01:26 +0000)
2008-07-22  Jared Moore  <jaredm@svn.gnome.org>

* vala/valaparser.vala:

Support "global::" for object creation expressions.

* tests/namespaces.vala: add test case

svn path=/trunk/; revision=1719

ChangeLog
tests/namespaces.vala
vala/valaparser.vala

index e88341e..1d18222 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-07-22  Jared Moore  <jaredm@svn.gnome.org>
 
+       * vala/valaparser.vala:
+
+       Support "global::" for object creation expressions.
+
+       * tests/namespaces.vala: add test case
+
+2008-07-22  Jared Moore  <jaredm@svn.gnome.org>
+
        * vapi/glib-2.0.vapi:
 
        Fixed bindings for GLib.MainContext.check and GLib.MainContext.query,
index 3dcbdae..67b42a7 100644 (file)
@@ -1,11 +1,24 @@
 using GLib;
 
+public class GlobalTestClass {
+       public GlobalTestClass() {
+       }
+}
+
 namespace Maman {
+       public class GlobalTestClass {
+               public GlobalTestClass() {
+                       stdout.printf("Incorrect class constructed");
+               }
+       }
+
        static int main (string[] args) {
                stdout.printf ("Namespace Test\n");
 
                Bar.run ();
 
+               new global::GlobalTestClass();
+
                return 0;
        }
 
index 30ec19a..1bddf66 100644 (file)
@@ -2847,8 +2847,9 @@ public class Vala.Parser : CodeVisitor {
 
        MemberAccess parse_member_name () throws ParseError {
                var begin = get_location ();
-               MemberAccess expr = null;
-               do {
+               // The first member access can be global:: qualified
+               MemberAccess expr = (MemberAccess) parse_simple_name ();
+               while (accept (TokenType.DOT)) {
                        string id = parse_identifier ();
                        Gee.List<DataType> type_arg_list = parse_type_argument_list (false);
                        expr = new MemberAccess (expr, id, get_src (begin));
@@ -2857,7 +2858,7 @@ public class Vala.Parser : CodeVisitor {
                                        expr.add_type_argument (type_arg);
                                }
                        }
-               } while (accept (TokenType.DOT));
+               }
                return expr;
        }