We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a3180e5 commit 94a91c2Copy full SHA for 94a91c2
2 files changed
vlib/v/gen/c/comptime.v
@@ -987,7 +987,8 @@ fn (mut g Gen) comptime_for(node ast.ComptimeFor) {
987
g.writeln('/* attribute ${i} */ {')
988
g.writeln('\t${node.val_var}.name = _SLIT("${attr.name}");')
989
g.writeln('\t${node.val_var}.has_arg = ${attr.has_arg};')
990
- g.writeln('\t${node.val_var}.arg = _SLIT("${attr.arg}");')
+ g.writeln('\t${node.val_var}.arg = _SLIT("${util.smart_quote(attr.arg,
991
+ false)}");')
992
g.writeln('\t${node.val_var}.kind = AttributeKind__${attr.kind};')
993
g.stmts(node.stmts)
994
g.writeln('}')
vlib/v/tests/comptime/comptime_multiline_attr_test.v
@@ -0,0 +1,11 @@
1
+module main
2
+
3
+@[footer: 'Hello
4
+World']
5
+pub struct Config {}
6
7
+fn test_main() {
8
+ $for a in Config.attributes {
9
+ assert a.arg == 'Hello\nWorld'
10
+ }
11
+}
0 commit comments