<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _compile_ast_node_to_ir(schema, current_schema_type, ast, location, context):
 """Compile the given GraphQL AST node into a list of basic blocks. Args: schema: GraphQL schema object, obtained from the graphql library current_schema_type: GraphQLType, the schema type at the current location ast: the current GraphQL AST node, obtained from the graphql library location: Location object representing the current location in the query context: dict, various per-compilation data (e.g. declared tags, whether the current block is optional, etc.). May be mutated in-place in this function! Returns: list of basic blocks corresponding to this GraphQL AST node """

    basic_blocks = []

    # step 0: preprocessing
    local_unique_directives = get_unique_directives(ast)
    fields = _get_fields(ast)
    vertex_fields, property_fields = fields
    fragment = _get_inline_fragment(ast)
    filter_operations = get_local_filter_directives(
        ast, current_schema_type, vertex_fields)

    # We don't support type coercion while at the same time selecting fields.
    # Either there are no fields, or there is no fragment, otherwise we raise a compilation error.
    fragment_exists = fragment is not None
    fields_exist = vertex_fields or property_fields
    if fragment_exists and fields_exist:
        raise GraphQLCompilationError(u'Cannot compile GraphQL that has inline fragment and '
                                      u'selected fields in the same selection. Please move the '
                                      u'selected fields inside the inline fragment.')

    if location.field is not None:  # we're at a property field
        # sanity-check: cannot have an inline fragment at a property field
        if fragment_exists:
            raise AssertionError(u'Found inline fragment at a property field: '
                                 u'{} {}'.format(location, fragment))

        # sanity-check: locations at properties don't have their own property locations
        if len(property_fields) > 0:
            raise AssertionError(u'Found property fields on a property field: '
                                 u'{} {}'.format(location, property_fields))

    # step 1: apply local filter, if any
    for filter_operation_info in filter_operations:
        filter_block = process_filter_directive(filter_operation_info, location, context)
        if isinstance(location, FoldScopeLocation) and location.field == COUNT_META_FIELD_NAME:
            # Filtering on the fold count field is only allowed at the innermost scope of a fold.
            set_fold_innermost_scope(context)

            # This Filter is going in the global operations section of the query, so it cannot
            # use LocalField expressions since there is no "local" location to use.
            # Rewrite it so that all references of data at a location instead use ContextFields.
            expected_field = expressions.LocalField(COUNT_META_FIELD_NAME)
            replacement_field = expressions.FoldedContextField(location, GraphQLInt)

            visitor_fn = expressions.make_replacement_visitor(expected_field, replacement_field)
            filter_block = filter_block.visit_and_update_expressions(visitor_fn)

            visitor_fn = expressions.make_type_replacement_visitor(
                expressions.ContextField,
                lambda context_field: expressions.GlobalContextField(
                    context_field.location, context_field.field_type))
            filter_block = filter_block.visit_and_update_expressions(visitor_fn)

            set_fold_count_filter(context)
            context['global_filters'].append(filter_block)
        else:
            basic_blocks.append(filter_block)

    if location.field is not None:
        # The location is at a property, compile the property data following P-steps.
        _compile_property_ast(schema, current_schema_type, ast,
                              location, context, local_unique_directives)
    else:
        # The location is at a vertex.
        if fragment_exists:
            # Compile the fragment data following F-steps.
            # N.B.: Note that the "fragment" variable is the fragment's AST. Since we've asserted
            #       that the fragment is the only part of the selection set at the current AST node,
            #       we pass the "fragment" in the AST parameter of the _compile_fragment_ast()
            #       function, rather than the current AST node as in the other compilation steps.
            basic_blocks.extend(
                _compile_fragment_ast(schema, current_schema_type, fragment, location, context))
        else:
            # Compile the vertex data following V-steps.
            basic_blocks.extend(
                _compile_vertex_ast(schema, current_schema_type, ast,
                                    location, context, local_unique_directives, fields))

    return basic_blocks