2008-05-25 Jürg Billeter <j@bitron.ch>
+ * vala/valamemberaccess.vala:
+ * vala/valaparser.vala:
+ * vala/valasemanticanalyzer.vala:
+
+ Support qualified access to global symbols within expressions
+
+2008-05-25 Jürg Billeter <j@bitron.ch>
+
* vapi/sqlite3.vapi: use [Compact] attribute
2008-05-25 Jürg Billeter <j@bitron.ch>
*/
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> ();
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);
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;