vala r1424 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1424 - in trunk: . vala
- Date: Sun, 25 May 2008 11:40:01 +0000 (UTC)
Author: juergbi
Date: Sun May 25 11:40:01 2008
New Revision: 1424
URL: http://svn.gnome.org/viewvc/vala?rev=1424&view=rev
Log:
2008-05-25 Juerg Billeter <j bitron ch>
* vala/valaparser.vala:
* vala/valascanner.vala:
* vala/valasymbolresolver.vala:
* vala/valatokentype.vala:
* vala/valaunresolvedsymbol.vala:
Support qualified access to global symbols with `global::'
Modified:
trunk/ChangeLog
trunk/vala/valaparser.vala
trunk/vala/valascanner.vala
trunk/vala/valasymbolresolver.vala
trunk/vala/valatokentype.vala
trunk/vala/valaunresolvedsymbol.vala
Modified: trunk/vala/valaparser.vala
==============================================================================
--- trunk/vala/valaparser.vala (original)
+++ trunk/vala/valaparser.vala Sun May 25 11:40:01 2008
@@ -299,7 +299,7 @@
void skip_symbol_name () throws ParseError {
do {
skip_identifier ();
- } while (accept (TokenType.DOT));
+ } while (accept (TokenType.DOT) || accept (TokenType.DOUBLE_COLON));
}
UnresolvedSymbol parse_symbol_name () throws ParseError {
@@ -307,6 +307,14 @@
UnresolvedSymbol sym = null;
do {
string name = parse_identifier ();
+ if (name == "global" && accept (TokenType.DOUBLE_COLON)) {
+ // global::Name
+ // qualified access to global symbol
+ name = parse_identifier ();
+ sym = new UnresolvedSymbol (sym, name, get_src (begin));
+ sym.qualified = true;
+ continue;
+ }
sym = new UnresolvedSymbol (sym, name, get_src (begin));
} while (accept (TokenType.DOT));
return sym;
Modified: trunk/vala/valascanner.vala
==============================================================================
--- trunk/vala/valascanner.vala (original)
+++ trunk/vala/valascanner.vala Sun May 25 11:40:01 2008
@@ -433,6 +433,10 @@
case ':':
type = TokenType.COLON;
current++;
+ if (current < end && current[0] == ':') {
+ type = TokenType.DOUBLE_COLON;
+ current++;
+ }
break;
case ',':
type = TokenType.COMMA;
Modified: trunk/vala/valasymbolresolver.vala
==============================================================================
--- trunk/vala/valasymbolresolver.vala (original)
+++ trunk/vala/valasymbolresolver.vala Sun May 25 11:40:01 2008
@@ -189,7 +189,10 @@
}
private Symbol? resolve_symbol (UnresolvedSymbol unresolved_symbol) {
- if (unresolved_symbol.inner == null) {
+ if (unresolved_symbol.qualified) {
+ // qualified access to global symbol
+ return root_symbol.scope.lookup (unresolved_symbol.name);
+ } else if (unresolved_symbol.inner == null) {
Symbol sym = null;
Scope scope = current_scope;
while (sym == null && scope != null) {
Modified: trunk/vala/valatokentype.vala
==============================================================================
--- trunk/vala/valatokentype.vala (original)
+++ trunk/vala/valatokentype.vala Sun May 25 11:40:01 2008
@@ -58,6 +58,7 @@
DELETE,
DIV,
DO,
+ DOUBLE_COLON,
DOT,
DYNAMIC,
ELLIPSIS,
Modified: trunk/vala/valaunresolvedsymbol.vala
==============================================================================
--- trunk/vala/valaunresolvedsymbol.vala (original)
+++ trunk/vala/valaunresolvedsymbol.vala Sun May 25 11:40:01 2008
@@ -36,6 +36,11 @@
*/
public string name { get; set; }
+ /**
+ * Qualified access to global symbol.
+ */
+ public bool qualified { get; set; }
+
public UnresolvedSymbol (UnresolvedSymbol? inner, string name, SourceReference? source_reference = null) {
this.inner = inner;
this.name = name;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]