|
@ -36,6 +36,8 @@ function checkNode (node: ASTNode, warn: Function) { |
|
|
const range = node.rawAttrsMap[name] |
|
|
const range = node.rawAttrsMap[name] |
|
|
if (name === 'v-for') { |
|
|
if (name === 'v-for') { |
|
|
checkFor(node, `v-for="${value}"`, warn, range) |
|
|
checkFor(node, `v-for="${value}"`, warn, range) |
|
|
|
|
|
} else if (name === 'v-slot' || name[0] === '#') { |
|
|
|
|
|
checkFunctionParameterExpression(value, `${name}="${value}"`, warn, range) |
|
|
} else if (onRE.test(name)) { |
|
|
} else if (onRE.test(name)) { |
|
|
checkEvent(value, `${name}="${value}"`, warn, range) |
|
|
checkEvent(value, `${name}="${value}"`, warn, range) |
|
|
} else { |
|
|
} else { |
|
@ -111,3 +113,16 @@ function checkExpression (exp: string, text: string, warn: Function, range?: Ran |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function checkFunctionParameterExpression (exp: string, text: string, warn: Function, range?: Range) { |
|
|
|
|
|
try { |
|
|
|
|
|
new Function(exp, '') |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
warn( |
|
|
|
|
|
`invalid function parameter expression: ${e.message} in\n\n` + |
|
|
|
|
|
` ${exp}\n\n` + |
|
|
|
|
|
` Raw expression: ${text.trim()}\n`, |
|
|
|
|
|
range |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|