Пример #1
0
def check_command_parameter(ctxt: IDLCompatibilityContext,
                            old_param: syntax.Field, new_param: syntax.Field,
                            cmd_name: str, old_idl_file: syntax.IDLParsedSpec,
                            new_idl_file: syntax.IDLParsedSpec,
                            old_idl_file_path: str, new_idl_file_path: str):
    """Check compatibility between the old and new command parameter."""
    # pylint: disable=too-many-arguments
    if not old_param.unstable and new_param.unstable:
        ctxt.add_command_parameter_unstable_error(cmd_name, old_param.name,
                                                  old_idl_file_path)
    if old_param.unstable and not new_param.optional and not new_param.unstable:
        ctxt.add_command_parameter_stable_required_error(
            cmd_name, old_param.name, old_idl_file_path)
    if old_param.optional and not new_param.optional:
        ctxt.add_command_parameter_required_error(cmd_name, old_param.name,
                                                  old_idl_file_path)

    check_param_or_type_validator(ctxt,
                                  old_param,
                                  new_param,
                                  cmd_name,
                                  new_idl_file_path,
                                  type_name=None,
                                  is_command_parameter=True)

    old_parameter_type = get_field_type(old_param, old_idl_file,
                                        old_idl_file_path)
    new_parameter_type = get_field_type(new_param, new_idl_file,
                                        new_idl_file_path)

    check_command_parameter_type(ctxt, old_parameter_type, new_parameter_type,
                                 cmd_name, old_param.name, old_idl_file_path,
                                 new_idl_file_path)
Пример #2
0
def check_command_parameter(ctxt: IDLCompatibilityContext, old_param: syntax.Field,
                            new_param: syntax.Field, cmd_name: str, old_idl_file_path: str):
    """Check compatibility between the old and new command parameter."""
    if not old_param.unstable and new_param.unstable:
        ctxt.add_command_parameter_unstable_error(cmd_name, old_param.name, old_idl_file_path)
    if old_param.unstable and not new_param.optional and not new_param.unstable:
        ctxt.add_command_parameter_stable_required_error(cmd_name, old_param.name,
                                                         old_idl_file_path)
    if old_param.optional and not new_param.optional:
        ctxt.add_command_parameter_required_error(cmd_name, old_param.name, old_idl_file_path)