This commit is contained in:
Felix Roos 2022-02-21 01:20:44 +01:00
parent fd5ac5898c
commit 8ce9986479
4 changed files with 5 additions and 10 deletions

View file

@ -605,13 +605,11 @@ Pattern.prototype.bootstrap = () => {
return bootstrapped; return bootstrapped;
}; };
function withLocationOffset(pat, offset) { function withLocationOffset(pat, offset) {
let startLine;
return pat.fmap((value) => { return pat.fmap((value) => {
value = typeof value === "object" && !Array.isArray(value) ? value : {value}; value = typeof value === "object" && !Array.isArray(value) ? value : {value};
let locations = value.locations || []; let locations = value.locations || [];
startLine = startLine || locations[0].start.line;
locations = locations.map(({start, end}) => { locations = locations.map(({start, end}) => {
const colOffset = startLine === end.line ? offset.start.column : 0; const colOffset = start.line === 1 ? offset.start.column : 0;
return { return {
start: { start: {
...start, ...start,

View file

@ -42720,16 +42720,13 @@ Pattern.prototype.bootstrap = ()=>{
}; };
// this is wrapped around mini patterns to offset krill parser location into the global js code space // this is wrapped around mini patterns to offset krill parser location into the global js code space
function withLocationOffset(pat, offset) { function withLocationOffset(pat, offset) {
// console.log('with offfset',pat,offset);
let startLine;
return pat.fmap((value)=>{ return pat.fmap((value)=>{
value = typeof value === 'object' && !Array.isArray(value) ? value : { value = typeof value === 'object' && !Array.isArray(value) ? value : {
value value
}; };
let locations = value.locations || []; let locations = value.locations || [];
startLine = startLine || locations[0].start.line;
locations = locations.map(({ start , end })=>{ locations = locations.map(({ start , end })=>{
const colOffset = startLine === end.line ? offset.start.column : 0; const colOffset = start.line === 1 ? offset.start.column : 0;
return { return {
start: { start: {
...start, ...start,
@ -109276,4 +109273,4 @@ exports.default = cx;
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2") },{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
//# sourceMappingURL=index.e1279fc8.js.map //# sourceMappingURL=index.a96519ca.js.map

File diff suppressed because one or more lines are too long

View file

@ -11,6 +11,6 @@
<body> <body>
<div id="root"></div> <div id="root"></div>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<script src="/tutorial/index.e1279fc8.js" defer=""></script> <script src="/tutorial/index.a96519ca.js" defer=""></script>
</body> </body>
</html> </html>