Skip to content

Commit 982913f

Browse files
committed
upgrade flow to 0.31 (close #3482)
1 parent 638d182 commit 982913f

File tree

7 files changed

+19
-21
lines changed

7 files changed

+19
-21
lines changed

flow/compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ declare type ASTElementHooks = { [key: string]: Array<string> }
5353

5454
declare type ASTDirective = {
5555
name: string;
56-
value: ?string;
56+
value: string;
5757
arg: ?string;
5858
modifiers: ?{ [key: string]: true };
5959
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"eslint-config-vue": "^1.0.3",
5959
"eslint-loader": "^1.3.0",
6060
"eslint-plugin-flow-vars": "^0.5.0",
61-
"flow-bin": "^0.27.0",
61+
"flow-bin": "^0.31.1",
6262
"flow-remove-types": "github:yyx990803/flow-remove-types",
6363
"http-server": "^0.9.0",
6464
"jasmine": "^2.4.1",

src/compiler/codegen/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function genElement (el: ASTElement): string {
7171
}
7272
}
7373

74-
function genIf (el: ASTElement): string {
74+
function genIf (el: any): string {
7575
const exp = el.if
7676
el.ifProcessed = true // avoid recursion
7777
return `(${exp})?${genElement(el)}:${genElse(el)}`
@@ -83,7 +83,7 @@ function genElse (el: ASTElement): string {
8383
: '_e()'
8484
}
8585

86-
function genFor (el: ASTElement): string {
86+
function genFor (el: any): string {
8787
const exp = el.for
8888
const alias = el.alias
8989
const iterator1 = el.iterator1 ? `,${el.iterator1}` : ''
@@ -228,7 +228,7 @@ function genSlot (el: ASTElement): string {
228228
: slot
229229
}
230230

231-
function genComponent (el: ASTElement): string {
231+
function genComponent (el: any): string {
232232
const children = genChildren(el)
233233
return `_h(${el.component},${genData(el)}${
234234
children ? `,${children}` : ''

src/core/vdom/create-component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function createComponent (
2727

2828
if (typeof Ctor !== 'function') {
2929
if (process.env.NODE_ENV !== 'production') {
30-
warn(`Invalid Component definition: ${Ctor}`, context)
30+
warn(`Invalid Component definition: ${String(Ctor)}`, context)
3131
}
3232
return
3333
}
@@ -208,7 +208,7 @@ function resolveAsyncComponent (
208208
// reject
209209
reason => {
210210
process.env.NODE_ENV !== 'production' && warn(
211-
`Failed to resolve async component: ${factory}` +
211+
`Failed to resolve async component: ${String(factory)}` +
212212
(reason ? `\nReason: ${reason}` : '')
213213
)
214214
}

src/platforms/web/compiler/directives/model.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function model (
2626
}
2727
}
2828

29-
function genCheckboxModel (el: ASTElement, value: ?string) {
29+
function genCheckboxModel (el: ASTElement, value: string) {
3030
if (process.env.NODE_ENV !== 'production' &&
3131
el.attrsMap.checked != null) {
3232
warn(
@@ -35,7 +35,7 @@ function genCheckboxModel (el: ASTElement, value: ?string) {
3535
'Declare initial values in the component\'s data option instead.'
3636
)
3737
}
38-
const valueBinding = getBindingAttr(el, 'value')
38+
const valueBinding = getBindingAttr(el, 'value') || 'null'
3939
const trueValueBinding = getBindingAttr(el, 'true-value') || 'true'
4040
const falseValueBinding = getBindingAttr(el, 'false-value') || 'false'
4141
addProp(el, 'checked',
@@ -57,7 +57,7 @@ function genCheckboxModel (el: ASTElement, value: ?string) {
5757
)
5858
}
5959

60-
function genRadioModel (el: ASTElement, value: ?string) {
60+
function genRadioModel (el: ASTElement, value: string) {
6161
if (process.env.NODE_ENV !== 'production' &&
6262
el.attrsMap.checked != null) {
6363
warn(
@@ -66,14 +66,14 @@ function genRadioModel (el: ASTElement, value: ?string) {
6666
'Declare initial values in the component\'s data option instead.'
6767
)
6868
}
69-
const valueBinding = getBindingAttr(el, 'value')
69+
const valueBinding = getBindingAttr(el, 'value') || 'null'
7070
addProp(el, 'checked', `(${value})===(${valueBinding})`)
7171
addHandler(el, 'change', `${value}=${valueBinding}`, null, true)
7272
}
7373

7474
function genDefaultModel (
7575
el: ASTElement,
76-
value: ?string,
76+
value: string,
7777
modifiers: ?Object
7878
): ?boolean {
7979
if (process.env.NODE_ENV !== 'production') {
@@ -116,7 +116,7 @@ function genDefaultModel (
116116
}
117117
}
118118

119-
function genSelect (el: ASTElement, value: ?string) {
119+
function genSelect (el: ASTElement, value: string) {
120120
if (process.env.NODE_ENV !== 'production') {
121121
el.children.some(checkOptionWarning)
122122
}
@@ -129,18 +129,16 @@ function genSelect (el: ASTElement, value: ?string) {
129129
return true
130130
}
131131

132-
function checkOptionWarning (option: ASTNode) {
132+
function checkOptionWarning (option: any): boolean {
133133
if (option.type === 1 &&
134134
option.tag === 'option' &&
135135
option.attrsMap.selected != null) {
136-
const parentModel = option.parent &&
137-
option.parent.type === 1 &&
138-
option.parent.attrsMap['v-model']
139136
warn(
140-
`<select v-model="${parentModel}">:\n` +
137+
`<select v-model="${option.parent.attrsMap['v-model']}">:\n` +
141138
'inline selected attributes on <option> will be ignored when using v-model. ' +
142139
'Declare initial values in the component\'s data option instead.'
143140
)
144141
return true
145142
}
143+
return false
146144
}

src/platforms/web/runtime/node-ops.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function setTextContent (node: Node, text: string) {
4646
node.textContent = text
4747
}
4848

49-
export function childNodes (node: Node): NodeList {
49+
export function childNodes (node: Node): NodeList<Node> {
5050
return node.childNodes
5151
}
5252

src/server/render.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ export function createRenderFunction (
7474
const key = name + '::' + getKey(node.componentOptions.propsData)
7575
if (has) {
7676
has(key, hit => {
77-
if (hit) {
77+
if (hit && get) {
7878
get(key, res => write(res, next))
7979
} else {
8080
renderComponentWithCache(node, write, next, isRoot, cache, key)
8181
}
8282
})
83-
} else {
83+
} else if (get) {
8484
get(key, res => {
8585
if (res) {
8686
write(res, next)

0 commit comments

Comments
 (0)