+2008-04-13 Jürg Billeter <j@bitron.ch>
+
+ * vala/valaparser.vala: report warning when using deprecated syntax
+ for property default values
+
+ * vala/valaconstructor.vala, vala/valaenum.vala: port to new syntax
+
2008-04-13 Marc-Andre Lureau <marcandre.lureau@gmail.com>
* vapi/glib-2.0.vapi (Value): add init, register_transform, and
/**
* Specifies whether this enum has a registered GType.
*/
- public bool has_type_id { get; set; default (true); }
+ public bool has_type_id { get; set; default = true; }
private Gee.List<EnumValue> values = new ArrayList<EnumValue> ();
private Gee.List<Method> methods = new ArrayList<Method> ();
return src;
}
+ SourceReference get_current_src () {
+ return new SourceReference (scanner.source_file, tokens[index].begin.line, tokens[index].begin.column, tokens[index].end.line, tokens[index].end.column);
+ }
+
+ SourceReference get_last_src () {
+ int last_index = (index + BUFFER_SIZE - 1) % BUFFER_SIZE;
+
+ return new SourceReference (scanner.source_file, tokens[last_index].begin.line, tokens[last_index].begin.column, tokens[last_index].end.line, tokens[last_index].end.column);
+ }
+
void rollback (SourceLocation location) {
while (tokens[index].begin.pos != location.pos) {
prev ();
}
}
if (!accept (TokenType.CLOSE_BRACE)) {
- Report.error (new SourceReference (scanner.source_file, tokens[index].begin.line, tokens[index].begin.column, tokens[index].end.line, tokens[index].end.column), "expected `}'");
+ Report.error (get_current_src (), "expected `}'");
}
return block;
}
if (!root) {
if (!accept (TokenType.CLOSE_BRACE)) {
- Report.error (new SourceReference (scanner.source_file, tokens[index].begin.line, tokens[index].begin.column, tokens[index].end.line, tokens[index].end.column), "expected `}'");
+ Report.error (get_current_src (), "expected `}'");
}
}
}
throw new ParseError.SYNTAX (get_error ("property default value already defined"));
}
if (accept (TokenType.OPEN_PARENS)) {
- // deprecated
+ Report.warning (get_last_src (), "deprecated syntax, use `default = value;`");
prop.default_expression = parse_expression ();
expect (TokenType.CLOSE_PARENS);
} else {