name: 'on',
rawName: 'v-on.enter',
arg: undefined,
- modifiers: ['enter'],
+ modifiers: [
+ {
+ constType: 3,
+ content: 'enter',
+ isStatic: true,
+ loc: {
+ end: {
+ column: 16,
+ line: 1,
+ offset: 15,
+ },
+ source: 'enter',
+ start: {
+ column: 11,
+ line: 1,
+ offset: 10,
+ },
+ },
+ type: 4,
+ },
+ ],
exp: undefined,
loc: {
start: { offset: 5, line: 1, column: 6 },
name: 'on',
rawName: 'v-on.enter.exact',
arg: undefined,
- modifiers: ['enter', 'exact'],
+ modifiers: [
+ {
+ constType: 3,
+ content: 'enter',
+ isStatic: true,
+ loc: {
+ end: {
+ column: 16,
+ line: 1,
+ offset: 15,
+ },
+ source: 'enter',
+ start: {
+ column: 11,
+ line: 1,
+ offset: 10,
+ },
+ },
+ type: 4,
+ },
+ {
+ constType: 3,
+ content: 'exact',
+ isStatic: true,
+ loc: {
+ end: {
+ column: 22,
+ line: 1,
+ offset: 21,
+ },
+ source: 'exact',
+ start: {
+ column: 17,
+ line: 1,
+ offset: 16,
+ },
+ },
+ type: 4,
+ },
+ ],
exp: undefined,
loc: {
start: { offset: 5, line: 1, column: 6 },
source: 'click',
},
},
- modifiers: ['enter', 'exact'],
+ modifiers: [
+ {
+ constType: 3,
+ content: 'enter',
+ isStatic: true,
+ loc: {
+ end: {
+ column: 22,
+ line: 1,
+ offset: 21,
+ },
+ source: 'enter',
+ start: {
+ column: 17,
+ line: 1,
+ offset: 16,
+ },
+ },
+ type: 4,
+ },
+ {
+ constType: 3,
+ content: 'exact',
+ isStatic: true,
+ loc: {
+ end: {
+ column: 28,
+ line: 1,
+ offset: 27,
+ },
+ source: 'exact',
+ start: {
+ column: 23,
+ line: 1,
+ offset: 22,
+ },
+ },
+ type: 4,
+ },
+ ],
exp: undefined,
loc: {
start: { offset: 5, line: 1, column: 6 },
source: '[a.b]',
},
},
- modifiers: ['camel'],
+ modifiers: [
+ {
+ constType: 3,
+ content: 'camel',
+ isStatic: true,
+ loc: {
+ end: {
+ column: 22,
+ line: 1,
+ offset: 21,
+ },
+ source: 'camel',
+ start: {
+ column: 17,
+ line: 1,
+ offset: 16,
+ },
+ },
+ type: 4,
+ },
+ ],
exp: undefined,
loc: {
start: { offset: 5, line: 1, column: 6 },
source: 'a',
},
},
- modifiers: ['prop'],
+ modifiers: [
+ {
+ constType: 0,
+ content: 'prop',
+ isStatic: false,
+ loc: {
+ end: {
+ column: 1,
+ line: 1,
+ offset: 0,
+ },
+ source: '',
+ start: {
+ column: 1,
+ line: 1,
+ offset: 0,
+ },
+ },
+ type: 4,
+ },
+ ],
exp: {
type: NodeTypes.SIMPLE_EXPRESSION,
content: 'b',
source: 'a',
},
},
- modifiers: ['sync'],
+ modifiers: [
+ {
+ constType: 3,
+ content: 'sync',
+ isStatic: true,
+ loc: {
+ end: {
+ column: 13,
+ line: 1,
+ offset: 12,
+ },
+ source: 'sync',
+ start: {
+ column: 9,
+ line: 1,
+ offset: 8,
+ },
+ },
+ type: 4,
+ },
+ ],
exp: {
type: NodeTypes.SIMPLE_EXPRESSION,
content: 'b',
source: 'a',
},
},
- modifiers: ['enter'],
+ modifiers: [
+ {
+ constType: 3,
+ content: 'enter',
+ isStatic: true,
+ loc: {
+ end: {
+ column: 14,
+ line: 1,
+ offset: 13,
+ },
+ source: 'enter',
+ start: {
+ column: 9,
+ line: 1,
+ offset: 8,
+ },
+ },
+ type: 4,
+ },
+ ],
exp: {
type: NodeTypes.SIMPLE_EXPRESSION,
content: 'b',
rawName?: string
exp: ExpressionNode | undefined
arg: ExpressionNode | undefined
- modifiers: string[]
+ modifiers: SimpleExpressionNode[]
/**
* optional property to cache the expression parse result for v-for
*/
rawName: raw,
exp: undefined,
arg: undefined,
- modifiers: raw === '.' ? ['prop'] : [],
+ modifiers: raw === '.' ? [createSimpleExpression('prop')] : [],
loc: getLoc(start),
}
if (name === 'pre') {
setLocEnd(arg.loc, end)
}
} else {
- ;(currentProp as DirectiveNode).modifiers.push(mod)
+ const exp = createSimpleExpression(mod, true, getLoc(start, end))
+ ;(currentProp as DirectiveNode).modifiers.push(exp)
}
},
if (
__COMPAT__ &&
currentProp.name === 'bind' &&
- (syncIndex = currentProp.modifiers.indexOf('sync')) > -1 &&
+ (syncIndex = currentProp.modifiers.findIndex(
+ mod => mod.content === 'sync',
+ )) > -1 &&
checkCompatEnabled(
CompilerDeprecationTypes.COMPILER_V_BIND_SYNC,
currentOptions,
}
// force hydration for v-bind with .prop modifier
- if (isVBind && modifiers.includes('prop')) {
+ if (isVBind && modifiers.some(mod => mod.content === 'prop')) {
patchFlag |= PatchFlags.NEED_HYDRATION
}
}
// .sync is replaced by v-model:arg
- if (modifiers.includes('camel')) {
+ if (modifiers.some(mod => mod.content === 'camel')) {
if (arg.type === NodeTypes.SIMPLE_EXPRESSION) {
if (arg.isStatic) {
arg.content = camelize(arg.content)
}
if (!context.inSSR) {
- if (modifiers.includes('prop')) {
+ if (modifiers.some(mod => mod.content === 'prop')) {
injectPrefix(arg, '.')
}
- if (modifiers.includes('attr')) {
+ if (modifiers.some(mod => mod.content === 'attr')) {
injectPrefix(arg, '^')
}
}
// modelModifiers: { foo: true, "bar-baz": true }
if (dir.modifiers.length && node.tagType === ElementTypes.COMPONENT) {
const modifiers = dir.modifiers
+ .map(m => m.content)
.map(m => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`)
.join(`, `)
const modifiersKey = arg
const resolveModifiers = (
key: ExpressionNode,
- modifiers: string[],
+ modifiers: SimpleExpressionNode[],
context: TransformContext,
loc: SourceLocation,
) => {
const eventOptionModifiers = []
for (let i = 0; i < modifiers.length; i++) {
- const modifier = modifiers[i]
+ const modifier = modifiers[i].content
if (
__COMPAT__ &&