Skip to content

Commit

Permalink
Clear AVal's .proto caches when purging types from them
Browse files Browse the repository at this point in the history
Closes #36
  • Loading branch information
marijnh committed Apr 8, 2013
1 parent e432d2a commit ea47748
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var server, editor, defs = [];
var Pos = CodeMirror.Pos;
var docs = [], curDoc;

var bigDoc = 250, useWorker = true;
var bigDoc = 250, useWorker = false;

function findDoc(name) {
for (var i = 0; i < docs.length; ++i) if (docs[i].name == name) return docs[i];
Expand Down
15 changes: 8 additions & 7 deletions infer.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,10 @@
var known = this.hasProp(prop);
if (!known) {
known = this.defProp(prop);
if (known.isEmpty()) {
var proto = new Obj(true);
proto.provisionary = true;
known.addType(proto);
}
var proto = new Obj(true);
proto.origin = this.origin;
proto.provisionary = true;
known.addType(proto);
}
return known;
}
Expand Down Expand Up @@ -996,10 +995,12 @@
}
if (this.forward) for (var i = 0; i < this.forward.length; ++i) {
var f = this.forward[i];
if (test(f))
if (test(f)) {
this.forward.splice(i--, 1);
else if (f.purge)
if (this.props) this.props = null;
} else if (f.purge) {
f.purge(test);
}
}
};
ANull.purge = Type.prototype.purge = function() {};
Expand Down

0 comments on commit ea47748

Please sign in to comment.