From d93991ee260228fae566ef0a8f57931abbd15802 Mon Sep 17 00:00:00 2001 From: vivid Date: Thu, 18 Aug 2016 16:53:27 +0900 Subject: [PATCH] function generate bug fix --- dist/entry.js | 11 ++++++++--- dist/entry.min.js | 16 ++++++++-------- src/variable_container.js | 4 ++-- src/workspace/thread.js | 7 ++++++- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 93907525f9..249cd46472 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -13891,8 +13891,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(); @@ -18881,7 +18881,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); }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 47f09a61ba..7446df886e 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1279,7 +1279,7 @@ for(c in this.lists_)d=this.lists_[c],d.object_||(a.push(d),e=d.listElement,this this.lists_[c],a.push(d),e=d.listElement,this.listView_.appendChild(e),d.callerListElement&&this.listView_.appendChild(d.callerListElement);if("all"==b||"func"==b)for(c in"func"==b&&this.listView_.appendChild(this.functionAddButton_),this.functions_)b=this.functions_[c],a.push(b),e=b.listElement,this.listView_.appendChild(e),b.callerListElement&&this.listView_.appendChild(b.callerListElement);this.listView_.appendChild(this.variableSettingView);this.listView_.appendChild(this.listSettingView)}}; Entry.VariableContainer.prototype.setMessages=function(b){for(var a in b){var c=b[a];c.id||(c.id=Entry.generateHash());this.createMessageView(c);this.messages_.push(c)}Entry.playground.reloadPlayground();this.updateList()}; Entry.VariableContainer.prototype.setVariables=function(b){for(var a in b){var c=new Entry.Variable(b[a]),d=c.getType();"variable"==d||"slide"==d?(c.generateView(this.variables_.length),this.createVariableView(c),this.variables_.push(c)):"list"==d?(c.generateView(this.lists_.length),this.createListView(c),this.lists_.push(c)):"timer"==d?this.generateTimer(c):"answer"==d&&this.generateAnswer(c)}Entry.isEmpty(Entry.engine.projectTimer)&&Entry.variableContainer.generateTimer();Entry.isEmpty(Entry.container.inputValue)&& -Entry.variableContainer.generateAnswer();Entry.playground.reloadPlayground();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();this.createFunctionView(c);this.functions_[c.id]=c}this.updateList()};Entry.VariableContainer.prototype.getFunction=function(b){return this.functions_[b]}; +Entry.variableContainer.generateAnswer();Entry.playground.reloadPlayground();this.updateList()};Entry.VariableContainer.prototype.setFunctions=function(b){b&&b.forEach(function(a){this.functions_[a.id]=!0}.bind(this));for(var a in b){var c=new Entry.Func(b[a]);c.generateBlock();this.createFunctionView(c);this.functions_[c.id]=c}this.updateList()};Entry.VariableContainer.prototype.getFunction=function(b){return this.functions_[b]}; Entry.VariableContainer.prototype.getVariable=function(b,a){var c=Entry.findObjsByKey(this.variables_,"id_",b)[0];a&&a.isClone&&c.object_&&(c=Entry.findObjsByKey(a.variables,"id_",b)[0]);return c};Entry.VariableContainer.prototype.getList=function(b,a){var c=Entry.findObjsByKey(this.lists_,"id_",b)[0];a&&a.isClone&&c.object_&&(c=Entry.findObjsByKey(a.lists,"id_",b)[0]);return c};Entry.VariableContainer.prototype.createFunction=function(){if(!Entry.Func.isEdit){var b=new Entry.Func;Entry.Func.edit(b)}}; Entry.VariableContainer.prototype.addFunction=function(b){};Entry.VariableContainer.prototype.removeFunction=function(b){var a=b.id;b=this.functions_;b[a].destroy();delete b[a];a="func_"+a;Entry.container.removeFuncBlocks(a);for(var c in b)b[c].content.removeBlocksByType(a);this.updateList()};Entry.VariableContainer.prototype.checkListPosition=function(b,a){var c=b.x_+b.width_,d=-b.y_,e=-b.y_+-b.height_;return a.x>b.x_&&a.xe?!0:!1}; Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[];if(0this.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&e