-
-
Notifications
You must be signed in to change notification settings - Fork 79
Fixed syntax error when function expression on v-on
.
#35
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
Fixed syntax error when function expression on v-on
.
#35
Conversation
Codecov Report
@@ Coverage Diff @@
## master #35 +/- ##
==========================================
+ Coverage 85.94% 85.97% +0.03%
==========================================
Files 32 32
Lines 2013 2018 +5
Branches 514 515 +1
==========================================
+ Hits 1730 1735 +5
Misses 192 192
Partials 91 91
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR, and I apologize for my delay.
I have a change request. Please unwrap VOnExpression
node if Vue.js doesn't handle it as a statement list. I intended VOnExpression
node to be a statement list such as BlockStatement
.
Thank you for checking!
Is that to build an AST like the following? code: <a @click="function(arg){ foo(); }"> AST on {
"type": "VOnExpression",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "foo"
},
"arguments": []
}
}
]
} Do you unwrap in the same way for |
AST of code: <a @click="arg => foo();"> {
"type": "VOnExpression",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "ArrowFunctionExpression",
"params": [
{
"type": "Identifier",
"name": "arg"
}
],
"body": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "foo"
},
"arguments": []
}
}
}
]
} |
No. I meant to use For example: <a @click="function(arg){ foo(); }">
ExpressionContainer > FunctionExpression
<a @click="arg => foo()">
ExpressionContainer > ArrowFunctionExpression
<a @click="foo">
ExpressionContainer > Identifier
<a @click="foo; bar;">
ExpressionContainer > VOnExpression > ExpressionStatement x 2 |
I got it! |
@mysticatea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you very much!
This PR will fix parsing errors reported in vuejs/eslint-plugin-vue#716.