MCPcopy
hub / github.com/vuejs/core / ondirname

Function ondirname

packages/compiler-core/src/parser.ts:201–246  ·  view source on GitHub ↗
(start, end)

Source from the content-addressed store, hash-verified

199 },
200
201 ondirname(start, end) {
202 const raw = getSlice(start, end)
203 const name =
204 raw === '.' || raw === ':'
205 ? 'bind'
206 : raw === '@'
207 ? 'on'
208 : raw === '#'
209 ? 'slot'
210 : raw.slice(2)
211
212 if (!inVPre && name === '') {
213 emitError(ErrorCodes.X_MISSING_DIRECTIVE_NAME, start)
214 }
215
216 if (inVPre || name === '') {
217 currentProp = {
218 type: NodeTypes.ATTRIBUTE,
219 name: raw,
220 nameLoc: getLoc(start, end),
221 value: undefined,
222 loc: getLoc(start),
223 }
224 } else {
225 currentProp = {
226 type: NodeTypes.DIRECTIVE,
227 name,
228 rawName: raw,
229 exp: undefined,
230 arg: undefined,
231 modifiers: raw === '.' ? [createSimpleExpression('prop')] : [],
232 loc: getLoc(start),
233 }
234 if (name === 'pre') {
235 inVPre = tokenizer.inVPre = true
236 currentVPreBoundary = currentOpenTag
237 // convert dirs before this one to attributes
238 const props = currentOpenTag!.props
239 for (let i = 0; i < props.length; i++) {
240 if (props[i].type === NodeTypes.DIRECTIVE) {
241 props[i] = dirToAttr(props[i] as DirectiveNode)
242 }
243 }
244 }
245 }
246 },
247
248 ondirarg(start, end) {
249 if (start === end) return

Callers

nothing calls this directly

Calls 5

createSimpleExpressionFunction · 0.90
getSliceFunction · 0.85
emitErrorFunction · 0.85
getLocFunction · 0.85
dirToAttrFunction · 0.85

Tested by

no test coverage detected