objects/with-expression.vala \
objects/with-instance.vala \
objects/with-nested.vala \
+ objects/with-nested-in-lambda.vala \
objects/with-nested-method.vala \
+ objects/with-nested-signal.vala \
+ objects/with-nested-unambigous-signal.vala \
errors/catch-error-code.vala \
errors/catch-in-finally.vala \
errors/default-gtype.vala \
--- /dev/null
+class Foo {
+ public signal void manam ();
+
+ public virtual int foo () {
+ return 23;
+ }
+}
+
+class Bar : Foo {
+ public override int foo () {
+ return 42;
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+ var bar = new Bar ();
+
+ with (foo) {
+ manam.connect (() => {
+ assert (foo () == 23);
+ });
+ with (bar) {
+ manam.connect (() => {
+ assert (foo () == 42);
+ });
+ }
+ }
+
+ foo.manam ();
+ bar.manam ();
+}
private Expression? _inner;
private List<DataType> type_argument_list = new ArrayList<DataType> ();
+ bool is_with_variable_access;
/**
* Creates a new member access expression.
symbol_reference = SemanticAnalyzer.symbol_lookup_inherited (sym, member_name);
- if (symbol_reference == null && sym is WithStatement) {
+ if (!is_with_variable_access && symbol_reference == null && sym is WithStatement) {
unowned WithStatement w = (WithStatement) sym;
var variable_type = w.with_variable.variable_type;
symbol_reference = variable_type.get_member (member_name);
if (symbol_reference != null) {
inner = new MemberAccess (null, w.with_variable.name, source_reference);
- if (w.with_variable.parent_symbol == w.body) {
- inner.check (context);
- } else {
- var old_symbol = context.analyzer.current_symbol;
- context.analyzer.current_symbol = w.parent_symbol;
- inner.check (context);
- context.analyzer.current_symbol = old_symbol;
- }
+ ((MemberAccess) inner).is_with_variable_access = true;
+ inner.check (context);
may_access_instance_members = true;
}
}