Skip to content

Commit 9ff5531

Browse files
committed
Docs: update ast.md
1 parent e564707 commit 9ff5531

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: docs/ast.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,20 @@ interface VOnExpression <: Expression {
104104
type: "VOnExpression"
105105
body: [ Statement ]
106106
}
107+
108+
interface VSlotScopeExpression <: Expression {
109+
type: "VSlotScopeExpression"
110+
id: Pattern
111+
}
107112
```
108113

109114
- This is mustaches or directive values.
110115
- If syntax errors exist, `VExpressionContainer#expression` is `null`.
111116
- `Reference` is objects but not `Node`. Those are external references which are in the expression.
112117
- `Reference#variable` is the variable which is defined by a `VElement`. If a reference uses a global variable or a member of VM, this is `null`.
113118
- `VForExpression` is an expression node like [ForInStatement] but it has an array as `left` property and does not have `body` property. This is the value of [`v-for` directives].
114-
- `VOnExpression` is an expression node like [BlockStatement] but it does not have braces. This is the value of [`v-on` directives].
119+
- `VOnExpression` is an expression node like [BlockStatement] but it does not have braces. This is the value of [`v-on` directives] only if the `v-on` directive doesn't have that argument.
120+
- `VSlotScopeExpression` is an expression node like [VariableDeclarator]. This is the value of [`slot-scope` attribute] or the `scope` attribute of `<template>` elements.
115121

116122
> Note: `vue-eslint-parser` transforms `v-for="(x, i) in list"` to `for(let [x, i] in list);` then gives the configured parser (`espree` by default) it. This implies that it needs the capability to parse ES2015 destructuring in order to parse [`v-for` directives].
117123
@@ -163,6 +169,7 @@ interface VDirective <: Node {
163169
```
164170

165171
- If their attribute value does not exist, the `value` property is `null`.
172+
- The `slot-scope` attribute becomes `directive:true` specially.
166173

167174
## VStartTag
168175

@@ -248,7 +255,9 @@ This supports only HTML for now. However, I'm going to add other languages Vue.j
248255
[Pattern]: https://github.com/estree/estree/blob/master/es5.md#patterns
249256
[Identifier]: https://github.com/estree/estree/blob/master/es5.md#identifier
250257
[ForInStatement]: https://github.com/estree/estree/blob/master/es5.md#forinstatement
258+
[VariableDeclarator]: https://github.com/estree/estree/blob/master/es5.md#variabledeclarator
251259

252260
[`v-for` directives]: https://vuejs.org/v2/api/#v-for
253261
[`v-on` directives]: https://vuejs.org/v2/api/#v-on
254262
[scope]: https://vuejs.org/v2/guide/components.html#Scoped-Slots
263+
[`slot-scope` attribute]: https://vuejs.org/v2/guide/components.html#Scoped-Slots

0 commit comments

Comments
 (0)