Skip to content

Commit

Permalink
fix:a.b.c()
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangnanscu committed Oct 7, 2024
1 parent 5c6646c commit b7e74c7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ where options are:
```js
const defaultOptions = {
debug: false,
tagArrayExpression: true,
importStatementHoisting: true,
transform$SymbolToDollar: true,
transformToString: true,
transformString: true,
transformJSONStringify: true,
Expand Down Expand Up @@ -53,6 +55,7 @@ js2lua(`let a = 1`, {importStatementHoisting:true})
```
## see also
[lua2js](https://xiangnanscu.github.io/lua2js/) transform lua to js
[lua-resty-array](https://github.com/xiangnanscu/lua-resty-array) lua version of JS Array (feature tagArrayExpression)

# Features
* [assignment](#assignment)
Expand Down Expand Up @@ -265,15 +268,9 @@ Position:echoInsCount()
p1:echoPosition()
p2:echoPosition()
p1:say("hello")
(function()
local __tmp = p1.say
return __tmp(p2)
end)()
p1.say(p2)
p1:echoNumbersLength("a", "b", "c")
(function()
local __tmp = p1.echoNumbersLength
return __tmp(p2, unpack(array {1, 2}))
end)()
p1.echoNumbersLength(p2, unpack(array {1, 2}))

```
## export
Expand Down Expand Up @@ -1109,10 +1106,7 @@ local cjson = require("cjson")

local a = {b = ""}
tostring(1)
(function()
local __tmp = a.b
return tostring(__tmp)
end)()
tostring(a.b)
cjson.encode({})
cjson.decode("{}")
tonumber("2")
Expand Down
3 changes: 3 additions & 0 deletions README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ where options are:
```js
const defaultOptions = {
debug: false,
tagArrayExpression: true,
importStatementHoisting: true,
transform$SymbolToDollar: true,
transformToString: true,
transformString: true,
transformJSONStringify: true,
Expand Down Expand Up @@ -53,6 +55,7 @@ js2lua(`let a = 1`, {importStatementHoisting:true})
```
## see also
[lua2js](https://xiangnanscu.github.io/lua2js/) transform lua to js
[lua-resty-array](https://github.com/xiangnanscu/lua-resty-array) lua version of JS Array (feature tagArrayExpression)

# Features
[CODE_TABLE]
2 changes: 2 additions & 0 deletions makeDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const folderPath = './test';
const markdown = fs.readFileSync('./README.template.md', 'utf8');
const files = fs.readdirSync(folderPath);
const opts = {
tagArrayExpression: true,
importStatementHoisting: true,
transform$SymbolToDollar: true,
transformToString: true,
transformString: true,
transformJSONStringify: true,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xiangnanscu/js2lua",
"version": "0.36.0",
"version": "0.37.0",
"type": "module",
"description": "Writing LuaJIT with the expressiveness of JavaScript.",
"main": "src/js2lua.mjs",
Expand All @@ -25,7 +25,7 @@
"push": "yarn commit",
"postpush": "while true; do git push && { echo 'Git push succeeded'; break; } || echo 'Git push failed, retrying in 1 seconds'; sleep 1; done",
"pull": "while true; do git pull && { echo 'Git pull succeeded'; break; } || echo 'Git pull failed, retrying in 1 seconds'; sleep 1; done",
"prerelease": "npm --no-git-tag-version version minor",
"prerelease": "npm --no-git-tag-version version minor; node ./makeDocs.js",
"release": "node makeDocs.js && push_option=release npm run push",
"rc": "yarn release",
"replace": "find . -type d \\( -name .git -o -name node_modules \\) -prune -o -type f -exec sed -i s/js2lua/field/g {} \\;",
Expand Down
1 change: 1 addition & 0 deletions src/js2lua.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ function ast2lua(ast, opts = {}) {
case "CallExpression": {
if (
ast.callee.type == "MemberExpression" &&
ast.callee.object.type !== "MemberExpression" &&
ast.callee.object.type !== "Identifier" &&
ast.callee.object.type !== "Super"
) {
Expand Down

0 comments on commit b7e74c7

Please sign in to comment.