import { DirectiveTransform } from '../transform' import { createSimpleExpression, createObjectProperty, createCompoundExpression, NodeTypes, Property, ElementTypes, ExpressionNode, ConstantTypes } from '../ast' import { createCompilerError, ErrorCodes } from '../errors' import { isMemberExpression, isSimpleIdentifier, hasScopeRef, isStaticExp } from '../utils' import { IS_REF } from '../runtimeHelpers' import { BindingTypes } from '../options' export const transformModel: DirectiveTransform = (dir, node, context) => { const { exp, arg } = dir if (!exp) { context.onError( createCompilerError(ErrorCodes.X_V_MODEL_NO_EXPRESSION, dir.loc) ) return createTransformProps() } const rawExp = exp.loc.source const expString = exp.type === NodeTypes.SIMPLE_EXPRESSION ? exp.content : rawExp // im SFC