vala r1464 - in trunk: . vala



Author: juergbi
Date: Wed May 28 17:05:40 2008
New Revision: 1464
URL: http://svn.gnome.org/viewvc/vala?rev=1464&view=rev

Log:
2008-05-28  Juerg Billeter  <j bitron ch>

	* vala/valacodecontext.vala:
	* vala/valascope.vala:
	* vala/valasemanticanalyzer.vala:

	Add dynamic symbols to scope instead of code context


Modified:
   trunk/ChangeLog
   trunk/vala/valacodecontext.vala
   trunk/vala/valascope.vala
   trunk/vala/valasemanticanalyzer.vala

Modified: trunk/vala/valacodecontext.vala
==============================================================================
--- trunk/vala/valacodecontext.vala	(original)
+++ trunk/vala/valacodecontext.vala	Wed May 28 17:05:40 2008
@@ -128,8 +128,6 @@
 
 	private Gee.List<string> defines = new ArrayList<string> (str_equal);
 
-	private Gee.List<Symbol> dynamic_members = new ArrayList<Symbol> ();
-
 	/**
 	 * The root namespace of the symbol tree.
 	 *
@@ -410,8 +408,4 @@
 
 		return null;
 	}
-
-	public void add_dynamic_member (Symbol dynamic_member) {
-		dynamic_members.add (dynamic_member);
-	}
 }

Modified: trunk/vala/valascope.vala
==============================================================================
--- trunk/vala/valascope.vala	(original)
+++ trunk/vala/valascope.vala	Wed May 28 17:05:40 2008
@@ -38,6 +38,7 @@
 	public weak Scope parent_scope { get; set; }
 
 	private Map<string,Symbol> symbol_table;
+	private Gee.List<Symbol> anonymous_members;
 
 	/**
 	 * Creates a new scope.
@@ -66,6 +67,12 @@
 			}
 
 			symbol_table[(string) name] = sym;
+		} else {
+			if (anonymous_members == null) {
+				anonymous_members = new ArrayList<Symbol> ();
+			}
+
+			anonymous_members.add (sym);
 		}
 		sym.owner = this;
 	}

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Wed May 28 17:05:40 2008
@@ -1561,6 +1561,7 @@
 
 			if (expr.symbol_reference == null && expr.inner.value_type != null && expr.inner.value_type.is_dynamic) {
 				// allow late bound members for dynamic types
+				var dynamic_object_type = (ObjectType) expr.inner.value_type;
 				if (expr.parent_node is InvocationExpression) {
 					var invoc = (InvocationExpression) expr.parent_node;
 					if (invoc.call == expr) {
@@ -1580,7 +1581,7 @@
 						m.add_error_type (new ErrorType (null));
 						m.access = SymbolAccessibility.PUBLIC;
 						m.add_parameter (new FormalParameter.with_ellipsis ());
-						context.add_dynamic_member (m);
+						dynamic_object_type.type_symbol.scope.add (null, m);
 						expr.symbol_reference = m;
 					}
 				} else if (expr.parent_node is Assignment) {
@@ -1592,7 +1593,7 @@
 						var s = new DynamicSignal (expr.inner.value_type, expr.member_name, new VoidType (), expr.source_reference);
 						s.handler = a.right;
 						s.access = SymbolAccessibility.PUBLIC;
-						context.add_dynamic_member (s);
+						dynamic_object_type.type_symbol.scope.add (null, s);
 						expr.symbol_reference = s;
 					} else if (a.left == expr) {
 						// dynamic property assignment
@@ -1601,7 +1602,7 @@
 						prop.set_accessor = new PropertyAccessor (false, true, false, null, null);
 						prop.set_accessor.access = SymbolAccessibility.PUBLIC;
 						prop.owner = expr.inner.value_type.data_type.scope;
-						context.add_dynamic_member (prop);
+						dynamic_object_type.type_symbol.scope.add (null, prop);
 						expr.symbol_reference = prop;
 					}
 				}
@@ -1618,8 +1619,7 @@
 					prop.get_accessor = new PropertyAccessor (true, false, false, null, null);
 					prop.get_accessor.access = SymbolAccessibility.PUBLIC;
 					prop.owner = expr.inner.value_type.data_type.scope;
-					// maybe better move add_dynamic_member to Symbol class
-					context.add_dynamic_member (prop);
+					dynamic_object_type.type_symbol.scope.add (null, prop);
 					expr.symbol_reference = prop;
 				}
 				if (expr.symbol_reference != null) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]