Skip to content

Commit 1f5dcfe

Browse files
committed
Address review comment about including instance_within in comments and error messages.
1 parent 54ac8e1 commit 1f5dcfe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/blocks/mrc_call_python_function.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export type FunctionArg = {
4848

4949
type CallPythonFunctionBlock = Blockly.Block & CallPythonFunctionMixin;
5050
interface CallPythonFunctionMixin extends CallPythonFunctionMixinType {
51-
mrcFunctionKind: string, // module, static, constructor, or instance
51+
mrcFunctionKind: string, // module, static, constructor, instance, or instance_within.
5252
mrcReturnType: string,
5353
mrcArgs: FunctionArg[],
5454
mrcTooltip: string,
@@ -61,7 +61,7 @@ type CallPythonFunctionMixinType = typeof CALL_PYTHON_FUNCTION;
6161
/** Extra state for serialising call_python_* blocks. */
6262
type CallPythonFunctionExtraState = {
6363
/**
64-
* The kind of function: module, static, constructor, or instance.
64+
* The kind of function: module, static, constructor, instance, or instance_within.
6565
*/
6666
functionKind: string,
6767
/**
@@ -134,7 +134,7 @@ const CALL_PYTHON_FUNCTION = {
134134
break;
135135
}
136136
default:
137-
throw new Error('mrcVarKind must be "module", "static", "constructor", or "instance".')
137+
throw new Error('mrcVarKind must be "module", "static", "constructor", "instance", or "instance_within".')
138138
}
139139
const funcTooltip = this.mrcTooltip;
140140
if (funcTooltip) {
@@ -250,7 +250,7 @@ const CALL_PYTHON_FUNCTION = {
250250
.appendField(createFieldNonEditableText(''), pythonUtils.FIELD_FUNCTION_NAME);
251251
break;
252252
default:
253-
throw new Error('mrcVarKind must be "module", "static", "constructor", or "instance".')
253+
throw new Error('mrcVarKind must be "module", "static", "constructor", "instance", or "instance_within".')
254254
}
255255
// Add input sockets for the arguments.
256256
for (let i = 0; i < this.mrcArgs.length; i++) {
@@ -320,6 +320,8 @@ export const pythonFromBlock = function(
320320
code = 'self.' + functionName;
321321
break;
322322
}
323+
default:
324+
throw new Error('mrcVarKind must be "module", "static", "constructor", "instance", or "instance_within".')
323325
}
324326
code += '(' + generateCodeForArguments(callPythonFunctionBlock, generator, argStartIndex) + ')';
325327
if (block.outputConnection) {

0 commit comments

Comments
 (0)