[vala/wip/fast-vapi: 12/12] vala: Write "Source" attribute in fast-vapi mode
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/fast-vapi: 12/12] vala: Write "Source" attribute in fast-vapi mode
- Date: Tue, 9 Apr 2019 05:28:38 +0000 (UTC)
commit 72e5cc385e95bc62b301da1342194823f974b3d7
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Mar 30 19:37:45 2019 +0100
vala: Write "Source" attribute in fast-vapi mode
This enables users to reference to the original source of a symbol.
[Source (filename = "...", line = ..., column = ...)]
vala/valacodewriter.vala | 12 ++++++++++++
vala/valausedattr.vala | 2 ++
2 files changed, 14 insertions(+)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index f3967a15c..53af9fb6c 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -1584,6 +1584,10 @@ public class Vala.CodeWriter : CodeVisitor {
continue;
}
+ if (attr.name == "Source") {
+ continue;
+ }
+
if (sym != null && attr.args.size == 1 && attr.name == "Version") {
string since_val = attr.get_string ("since");
if (since_val != null && skip_since_tag_check (sym, since_val)) {
@@ -1621,6 +1625,14 @@ public class Vala.CodeWriter : CodeVisitor {
write_newline ();
}
}
+
+ if (type == CodeWriterType.FAST && !(node is Parameter || node is PropertyAccessor)) {
+ var source_reference = node.source_reference;
+ if (source_reference != null) {
+ stream.puts ("[Source (filename = \"%s\", line = %i, column = %i)]".printf
(source_reference.file.get_relative_filename (), source_reference.begin.line, source_reference.begin.column));
+ write_newline ();
+ }
+ }
}
private void write_accessibility (Symbol sym) {
diff --git a/vala/valausedattr.vala b/vala/valausedattr.vala
index c4c05cdaa..ce9fbaf1d 100644
--- a/vala/valausedattr.vala
+++ b/vala/valausedattr.vala
@@ -76,6 +76,8 @@ public class Vala.UsedAttr : CodeVisitor {
"ScanfFormat", "",
"FormatArg", "",
+ "Source", "filename", "line", "column", "",
+
"GtkChild", "name", "internal", "",
"GtkTemplate", "ui", "",
"GtkCallback", "name", "",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]