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;
};
function withLocationOffset(pat, offset) {
let startLine;
return pat.fmap((value) => {
value = typeof value === "object" && !Array.isArray(value) ? value : {value};
let locations = value.locations || [];
startLine = startLine || locations[0].start.line;
locations = locations.map(({start, end}) => {
const colOffset = startLine === end.line ? offset.start.column : 0;
const colOffset = start.line === 1 ? offset.start.column : 0;
return {
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
function withLocationOffset(pat, offset) {
// console.log('with offfset',pat,offset);
let startLine;
return pat.fmap((value)=>{
value = typeof value === 'object' && !Array.isArray(value) ? value : {
value
};
let locations = value.locations || [];
startLine = startLine || locations[0].start.line;
locations = locations.map(({ start , end })=>{
const colOffset = startLine === end.line ? offset.start.column : 0;
const colOffset = start.line === 1 ? offset.start.column : 0;
return {
start: {
...start,
@ -109276,4 +109273,4 @@ exports.default = cx;
},{"@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>
<div id="root"></div>
<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>
</html>