Skip to content

Commit c4897fa

Browse files
author
Evan You
committed
remove duplicate array in compiler
1 parent 25be79c commit c4897fa

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/compiler.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function Compiler (vm, options) {
5757
compiler.bindings = makeHash()
5858
compiler.dirs = []
5959
compiler.deferred = []
60-
compiler.exps = []
6160
compiler.computed = []
6261
compiler.children = []
6362
compiler.emitter = new Emitter()
@@ -657,7 +656,6 @@ CompilerProto.defineExp = function (key, binding, directive) {
657656
getter = ExpParser.parse(key, this, null, filters)
658657
if (getter) {
659658
this.markComputed(binding, getter)
660-
this.exps.push(binding)
661659
}
662660
}
663661

@@ -834,7 +832,7 @@ CompilerProto.destroy = function () {
834832
vm = compiler.vm,
835833
el = compiler.el,
836834
directives = compiler.dirs,
837-
exps = compiler.exps,
835+
computed = compiler.computed,
838836
bindings = compiler.bindings,
839837
delegators = compiler.delegators,
840838
children = compiler.children,
@@ -860,13 +858,13 @@ CompilerProto.destroy = function () {
860858
dir.unbind()
861859
}
862860

863-
// unbind all expressions (anonymous bindings)
864-
i = exps.length
861+
// unbind all computed, anonymous bindings
862+
i = computed.length
865863
while (i--) {
866-
exps[i].unbind()
864+
computed[i].unbind()
867865
}
868866

869-
// unbind all own bindings
867+
// unbind all keypath bindings
870868
for (key in bindings) {
871869
binding = bindings[key]
872870
if (binding) {

test/unit/specs/viewmodel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ describe('ViewModel', function () {
457457
}
458458
},
459459
dirs: [dirMock],
460-
exps: [{
460+
computed: [{
461461
unbind: function () {
462462
expUnbindCalled = true
463463
}

0 commit comments

Comments
 (0)