vala r1428 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1428 - in trunk: . vala
- Date: Sun, 25 May 2008 13:49:22 +0000 (UTC)
Author: juergbi
Date: Sun May 25 13:49:21 2008
New Revision: 1428
URL: http://svn.gnome.org/viewvc/vala?rev=1428&view=rev
Log:
2008-05-25 Juerg Billeter <j bitron ch>
* vala/valamemberaccess.vala:
* vala/valaparser.vala:
* vala/valasemanticanalyzer.vala:
Support qualified access to global symbols within expressions
Modified:
trunk/ChangeLog
trunk/vala/valamemberaccess.vala
trunk/vala/valaparser.vala
trunk/vala/valasemanticanalyzer.vala
Modified: trunk/vala/valamemberaccess.vala
==============================================================================
--- trunk/vala/valamemberaccess.vala (original)
+++ trunk/vala/valamemberaccess.vala Sun May 25 13:49:21 2008
@@ -63,6 +63,11 @@
*/
public bool creation_member { get; set; }
+ /**
+ * Qualified access to global symbol.
+ */
+ public bool qualified { get; set; }
+
private Expression? _inner;
private Gee.List<DataType> type_argument_list = new ArrayList<DataType> ();
Modified: trunk/vala/valaparser.vala
==============================================================================
--- trunk/vala/valaparser.vala (original)
+++ trunk/vala/valaparser.vala Sun May 25 13:49:21 2008
@@ -510,8 +510,14 @@
Expression parse_simple_name () throws ParseError {
var begin = get_location ();
string id = parse_identifier ();
+ bool qualified = false;
+ if (id == "global" && accept (TokenType.DOUBLE_COLON)) {
+ id = parse_identifier ();
+ qualified = true;
+ }
Gee.List<DataType> type_arg_list = parse_type_argument_list (true);
var expr = new MemberAccess (null, id, get_src (begin));
+ expr.qualified = qualified;
if (type_arg_list != null) {
foreach (DataType type_arg in type_arg_list) {
expr.add_type_argument (type_arg);
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Sun May 25 13:49:21 2008
@@ -1563,7 +1563,10 @@
expr.symbol_reference = null;
- if (expr.inner == null) {
+ if (expr.qualified) {
+ base_symbol = root_symbol;
+ expr.symbol_reference = root_symbol.scope.lookup (expr.member_name);
+ } else if (expr.inner == null) {
if (expr.member_name == "this") {
if (!is_in_instance_method ()) {
expr.error = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]