Skip to content

Commit

Permalink
Merge pull request #451 from entrylabs/hotfix/functions
Browse files Browse the repository at this point in the history
function refs
  • Loading branch information
chanlee authored Aug 18, 2016
2 parents 2a6496d + 948ec94 commit a47f619
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 30 deletions.
18 changes: 14 additions & 4 deletions dist/entry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(b) {
b || (b = Entry.getStartProject(Entry.mediaFilePath));
this.setFuncRefs(b.functions);
"workspace" == this.type && Entry.stateManager.startIgnore();
Entry.projectId = b._id;
Entry.variableContainer.setVariables(b.variables);
Expand All @@ -16,6 +17,7 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:
Entry.engine.projectTimer || Entry.variableContainer.generateTimer();
0 === Object.keys(Entry.container.inputValue).length && Entry.variableContainer.generateAnswer();
Entry.start();
this.removeFuncRefs();
return b;
}, exportProject:function(b) {
b || (b = {});
Expand Down Expand Up @@ -123,6 +125,12 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:
a.template = Lang.template.function_general;
Entry.block[b] = a;
}
}, setFuncRefs:function(b) {
this.functions = b ? b.map(function(a) {
return a.id;
}) : [];
}, removeFuncRefs:function() {
delete this.functions;
}};
window.Entry = Entry;
Entry.Albert = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, leftEye:0, rightEye:0, note:0, bodyLed:0, frontLed:0, padWidth:0, padHeight:0}, setZero:function() {
Expand Down Expand Up @@ -13890,9 +13898,6 @@ Entry.VariableContainer.prototype.setVariables = function(b) {
this.updateList();
};
Entry.VariableContainer.prototype.setFunctions = function(b) {
b && b.forEach(function(a) {
Entry.generateFunctionSchema(a.id);
});
for (var a in b) {
var c = new Entry.Func(b[a]);
c.generateBlock();
Expand Down Expand Up @@ -18881,7 +18886,12 @@ Entry.Thread = function(b, a, c) {
}
for (var d = 0;d < a.length;d++) {
var e = a[d];
e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : Entry.block[e.type] && this._data.push(new Entry.Block(e, this));
if (e instanceof Entry.Block || e.isDummy) {
e.setThread(this), this._data.push(e);
} else {
var f = Entry.functions, g = e.type;
(Entry.block[g] || f && -1 < f.indexOf(g.split("_")[1])) && this._data.push(new Entry.Block(e, this));
}
}
(d = this._code.view) && this.createView(d.board, b);
};
Expand Down
Loading

0 comments on commit a47f619

Please sign in to comment.