Skip to content

Commit

Permalink
Revert "Fix crash for script setup in no-obj-calls rule"
Browse files Browse the repository at this point in the history
This reverts commit 05f707e.
  • Loading branch information
ota-meshi committed May 17, 2022
1 parent 05f707e commit fb2f67d
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 2,200 deletions.
3 changes: 0 additions & 3 deletions scripts/update-fixtures-ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ function scopeToJSON(scopeManager) {
reference.resolved.defs[0].name,
),
init: reference.init || null,
vueUsedInTemplate: reference.vueUsedInTemplate
? reference.vueUsedInTemplate
: undefined,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/script-setup/scope-analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function analyzeUsedInTemplateVariables(

function markVariableAsUsed(name: string) {
const variable = scriptVariables.get(name)
if (!variable || variable.identifiers.length === 0) {
if (!variable) {
return
}
if (markedVariables.has(name)) {
Expand Down
105 changes: 2 additions & 103 deletions test/fixtures/ast/multiple-scripts-7/scope.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,39 +138,6 @@
}
},
"init": true
},
{
"identifier": {
"type": "Identifier",
"name": "count",
"loc": {
"start": {
"line": 2,
"column": 11
},
"end": {
"line": 2,
"column": 16
}
}
},
"from": "module",
"resolved": {
"type": "Identifier",
"name": "count",
"loc": {
"start": {
"line": 2,
"column": 11
},
"end": {
"line": 2,
"column": 16
}
}
},
"init": null,
"vueUsedInTemplate": true
}
]
},
Expand Down Expand Up @@ -211,41 +178,7 @@
"name": "MyComponent1"
}
],
"references": [
{
"identifier": {
"type": "Identifier",
"name": "MyComponent1",
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 19
}
}
},
"from": "module",
"resolved": {
"type": "Identifier",
"name": "MyComponent1",
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 19
}
}
},
"init": null,
"vueUsedInTemplate": true
}
]
"references": []
},
{
"name": "MyComponent2",
Expand Down Expand Up @@ -284,41 +217,7 @@
"name": "MyComponent2"
}
],
"references": [
{
"identifier": {
"type": "Identifier",
"name": "MyComponent2",
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 19
}
}
},
"from": "module",
"resolved": {
"type": "Identifier",
"name": "MyComponent2",
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 19
}
}
},
"init": null,
"vueUsedInTemplate": true
}
]
"references": []
},
{
"name": "a",
Expand Down
Loading

0 comments on commit fb2f67d

Please sign in to comment.