wip(compiler-dom): v-model runtime

This commit is contained in:
Evan You
2019-10-10 18:02:51 -04:00
parent 145559e170
commit d376439167
21 changed files with 245 additions and 95 deletions

View File

@@ -2,7 +2,6 @@ import { isString } from '@vue/shared'
import { ForParseResult } from './transforms/vFor'
import {
CREATE_VNODE,
RuntimeHelper,
APPLY_DIRECTIVES,
RENDER_SLOT,
CREATE_SLOTS,
@@ -88,7 +87,7 @@ export type TemplateChildNode =
export interface RootNode extends Node {
type: NodeTypes.ROOT
children: TemplateChildNode[]
helpers: RuntimeHelper[]
helpers: symbol[]
components: string[]
directives: string[]
hoists: JSChildNode[]
@@ -184,7 +183,7 @@ export interface CompoundExpressionNode extends Node {
| InterpolationNode
| TextNode
| string
| RuntimeHelper)[]
| symbol)[]
// an expression parsed as the params of a function will track
// the identifiers declared inside the function body.
identifiers?: string[]
@@ -226,10 +225,10 @@ export type JSChildNode =
export interface CallExpression extends Node {
type: NodeTypes.JS_CALL_EXPRESSION
callee: string | RuntimeHelper
callee: string | symbol
arguments: (
| string
| RuntimeHelper
| symbol
| JSChildNode
| TemplateChildNode
| TemplateChildNode[])[]
@@ -276,17 +275,17 @@ export interface ConditionalExpression extends Node {
export interface PlainElementCodegenNode extends CallExpression {
callee: typeof CREATE_VNODE | typeof CREATE_BLOCK
arguments: // tag, props, children, patchFlag, dynamicProps
| [string | RuntimeHelper]
| [string | RuntimeHelper, PropsExpression]
| [string | RuntimeHelper, 'null' | PropsExpression, TemplateChildNode[]]
| [string | symbol]
| [string | symbol, PropsExpression]
| [string | symbol, 'null' | PropsExpression, TemplateChildNode[]]
| [
string | RuntimeHelper,
string | symbol,
'null' | PropsExpression,
'null' | TemplateChildNode[],
string
]
| [
string | RuntimeHelper,
string | symbol,
'null' | PropsExpression,
'null' | TemplateChildNode[],
string,
@@ -302,17 +301,17 @@ export type ElementCodegenNode =
export interface PlainComponentCodegenNode extends CallExpression {
callee: typeof CREATE_VNODE | typeof CREATE_BLOCK
arguments: // Comp, props, slots, patchFlag, dynamicProps
| [string | RuntimeHelper]
| [string | RuntimeHelper, PropsExpression]
| [string | RuntimeHelper, 'null' | PropsExpression, SlotsExpression]
| [string | symbol]
| [string | symbol, PropsExpression]
| [string | symbol, 'null' | PropsExpression, SlotsExpression]
| [
string | RuntimeHelper,
string | symbol,
'null' | PropsExpression,
'null' | SlotsExpression,
string
]
| [
string | RuntimeHelper,
string | symbol,
'null' | PropsExpression,
'null' | SlotsExpression,
string,