}
`;
+exports[`compiler: parse Errors X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END <div v-foo:[sef fsef] /> 1`] = `
+Object {
+ "children": Array [
+ Object {
+ "children": Array [],
+ "codegenNode": undefined,
+ "isSelfClosing": true,
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ "offset": 24,
+ },
+ "source": "<div v-foo:[sef fsef] />",
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "ns": 0,
+ "props": Array [
+ Object {
+ "arg": Object {
+ "content": "se",
+ "isStatic": false,
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ "offset": 15,
+ },
+ "source": "[sef",
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ "offset": 11,
+ },
+ },
+ "type": 4,
+ },
+ "exp": undefined,
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 1,
+ "offset": 15,
+ },
+ "source": "v-foo:[sef",
+ "start": Object {
+ "column": 6,
+ "line": 1,
+ "offset": 5,
+ },
+ },
+ "modifiers": Array [],
+ "name": "foo",
+ "type": 7,
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ "offset": 21,
+ },
+ "source": "fsef]",
+ "start": Object {
+ "column": 17,
+ "line": 1,
+ "offset": 16,
+ },
+ },
+ "name": "fsef]",
+ "type": 6,
+ "value": undefined,
+ },
+ ],
+ "tag": "div",
+ "tagType": 0,
+ "type": 1,
+ },
+ ],
+ "hoists": Array [],
+ "imports": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ "offset": 24,
+ },
+ "source": "<div v-foo:[sef fsef] />",
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "statements": Array [],
+ "type": 0,
+}
+`;
+
exports[`compiler: parse Errors X_MISSING_END_TAG <template><div> 1`] = `
Object {
"children": Array [
code: '{{}}',
errors: []
}
+ ],
+ X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END: [
+ {
+ code: `<div v-foo:[sef fsef] />`,
+ errors: [
+ {
+ type: ErrorCodes.X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END,
+ loc: { offset: 15, line: 1, column: 16 }
+ }
+ ]
+ }
]
}
})
})
+ test('function params should not affect out of scope identifiers', () => {
+ const node = parseWithExpressionTransform(
+ `{{ { a: foo => foo, b: foo } }}`
+ ) as InterpolationNode
+ expect(node.content).toMatchObject({
+ type: NodeTypes.COMPOUND_EXPRESSION,
+ children: [
+ `{ a: `,
+ { content: `foo` },
+ ` => `,
+ { content: `foo` },
+ `, b: `,
+ { content: `_ctx.foo` },
+ ` }`
+ ]
+ })
+ })
+
test('should prefix default value of function param destructuring', () => {
const node = parseWithExpressionTransform(
`{{ ({ foo = bar }) => foo + bar }}`
case NodeTypes.JS_SLOT_FUNCTION:
genSlotFunction(node, context)
break
+ /* istanbul ignore next */
default:
- /* istanbul ignore if */
if (__DEV__) {
assert(false, `unhandled codegen node type: ${(node as any).type}`)
// make sure we exhaust all possible types
template: string | RootNode,
options: CompilerOptions = {}
): CodegenResult {
+ /* istanbul ignore if */
if (__BROWSER__) {
const onError = options.onError || defaultOnError
if (options.prefixIdentifiers === true) {