AustinDube / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

Headless blockly doesn't work for function/procedure calls with parameters #268

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. open the Headless blockly demo (/blockly/demos/headless/index.html)
2. paste an XML source of a program that contains a call to a procedure with 
one or more parameters.
3. Click the "Generate Python" button.

What is the expected output? What do you see instead?
Python code should appear in the right text area.
Instead, an exception is thrown.

What browser are you using?
Chromium, Version 40.0.2214.111 Built on Ubuntu 14.04, running on LinuxMint 
17.1 (64-bit)

Please provide any additional information below.

It seems to be a regression issue connected to these commits:
c816b2bb72945e9a1677321c59842bfbf0ee88ff (Routine recompile.)
4a5f0a0bf15b21fbdc8338ef612617977bf6b727 (Fixed issue with mutated function 
call blocks)

Older revisions of Blockly handle the headless code generation well for 
functions, but there is the issue with mutated function call blocks.

XML source to reproduce the error:
<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="procedures_callnoreturn" id="22" inline="false" x="44" y="213">
    <mutation name="do something">
      <arg name="x"></arg>
    </mutation>
  </block>
  <block type="procedures_defnoreturn" id="21" x="294" y="202">
    <mutation>
      <arg name="x"></arg>
    </mutation>
    <field name="NAME">do something</field>
  </block>
</xml>

Exception:
Uncaught TypeError: undefined is not a functionblockly_compressed.js:1582 
Blockly.FieldLabel.initblockly_compressed.js:1589 
Blockly.Input.initblocks_compressed.js:111 
Blockly.Blocks.procedures_callnoreturn.setProcedureParametersblocks_compressed.j
s:113 
Blockly.Blocks.procedures_callnoreturn.domToMutationblockly_compressed.js:1630 
Blockly.Xml.domToBlockHeadless_blockly_compressed.js:1628 
Blockly.Xml.domToBlockblockly_compressed.js:1627 
Blockly.Xml.domToWorkspaceindex.html:113 generateindex.html:98 onclick

Original issue reported on code.google.com by osta...@gmail.com on 8 Mar 2015 at 12:38

GoogleCodeExporter commented 8 years ago
Good catch.  Fixed.  Thanks.

Original comment by neil.fra...@gmail.com on 9 Mar 2015 at 2:19