private mrb_sym get_sym(string str) { int i = syms.IndexOf(str); if (i < 0) { i = syms.Length; syms.Push(str); } return((mrb_sym)(i + 1)); }
public override void compose(Block containerBlock) { // Reconfigure this block based on the mutator dialog's components. var typeBlock = containerBlock.getInputTargetBlock("STACK"); // Count number of inputs. var connections = new JsArray <Connection>(); while (typeBlock != null) { connections.Push((Connection)typeBlock["valueConnection_"]); typeBlock = typeBlock.nextConnection == null ? null : typeBlock.nextConnection.targetBlock(); } // Disconnect any children that don't belong. for (var i = 0; i < this.typeCount_; i++) { var connection = this.getInput("TYPE" + i).connection.targetConnection; if (connection != null && connections.IndexOf(connection) == -1) { connection.disconnect(); } } this.typeCount_ = connections.Length; this.updateShape_(); // Reconnect any child blocks. for (var i = 0; i < this.typeCount_; i++) { Blockly.Mutator.reconnect(connections[i], this, "TYPE" + i); } }