Skip to content

Commit

Permalink
Merge pull request #450 from entrylabs/bug/function_schema
Browse files Browse the repository at this point in the history
Bug/function schema
  • Loading branch information
chanlee authored Aug 18, 2016
2 parents e047735 + d93991e commit 3c5ccc3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
11 changes: 8 additions & 3 deletions dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -13904,8 +13904,8 @@ Entry.VariableContainer.prototype.setVariables = function(b) {
};
Entry.VariableContainer.prototype.setFunctions = function(b) {
b && b.forEach(function(a) {
Entry.generateFunctionSchema(a.id);
});
this.functions_[a.id] = !0;
}.bind(this));
for (var a in b) {
var c = new Entry.Func(b[a]);
c.generateBlock();
Expand Down Expand Up @@ -18894,7 +18894,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 = e.type;
(Entry.block[f] || Entry.variableContainer.functions_[f.split("_")[1]]) && this._data.push(new Entry.Block(e, this));
}
}
(d = this._code.view) && this.createView(d.board, b);
};
Expand Down
16 changes: 8 additions & 8 deletions dist/entry.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/variable_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ Entry.VariableContainer.prototype.setVariables = function(variables) {
Entry.VariableContainer.prototype.setFunctions = function(functions) {
if (functions) {
functions.forEach(function(f) {
Entry.generateFunctionSchema(f.id);
});
this.functions_[f.id] = true;
}.bind(this));
}

for (var i in functions) {
Expand Down
7 changes: 6 additions & 1 deletion src/workspace/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ Entry.Thread = function(thread, code, parent) {
if (block instanceof Entry.Block || block.isDummy) {
block.setThread(this);
this._data.push(block);
} else Entry.block[block.type] && this._data.push(new Entry.Block(block, this));
} else {
var blockType = block.type;
if (Entry.block[blockType] ||
Entry.variableContainer.functions_[blockType.split('_')[1]])
this._data.push(new Entry.Block(block, this));
}
}

var codeView = this._code.view;
Expand Down

0 comments on commit 3c5ccc3

Please sign in to comment.