Commit f8801359 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

test hidden base method access update correct symbol_reference for base

2007-02-25  Jürg Billeter  <j@bitron.ch>

	* tests/test-026.vala, tests/test-026.out: test hidden base method
	  access
	* tests/Makefile.am: update
	* vala/valasemanticanalyzer.vala: correct symbol_reference for base
	  access, add current_struct field

svn path=/trunk/; revision=197
parent 73416401
2007-02-25 Jürg Billeter <j@bitron.ch>
* tests/test-026.vala, tests/test-026.out: test hidden base method
access
* tests/Makefile.am: update
* vala/valasemanticanalyzer.vala: correct symbol_reference for base
access, add current_struct field
2007-02-25 Jürg Billeter <j@bitron.ch>
* tests/test-010.vala, tests/test-010.out: enhance assignment test
......
......@@ -28,6 +28,7 @@ TESTS = \
test-023.vala \
test-024.vala \
test-025.vala \
test-026.vala \
$(NULL)
EXTRA_DIST = \
......@@ -58,4 +59,5 @@ EXTRA_DIST = \
test-023.out \
test-024.out \
test-025.out \
test-026.out \
$(NULL)
Hidden Base Method Access Test: 1 2 3 4 5
using GLib;
class Maman.Bar {
public void do_action () {
stdout.printf (" 3");
}
}
class Maman.SubBar : Bar {
public void do_action () {
stdout.printf (" BAD");
}
public void run () {
stdout.printf (" 2");
base.do_action ();
stdout.printf (" 4");
}
static int main (string[] args) {
stdout.printf ("Hidden Base Method Access Test: 1");
var bar = new SubBar ();
bar.run ();
stdout.printf (" 5\n");
return 0;
}
}
/* valasemanticanalyzer.vala
*
* Copyright (C) 2006 Jürg Billeter, Raffaele Sandrini
* Copyright (C) 2006-2007 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
......@@ -37,6 +37,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
SourceFile current_source_file;
TypeReference current_return_type;
Class current_class;
Struct current_struct;
List<weak NamespaceReference> current_using_directives;
......@@ -119,15 +120,17 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
public override void visit_end_class (Class! cl) {
current_symbol = current_symbol.parent_symbol;
current_class = null;
}
public override void visit_begin_struct (Struct! st) {
current_symbol = st.symbol;
current_class = null;
current_struct = st;
}
public override void visit_end_struct (Struct! st) {
current_symbol = current_symbol.parent_symbol;
current_struct = null;
}
public override void visit_constant (Constant! c) {
......@@ -1056,9 +1059,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
return;
}
expr.symbol_reference = current_class.symbol;
expr.static_type = new TypeReference ();
expr.static_type.data_type = current_class.base_class;
expr.symbol_reference = expr.static_type.data_type.symbol;
}
public override void visit_postfix_expression (PostfixExpression! expr) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment