Skip to content

Commit

Permalink
Bugfix extcall on arrow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Oct 28, 2024
1 parent 81881ad commit f7bb76d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion chocimport.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const elements = {
},

ArrowFunctionExpression(el, {scopes, sc, ...state}) {
if (sc === "return" && el.expression) //Braceless arrow functions implicitly return
if (el.expression && (sc === "return" || Ctx.source_lines[el.loc.start.line - 1].endsWith("//extcall"))) //Braceless arrow functions implicitly return
descend(el.body, {scopes: [...scopes, { }], sc: "set_content", ...state});
else elements.FunctionExpression(el, {scopes, sc, ...state});
},
Expand Down
2 changes: 1 addition & 1 deletion factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ function autobind(obj, prop) {
choc = new Proxy(choc, {get: autobind});
lindt = new Proxy(lindt, {get: autobind});

choc.__version__ = "1.8.2";
choc.__version__ = "1.8.3";

//For modules, make the main entry-point easily available.
export default choc;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chocfactory",
"version": "1.8.2",
"version": "1.8.3",
"description": "Simple JS front end library",
"main": "factory.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions whatsnew.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Chocolate Factory version history

### v1.8.3
* Importer bugfix: `//extcall` now works on arrow functions (JS only)

### v1.8.2
* Bugfix use of DOM elements inside replace_content (can happen when mixing lindt
and choc). Previously it was possible for some such usage to result in elements
Expand Down

0 comments on commit f7bb76d

Please sign in to comment.