Skip to content

Commit

Permalink
sojsonv7: fix bug when ObjectProperty.key is an Identifier #72
Browse files Browse the repository at this point in the history
Signed-off-by: echo094 <[email protected]>
  • Loading branch information
echo094 authored Feb 19, 2024
1 parent acc3ebe commit 48b4739
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugin/sojsonv7.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,12 @@ function unpackCall(path) {
if (!t.isObjectProperty(prop)) {
return
}
let key = prop.key.value
let key
if (t.isIdentifier(prop.key)) {
key = prop.key.name
} else {
key = prop.key.value
}
if (t.isFunctionExpression(prop.value)) {
// 符合要求的函数必须有且仅有一条return语句
if (prop.value.body.body.length !== 1) {
Expand Down

0 comments on commit 48b4739

Please sign in to comment.