Skip to content

Commit 1860f5c

Browse files
committed
update vue annotations
1 parent 592099c commit 1860f5c

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

Diff for: vue-src/compiler/codegen/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ let staticRenderFns
1919
let onceCount
2020
let currentOptions
2121

22+
/*将AST语法树转化成render以及staticRenderFns的字符串*/
2223
export function generate (
2324
ast: ASTElement | void,
2425
options: CompilerOptions

Diff for: vue-src/compiler/optimizer.js

+2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ const genStaticKeysCached = cached(genStaticKeys)
2929
*/
3030
export function optimize (root: ?ASTElement, options: CompilerOptions) {
3131
if (!root) return
32+
/*标记是否为静态属性*/
3233
isStaticKey = genStaticKeysCached(options.staticKeys || '')
34+
/*标记是否是平台保留的标签*/
3335
isPlatformReservedTag = options.isReservedTag || no
3436
// first pass: mark all non-static nodes.
3537
/*处理所有非静态节点*/

Diff for: vue-src/core/vdom/create-element.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function createElement (
4545
return _createElement(context, tag, data, children, normalizationType)
4646
}
4747

48-
/*创建虚拟节点*/
48+
/*创建VNode节点*/
4949
export function _createElement (
5050
context: Component,
5151
tag?: string | Class<Component> | Function | Object,

Diff for: vue-src/shared/util.js

+3
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export function extend (to: Object, _from: ?Object): Object {
211211
/**
212212
* Merge an Array of Objects into a single Object.
213213
*/
214+
/*合并Array数组中的每一个对象到一个新的Object中*/
214215
export function toObject (arr: Array<any>): Object {
215216
const res = {}
216217
for (let i = 0; i < arr.length; i++) {
@@ -249,6 +250,7 @@ export function genStaticKeys (modules: Array<ModuleOptions>): string {
249250
* Check if two values are loosely equal - that is,
250251
* if they are plain objects, do they have the same shape?
251252
*/
253+
/*检测两个变量是否相等*/
252254
export function looseEqual (a: mixed, b: mixed): boolean {
253255
const isObjectA = isObject(a)
254256
const isObjectB = isObject(b)
@@ -266,6 +268,7 @@ export function looseEqual (a: mixed, b: mixed): boolean {
266268
}
267269
}
268270

271+
/*检测arr数组中是否包含与val变量相等的项*/
269272
export function looseIndexOf (arr: Array<mixed>, val: mixed): number {
270273
for (let i = 0; i < arr.length; i++) {
271274
if (looseEqual(arr[i], val)) return i

0 commit comments

Comments
 (0)