Changes in column numbers with get-scope
I noticed that in the presence of #include
s, the ranges provided by LIGO in get-scope
have changed. For instance, suppose I have this:
A.mligo
#include "B.mligo"
#include "C.mligo"
let a = b + c
(note the empty line at the beginning of the file)
B.mligo
let b = 0
C.mligo
let c = 0
Calling get-scope
for A.mligo
using LIGO 0.52.0 would, for example, say this is the starting point where a
is defined:
"start": {
"byte": {
"pos_fname": "test/contracts/find/LIGO-260/A.mligo",
"pos_lnum": 4,
"pos_bol": 25,
"pos_cnum": 29
},
"point_num": 29,
"point_bol": 25
}
And now by doing pos_cnum - pos_bol + 1
, you could retrieve the original column number (5
). But with LIGO 0.53.0, this is the output:
"start": {
"byte": {
"pos_fname": "test/contracts/find/LIGO-260/A.mligo",
"pos_lnum": 4,
"pos_bol": 1,
"pos_cnum": 7
},
"point_num": 99,
"point_bol": 92
}
I don't understand what is the new equation to extract the column number. Initially, it seems like either pos_cnum - pos_bol - 1
or point_num - point_bol - 2
, but these equations will fail for other definitions.
Note that even for B.mligo
, which has no directives, the output is also different. With 0.52.0:
"start": {
"byte": {
"pos_fname": "test/contracts/find/LIGO-260/B.mligo",
"pos_lnum": 1,
"pos_bol": 0,
"pos_cnum": 4
},
"point_num": 4,
"point_bol": 0
}
And with 0.53.0:
"start": {
"byte": {
"pos_fname": "test/contracts/find/LIGO-260/B.mligo",
"pos_lnum": 1,
"pos_bol": 1,
"pos_cnum": 4
},
"point_num": 90,
"point_bol": 86
}
So my question is, is this a regression, or did the way that columns need to be calculated change? If it changed, how should we do it now?