summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/genie/struct-after-class.gs13
-rw-r--r--vala/valagenieparser.vala2
3 files changed, 16 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8be08ce07..ebeeed0ef 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -924,6 +924,7 @@ GENIE_TESTS = \
genie/preparser-not.gs \
genie/preparser-or-expression.gs \
genie/struct.gs \
+ genie/struct-after-class.gs \
$(NULL)
check-TESTS: $(TESTS) $(NON_NULL_TESTS)
diff --git a/tests/genie/struct-after-class.gs b/tests/genie/struct-after-class.gs
new file mode 100644
index 000000000..353012bc3
--- /dev/null
+++ b/tests/genie/struct-after-class.gs
@@ -0,0 +1,13 @@
+init
+ var a = new TestClass()
+ var b = TestStruct()
+ assert( a.empty == b.empty )
+
+class TestClass
+ empty:string = ""
+
+struct TestStruct
+ empty:string
+
+ construct()
+ empty = ""
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 668c40428..6e6e9cd5c 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -3290,6 +3290,8 @@ public class Vala.Genie.Parser : CodeVisitor {
expect (TokenType.EOL);
+ class_name = st.name;
+
parse_declarations (st);
Symbol result = st;