forBlock['identifier'] = function (block) {
return block.getFieldValue('name');
};
It appears that you are returning the user-entered value as if it were code, and the function that called your block generator function is duly indenting that code to match the surrounding code.
This is almost certainly not what you want; at the very least you should be ensuring that the value returned is a valid identifier—otherwise this field can be used by the user to
enter arbitrary code to be evaluated, which is almost certainly not what you want.
Can you tell us a bit more about what the intense use of the identifier block is? Normally I would expect that the identifier would be a part of a larger block that does something with the identifier—something more akin to the variables_get and variables_set blocks, for example.
The only reason why one would want to have an identifier block on its own that can immediately think of is if one was generating code for a highly dynamic language (e.g. Common Lisp) in which identifiers are first-class values (i.e., you can have a variable whose value is itself another variable).
Best wishes,
Christopher