Debian Codegraph @

test cases/format/1 default/indentation.meson

raw
1 project(
2 'indentation',
3 default_options: {
4 'buildtype': 'release',
5 'default_library': 'shared',
6 'prefer_static': false,
7 'unity': 'off',
8 },
9 meson_version: '>= 1.5.0',
10 version: '1.2.3',
11 )
12
13 a = [
14 # comment
15 # comment
16 1,
17 # comment
18 2,
19 3,
20 [
21 4,
22 5,
23 6,
24 [
25 7,
26 8,
27 9,
28 [
29 10, # 10
30 11, # 11
31 12, # 12
32 ],
33 13,
34 14,
35 15,
36 ],
37 ],
38 ]
39 d = {}
40
41 if meson.project_version().version_compare('>1.2')
42 # comment
43 # comment
44 if meson.version().version_compare('>1.0')
45 # comment
46 # comment
47 foreach i : a
48 # comment
49 e = {
50 'a': 'a',
51 'b': 'b',
52 'c': 'c',
53 'd': [
54 1,
55 2,
56 3,
57 {
58 'e': 'e',
59 'f': 'f',
60 'g': 'g',
61 'h': {
62 'i': (
63 # a
64 1
65 # b
66 +
67 # c
68 2
69 ),
70 'j': [
71 1, # 1
72 2, # 2
73 3, # 3
74 ],
75 },
76 },
77 ],
78 }
79 endforeach
80
81 foreach j : a
82 # comment
83 # comment
84 # comment
85 endforeach
86 elif 42 in d
87 d += {'foo': 43}
88 else # ensure else is correctly indented (issue #13316)
89 # comment
90 k = 'k'
91 # comment
92 # comment
93 endif
94 endif
95
96 # Test for trailing comma:
97 m = [1, 2, 3]
98 n = [
99 1,
100 2,
101 3,
102 ]
103
104 # Overindent regressions (issue #14935)
105 if (host_cpu_family == 'x86' and host_system in [
106 'cygwin',
107 'windows',
108 'os2',
109 'interix',
110 ])
111 message('hi')
112 endif
113
114 # Underindent in files() (issue #14998)
115 sources = files(
116 # bar
117 # more bar
118 'bar.c',
119 # foo
120 # more foo
121 'foo.c',
122 )