Skip to content

Commit af5d356

Browse files
committed
fix: add columns
1 parent 87d6d00 commit af5d356

File tree

4 files changed

+36
-35
lines changed

4 files changed

+36
-35
lines changed

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function get_layer_names(name) {
1010
function create_location(node) {
1111
return {
1212
line: node.line,
13+
column: node.column,
1314
start: node.offset,
1415
}
1516
}

test/global.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@ test('mixed imports and layers', () => {
2626
{
2727
name: '__anonymous-1__',
2828
is_anonymous: true,
29-
locations: [{ line: 2, start: 3 }],
29+
locations: [{ line: 2, column: 3, start: 3 }],
3030
children: [],
3131
},
3232
{
3333
name: 'test',
3434
is_anonymous: false,
35-
locations: [{ line: 3, start: 36 }],
35+
locations: [{ line: 3, column: 3, start: 36 }],
3636
children: [],
3737
},
3838
{
3939
name: 'anotherTest',
4040
is_anonymous: false,
41-
locations: [{ line: 4, start: 75 }],
41+
locations: [{ line: 4, column: 3, start: 75 }],
4242
children: [
4343
{
4444
name: 'moreTest',
4545
is_anonymous: false,
46-
locations: [{ line: 5, start: 99 }],
46+
locations: [{ line: 5, column: 4, start: 99 }],
4747
children: [
4848
{
4949
name: 'deepTest',
5050
is_anonymous: false,
51-
locations: [{ line: 6, start: 121 }],
51+
locations: [{ line: 6, column: 5, start: 121 }],
5252
children: [],
5353
},
5454
],
@@ -58,7 +58,7 @@ test('mixed imports and layers', () => {
5858
{
5959
name: '__anonymous-2__',
6060
is_anonymous: true,
61-
locations: [{ line: 10, start: 176 }],
61+
locations: [{ line: 10, column: 3, start: 176 }],
6262
children: [],
6363
},
6464
]

test/import.spec.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test('@import url() layer', () => {
88
{
99
name: '__anonymous-1__',
1010
is_anonymous: true,
11-
locations: [{ line: 1, start: 0 }],
11+
locations: [{ line: 1, column: 1, start: 0 }],
1212
children: [],
1313
},
1414
]
@@ -21,7 +21,7 @@ test('@import url() LAYER', () => {
2121
{
2222
name: '__anonymous-1__',
2323
is_anonymous: true,
24-
locations: [{ line: 1, start: 0 }],
24+
locations: [{ line: 1, column: 1, start: 0 }],
2525
children: [],
2626
},
2727
]
@@ -34,7 +34,7 @@ test('@import url() layer(named)', () => {
3434
{
3535
name: 'named',
3636
is_anonymous: false,
37-
locations: [{ line: 1, start: 0 }],
37+
locations: [{ line: 1, column: 1, start: 0 }],
3838
children: [],
3939
},
4040
]
@@ -47,7 +47,7 @@ test('@import url() LAYER(named)', () => {
4747
{
4848
name: 'named',
4949
is_anonymous: false,
50-
locations: [{ line: 1, start: 0 }],
50+
locations: [{ line: 1, column: 1, start: 0 }],
5151
children: [],
5252
},
5353
]
@@ -60,12 +60,12 @@ test('@import url() layer(named.nested)', () => {
6060
{
6161
name: 'named',
6262
is_anonymous: false,
63-
locations: [{ line: 1, start: 0 }],
63+
locations: [{ line: 1, column: 1, start: 0 }],
6464
children: [
6565
{
6666
name: 'nested',
6767
is_anonymous: false,
68-
locations: [{ line: 1, start: 0 }],
68+
locations: [{ line: 1, column: 1, start: 0 }],
6969
children: [],
7070
},
7171
],
@@ -80,12 +80,12 @@ test('@import url() layer(named.nested )', () => {
8080
{
8181
name: 'named',
8282
is_anonymous: false,
83-
locations: [{ line: 1, start: 0 }],
83+
locations: [{ line: 1, column: 1, start: 0 }],
8484
children: [
8585
{
8686
name: 'nested',
8787
is_anonymous: false,
88-
locations: [{ line: 1, start: 0 }],
88+
locations: [{ line: 1, column: 1, start: 0 }],
8989
children: [],
9090
},
9191
],
@@ -100,12 +100,12 @@ test('@import url() layer(/* test */named.nested )', () => {
100100
{
101101
name: 'named',
102102
is_anonymous: false,
103-
locations: [{ line: 1, start: 0 }],
103+
locations: [{ line: 1, column: 1, start: 0 }],
104104
children: [
105105
{
106106
name: 'nested',
107107
is_anonymous: false,
108-
locations: [{ line: 1, start: 0 }],
108+
locations: [{ line: 1, column: 1, start: 0 }],
109109
children: [],
110110
},
111111
],

test/layer.spec.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test('single anonymous layer without body', () => {
99
name: '__anonymous-1__',
1010
is_anonymous: true,
1111
children: [],
12-
locations: [{ line: 1, start: 0 }],
12+
locations: [{ line: 1, column: 1, start: 0 }],
1313
},
1414
]
1515
assert.equal(actual, expected)
@@ -22,7 +22,7 @@ test('single anonymous layer with body', () => {
2222
name: '__anonymous-1__',
2323
is_anonymous: true,
2424
children: [],
25-
locations: [{ line: 1, start: 0 }],
25+
locations: [{ line: 1, column: 1, start: 0 }],
2626
},
2727
]
2828
assert.equal(actual, expected)
@@ -35,7 +35,7 @@ test('single named layer without body', () => {
3535
name: 'first',
3636
is_anonymous: false,
3737
children: [],
38-
locations: [{ line: 1, start: 0 }],
38+
locations: [{ line: 1, column: 1, start: 0 }],
3939
},
4040
]
4141
assert.equal(actual, expected)
@@ -48,7 +48,7 @@ test('single named layer with body', () => {
4848
name: 'first',
4949
is_anonymous: false,
5050
children: [],
51-
locations: [{ line: 1, start: 0 }],
51+
locations: [{ line: 1, column: 1, start: 0 }],
5252
},
5353
]
5454
assert.equal(actual, expected)
@@ -61,13 +61,13 @@ test('multiple named layers in one line', () => {
6161
name: 'first',
6262
is_anonymous: false,
6363
children: [],
64-
locations: [{ line: 1, start: 0 }],
64+
locations: [{ line: 1, column: 1, start: 0 }],
6565
},
6666
{
6767
name: 'second',
6868
is_anonymous: false,
6969
children: [],
70-
locations: [{ line: 1, start: 0 }],
70+
locations: [{ line: 1, column: 1, start: 0 }],
7171
},
7272
]
7373
assert.equal(actual, expected)
@@ -84,8 +84,8 @@ test('repeated use of the same layer name', () => {
8484
is_anonymous: false,
8585
children: [],
8686
locations: [
87-
{ line: 2, start: 3 },
88-
{ line: 3, start: 21 },
87+
{ line: 2, column: 3, start: 3 },
88+
{ line: 3, column: 3, start: 21 },
8989
],
9090
},
9191
]
@@ -106,23 +106,23 @@ test('nested layers', () => {
106106
{
107107
name: 'first',
108108
is_anonymous: false,
109-
locations: [{ line: 2, start: 3 }],
109+
locations: [{ line: 2, column: 3, start: 3 }],
110110
children: [
111111
{
112112
name: 'second',
113113
is_anonymous: false,
114-
locations: [{ line: 3, start: 21 }],
114+
locations: [{ line: 3, column: 4, start: 21 }],
115115
children: [
116116
{
117117
name: 'third',
118118
is_anonymous: false,
119-
locations: [{ line: 4, start: 41 }],
119+
locations: [{ line: 4, column: 5, start: 41 }],
120120
children: [],
121121
},
122122
{
123123
name: 'fourth',
124124
is_anonymous: false,
125-
locations: [{ line: 6, start: 79 }],
125+
locations: [{ line: 6, column: 5, start: 79 }],
126126
children: [],
127127
},
128128
],
@@ -143,13 +143,13 @@ test('nested layers with anonymous layers', () => {
143143
{
144144
name: '__anonymous-1__',
145145
is_anonymous: true,
146-
locations: [{ line: 2, start: 3 }],
146+
locations: [{ line: 2, column: 3, start: 3 }],
147147
children: [
148148
{
149149
name: '__anonymous-2__',
150150
is_anonymous: true,
151151
children: [],
152-
locations: [{ line: 3, start: 15 }],
152+
locations: [{ line: 3, column: 4, start: 15 }],
153153
},
154154
],
155155
},
@@ -166,13 +166,13 @@ test('consecutive anonymous layers', () => {
166166
{
167167
name: '__anonymous-1__',
168168
is_anonymous: true,
169-
locations: [{ line: 2, start: 3 }],
169+
locations: [{ line: 2, column: 3, start: 3 }],
170170
children: [],
171171
},
172172
{
173173
name: '__anonymous-2__',
174174
is_anonymous: true,
175-
locations: [{ line: 3, start: 15 }],
175+
locations: [{ line: 3, column: 3, start: 15 }],
176176
children: [],
177177
},
178178
]
@@ -191,20 +191,20 @@ test('nested layers with anonymous layers and duplicate names', () => {
191191
{
192192
name: '__anonymous-1__',
193193
is_anonymous: true,
194-
locations: [{ line: 2, start: 3 }],
194+
locations: [{ line: 2, column: 3, start: 3 }],
195195
children: [
196196
{
197197
name: 'first',
198198
is_anonymous: false,
199199
children: [],
200-
locations: [{ line: 3, start: 15 }],
200+
locations: [{ line: 3, column: 4, start: 15 }],
201201
},
202202
],
203203
},
204204
{
205205
name: 'first',
206206
is_anonymous: false,
207-
locations: [{ line: 6, start: 38 }],
207+
locations: [{ line: 6, column: 3, start: 38 }],
208208
children: [],
209209
},
210210
]

0 commit comments

Comments
 (0)