diff --git a/lib/tern.js b/lib/tern.js index 61625b75..26dccc0c 100644 --- a/lib/tern.js +++ b/lib/tern.js @@ -80,7 +80,7 @@ this.handlers = Object.create(null); this.files = []; - this.analyses = 0; + this.uses = 0; this.pending = 0; this.asyncError = null; this.passes = Object.create(null); @@ -108,7 +108,7 @@ }, reset: function() { this.cx = new infer.Context(this.defs, this); - this.analyses = 0; + this.uses = 0; for (var i = 0; i < this.files.length; ++i) clearFile(this, this.files[i]); this.signal("reset"); }, @@ -120,7 +120,7 @@ var self = this; doRequest(this, doc, function(err, data) { c(err, data); - if (self.analyses > 40) { + if (self.uses > 40) { self.reset(); analyzeAll(self, function(){}); } @@ -170,6 +170,7 @@ if (!query) c(null, {}); var files = doc.files || []; + if (files.length) ++srv.uses; for (var i = 0; i < files.length; ++i) { var file = files[i]; ensureFile(srv, file.name, file.type == "full" ? file.text : null) @@ -206,7 +207,6 @@ } function analyzeFile(srv, file) { - ++srv.analyses; infer.withContext(srv.cx, function() { file.scope = srv.cx.topScope; srv.signal("beforeLoad", file);