diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | vala/valaconstructor.vala | 2 | ||||
-rw-r--r-- | vala/valaenum.vala | 2 | ||||
-rw-r--r-- | vala/valaparser.vala | 16 |
4 files changed, 22 insertions, 5 deletions
@@ -1,3 +1,10 @@ +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 diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala index 1627175ea..a01e14e1f 100644 --- a/vala/valaconstructor.vala +++ b/vala/valaconstructor.vala @@ -39,7 +39,7 @@ public class Vala.Constructor : Symbol { /** * Specifies whether this is an instance or a class constructor. */ - public bool instance { get; set; default (true); } + public bool instance { get; set; default = true; } /** * Creates a new constructor. diff --git a/vala/valaenum.vala b/vala/valaenum.vala index 7365c90e4..0c0e76c02 100644 --- a/vala/valaenum.vala +++ b/vala/valaenum.vala @@ -35,7 +35,7 @@ public class Vala.Enum : Typesymbol { /** * 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> (); diff --git a/vala/valaparser.vala b/vala/valaparser.vala index aa84ccc04..da1c44abc 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -149,6 +149,16 @@ public class Vala.Parser : CodeVisitor { 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 (); @@ -1199,7 +1209,7 @@ public class Vala.Parser : CodeVisitor { } } 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; @@ -1626,7 +1636,7 @@ public class Vala.Parser : CodeVisitor { } 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 `}'"); } } } @@ -2054,7 +2064,7 @@ public class Vala.Parser : CodeVisitor { 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 { |