-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dara format 相关问题 #125
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在main函数中存在argsn,在进行dara format的时候会报错。
代码:
static async function main(args: [ string ])throws : void { var a = args[0]; }
报错信息:
exec error : Error: unimpelemented at Formatter.visitExpr (/opt/homebrew/lib/node_modules/@darabonba/cli/lib/formatter.js:511:13) at Formatter.visitDeclare (/opt/homebrew/lib/node_modules/@darabonba/cli/lib/formatter.js:597:10) at Formatter.visitStmt (/opt/homebrew/lib/node_modules/@darabonba/cli/lib/formatter.js:242:12) at Formatter.visitStmts (/opt/homebrew/lib/node_modules/@darabonba/cli/lib/formatter.js:609:12) at Formatter.visitFunction (/opt/homebrew/lib/node_modules/@darabonba/cli/lib/formatter.js:117:12) at Formatter.visit (/opt/homebrew/lib/node_modules/@darabonba/cli/lib/formatter.js:66:14) at FormatCommand.exec (/opt/homebrew/lib/node_modules/@darabonba/cli/commands/format.js:42:15) at CommandsApplication.exec (/opt/homebrew/lib/node_modules/@darabonba/cli/lib/app.js:154:13) at CommandsApplication.run (/opt/homebrew/lib/node_modules/@darabonba/cli/lib/app.js:34:12) at Object.<anonymous> (/opt/homebrew/lib/node_modules/@darabonba/cli/bin/dara.js:45:5)
若代码中存在for列表循环,dara format会将‘:’替换为'in',导致报错。
原代码
for (var a : response.body.list) { Console.log(a.b); }
格式化之后代码
for (var a in response.body.list) { Console.log(a.b); }
导致报错
SyntaxError: Unexpected token: Word:
in. Expect :, but Word:
inat Parser.error (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/node_modules/@jacksontian/skyline/lib/parser.js:56:11) at Parser.match (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/node_modules/@jacksontian/skyline/lib/parser.js:21:12) at Parser.forStmt (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/lib/parser.js:1604:10) at Parser.stmt (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/lib/parser.js:1653:19) at Parser.stmts (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/lib/parser.js:1465:23) at Parser.blockStmts (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/lib/parser.js:1477:22) at Parser.functionBody (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/lib/parser.js:1791:24) at Parser.fun (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/lib/parser.js:1770:27) at Parser.moduleBody (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/lib/parser.js:138:21) at Parser.module (/opt/homebrew/lib/node_modules/@darabonba/cli/node_modules/@darabonba/parser/lib/parser.js:105:24)
The text was updated successfully, but these errors were encountered: