content: `id`,
isStatic: true,
loc: {
- start: {
- line: 1,
- column: 13,
- offset: 12
- },
- end: {
- line: 1,
- column: 15,
- offset: 14
- }
+ start: { line: 1, column: 13, offset: 12 },
+ end: { line: 1, column: 15, offset: 14 }
}
},
value: {
content: `id`,
isStatic: false,
loc: {
- start: {
- line: 1,
- column: 1,
- offset: 0
- },
- end: {
- line: 1,
- column: 1,
- offset: 0
- }
+ start: { line: 1, column: 13, offset: 12 },
+ end: { line: 1, column: 15, offset: 14 }
}
}
})
createObjectProperty,
createSimpleExpression,
ExpressionNode,
- locStub,
NodeTypes
} from '../ast'
import { createCompilerError, ErrorCodes } from '../errors'
const { modifiers, loc } = dir
const arg = dir.arg!
+ // :arg is replaced by :arg="arg"
+ let { exp } = dir
+ if (!exp && arg.type === NodeTypes.SIMPLE_EXPRESSION) {
+ const propName = camelize(arg.content)
+ exp = dir.exp = createSimpleExpression(propName, false, arg.loc)
+ if (!__BROWSER__) {
+ exp = dir.exp = processExpression(exp, context)
+ }
+ }
+
if (arg.type !== NodeTypes.SIMPLE_EXPRESSION) {
arg.children.unshift(`(`)
arg.children.push(`) || ""`)
}
}
- // :arg is replaced by :arg="arg"
- let { exp } = dir
- if (!exp && arg.type === NodeTypes.SIMPLE_EXPRESSION) {
- const propName = camelize(arg.loc.source)
- const simpleExpression = createSimpleExpression(propName, false, {
- ...locStub,
- source: propName
- })
-
- exp = dir.exp = processExpression(simpleExpression, context)
- }
-
if (
!exp ||
(exp.type === NodeTypes.SIMPLE_EXPRESSION && !exp.content.trim())