Explorar o código

avoid duplicate context dependencies

Evan You %!s(int64=13) %!d(string=hai) anos
pai
achega
a5727bd4b3
Modificáronse 2 ficheiros con 9 adicións e 5 borrados
  1. 9 1
      src/deps-parser.js
  2. 0 4
      src/seed.js

+ 9 - 1
src/deps-parser.js

@@ -86,7 +86,15 @@ function parseContextDependency (binding) {
         matches = str.match(argRE),
         base = args[1].length + 7
     if (!matches) return null
-    binding.contextDeps = matches.map(function (key) { return key.slice(base) })
+    var i = matches.length,
+        deps = [], dep
+    while (i--) {
+        dep = matches[i].slice(base)
+        if (deps.indexOf(dep) === -1) {
+            deps.push(dep)
+        }
+    }
+    binding.contextDeps = deps
     binding.seed._contextBindings.push(binding)
 }
 

+ 0 - 4
src/seed.js

@@ -199,10 +199,6 @@ SeedProto._bind = function (directive) {
     seed = traceOwnerSeed(directive, seed)
     var binding = seed._bindings[key] || seed._createBinding(key)
 
-    if (binding.contextDeps) {
-        console.log(1)
-    }
-
     binding.instances.push(directive)
     directive.binding = binding