diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-30 19:37:45 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-04-18 16:28:03 +0200 |
commit | 1a90ab383c92b501cd25b744764b6ca6dca3a01e (patch) | |
tree | f1c7dd2a02bd8197489a2dca07835acaa751df2d /vala/valacodewriter.vala | |
parent | dd52f74df913e3dac3a47b6ed1d7cd8eca0169b0 (diff) | |
download | vala-1a90ab383c92b501cd25b744764b6ca6dca3a01e.tar.gz |
vala: Write "Source" attribute in fast-vapi mode
This enables users to reference to the original source of a symbol.
[Source (filename = "...", line = ..., column = ...)]
Diffstat (limited to 'vala/valacodewriter.vala')
-rw-r--r-- | vala/valacodewriter.vala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala index f3967a15c..943cb4339 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,15 @@ 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) { + write_indent (); + 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) { |