Repository: godotengine/godot
File: servers/rendering/shader_language.cpp (C++)

Code before:
									break;
								}

								int min = builtin_func_const_args[constarg_idx].min;
								int max = builtin_func_const_args[constarg_idx].max;

								bool error = false;
								Vector<Scalar> values = _get_node_values(p_block, p_function_info, p_func->arguments[arg]);
								if (p_func->arguments[arg]->get_datatype() == TYPE_INT && !values.is_empty()) {
									if (values[0].sint < min || values[0].sint > max) {
										error = true;
									}
								} else {
									error = true;
								}

								if (error) {
									_set_error(vformat(RTR("Expected integer constant within [%d..%d] range."), min, max));
									return false;
								}
							}
							constarg_idx++;
						}
					}

					// Make sure its not an out argument used in the wrong way.
					int outarg_idx = 0;
					while (builtin_func_out_args[outarg_idx].name) {
						if (String(name) == builtin_func_out_args[outarg_idx].name) {
							for (int arg = 0; arg < BuiltinFuncOutArgs::MAX_ARGS; arg++) {
								int arg_idx = builtin_func_out_args[outarg_idx].arguments[arg];
								if (arg_idx == -1) {
									break;
								}
								if (arg_idx < argcount) {
									if (p_func->arguments[arg_idx + 1]->type != Node::NODE_TYPE_VARIABLE && p_func->arguments[arg_idx + 1]->type != Node::NODE_TYPE_MEMBER && p_func->arguments[arg_idx + 1]->type != Node::NODE_TYPE_ARRAY) {
										_set_error(vformat(RTR("Argument %d of function '%s' is not a variable, array, or member."), arg_idx + 1, String(name)));
										return false;
									}

									if (p_func->arguments[arg_idx + 1]->type == Node::NODE_TYPE_ARRAY) {
										ArrayNode *mn = static_cast<ArrayNode *>(p_func->arguments[arg_idx + 1]);
										if (mn->is_const) {
											fail = true;
										}
									} else if (p_func->arguments[arg_idx + 1]->type == Node::NODE_TYPE_MEMBER) {
										MemberNode *mn = static_cast<MemberNode *>(p_func->arguments[arg_idx + 1]);
										if (mn->basetype_const) {
											fail = true;
										}
									} else { // TYPE_VARIABLE

Review comment (bug):
```suggestion
					// Make sure it's not an out argument used in the wrong way.
```

Code after:
								}

								int min = builtin_func_const_args[constarg_idx].min;
								int max = builtin_func_const_args[constarg_idx].max;

								bool error = false;
								Vector<Scalar> values = _get_node_values(p_block, p_function_info, p_func->arguments[arg]);
								if (p_func->arguments[arg]->get_datatype() == TYPE_INT && !values.is_empty()) {
									if (values[0].sint < min || values[0].sint > max) {
										error = true;
									}
								} else {
									error = true;
								}

								if (error) {
									_set_error(vformat(RTR("Expected integer constant within [%d..%d] range."), min, max));
									return false;
								}
							}
							constarg_idx++;
						}
					}

					// Make sure it's not an out argument used in the wrong way.
					int outarg_idx = 0;
					while (builtin_func_out_args[outarg_idx].name) {
						if (String(name) == builtin_func_out_args[outarg_idx].name) {
							for (int arg = 0; arg < BuiltinFuncOutArgs::MAX_ARGS; arg++) {
								int arg_idx = builtin_func_out_args[outarg_idx].arguments[arg];
								if (arg_idx == -1) {
									break;
								}
								if (arg_idx < argcount) {
									if (p_func->arguments[arg_idx + 1]->type != Node::NODE_TYPE_VARIABLE && p_func->arguments[arg_idx + 1]->type != Node::NODE_TYPE_MEMBER && p_func->arguments[arg_idx + 1]->type != Node::NODE_TYPE_ARRAY) {
										_set_error(vformat(RTR("Argument %d of function '%s' is not a variable, array, or member."), arg_idx + 1, String(name)));
										return false;
									}

									if (p_func->arguments[arg_idx + 1]->type == Node::NODE_TYPE_ARRAY) {
										ArrayNode *mn = static_cast<ArrayNode *>(p_func->arguments[arg_idx + 1]);
										if (mn->is_const) {
											fail = true;
										}
									} else if (p_func->arguments[arg_idx + 1]->type == Node::NODE_TYPE_MEMBER) {
										MemberNode *mn = static_cast<MemberNode *>(p_func->arguments[arg_idx + 1]);
										if (mn->basetype_const) {
											fail = true;
										}
									} else { // TYPE_VARIABLE
										VariableNode *vn = static_cast<VariableNode *>(p_func->arguments[arg_idx + 1]);