[vala/wip/ricotz/lsp-rev: 7/8] vala: Use some replacement an unavailable identifier string
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/ricotz/lsp-rev: 7/8] vala: Use some replacement an unavailable identifier string
- Date: Mon, 20 Jan 2020 11:55:12 +0000 (UTC)
commit d05f0b790342200cbcbeb97cf0bc6cbf8b3eeb0a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Jan 18 20:03:37 2020 +0100
vala: Use some replacement an unavailable identifier string
vala/valaparser.vala | 2 +-
vala/valasourcereference.vala | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 0c31ffc72..7bce26aed 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -287,7 +287,7 @@ public class Vala.Parser : CodeVisitor {
if (context.keep_going) {
report_parse_error (e);
prev ();
- return "";
+ return get_src (get_location ()).to_source_string ();
} else {
throw e;
}
diff --git a/vala/valasourcereference.vala b/vala/valasourcereference.vala
index 24aeeda45..746fb37ed 100644
--- a/vala/valasourcereference.vala
+++ b/vala/valasourcereference.vala
@@ -66,4 +66,14 @@ public class Vala.SourceReference {
public string to_string () {
return ("%s:%d.%d-%d.%d".printf (file.get_relative_filename (), begin.line, begin.column,
end.line, end.column));
}
+
+ /**
+ * Returns a string representation of this source reference
+ * which can be used as placeholder in our AST.
+ *
+ * @return source-compatible string
+ */
+ public string to_source_string () {
+ return ("S%d%d%d%d".printf (begin.line, begin.column, end.line, end.column));
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]