Skip to content

Commit

Permalink
fix ojs interpreter bug with mutable and non-mutable expressions in s…
Browse files Browse the repository at this point in the history
…ame cell
  • Loading branch information
cscheid committed Nov 1, 2023
1 parent 36e9535 commit 9317fa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/resources/formats/html/ojs/quarto-ojs-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -12055,17 +12055,20 @@ var dist = {exports: {}};
let bodyText = cell.input.substring(cell.body.start, cell.body.end);
let expressionMap = {};
let references = [];
let counter = 0;
const cellReferences = Array.from(new Set((cell.references || []).map(ref => {
if (ref.type === "ViewExpression") {
if (expressionMap[ref.id.name] === undefined) {
expressionMap[ref.id.name] = ref.id.name;
references.push(ref.id.name);
const newName = `$${counter++}`;
expressionMap[ref.id.name] = newName;
references.push(newName);
}
return "viewof " + ref.id.name;
} else if (ref.type === "MutableExpression") {
if (expressionMap[ref.id.name] === undefined) {
expressionMap[ref.id.name] = ref.id.name;
references.push(ref.id.name);
const newName = `$${counter++}`;
expressionMap[ref.id.name] = newName;
references.push(newName);
}
return "mutable " + ref.id.name;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/formats/html/ojs/quarto-ojs-runtime.min.js

Large diffs are not rendered by default.

0 comments on commit 9317fa9

Please sign in to comment.