class Bindgen::Processor::BlockOverloads
- Bindgen::Processor::BlockOverloads
- Bindgen::Processor::Base
- Reference
- Object
Overview
Generates overloads for methods that accept a single block argument. Those methods are ambiguous because Crystal does not permit overloading through different type restrictions on the block; this processor rectifies this by requiring each overload to also specify the types of the block parameters. For example, the following code
def f(& : Int32 ->)
end
def f(& : Bool ->)
end
def f(& : Int32, Bool ->)
end
is transformed into
def f(_type1_ : Int32.class, & : Int32 ->)
end
def f(_type1_ : Bool.class, & : Bool ->)
end
def f(_type1_ : Int32.class, _type2_ : Bool.class, & : Int32, Bool ->)
end
Unambiguous methods that accept block arguments are unaffected.
Defined in:
bindgen/processor/block_overloads.crConstant Summary
-
PLATFORM =
Graph::Platform::Crystal
Class Method Summary
-
.logger
Generates overloads for methods that accept a single block argument.
Instance Method Summary
-
#logger
Generates overloads for methods that accept a single block argument.
-
#visit_class(klass)
Visits a
Graph::Class
. -
#visit_platform_specific(specific)
Visits a
Graph::PlatformSpecific
.
Instance methods inherited from class Bindgen::Processor::Base
process(graph : Graph::Container, doc : Parser::Document)
process
Constructor methods inherited from class Bindgen::Processor::Base
new(config : Configuration, db : TypeDatabase)
new
Instance methods inherited from module Bindgen::Graph::Visitor
visit_alias(alias_name)
visit_alias,
visit_children(container : Container)
visit_children,
visit_class(klass)
visit_class,
visit_constant(constant)
visit_constant,
visit_enum(enumeration)
visit_enum,
visit_library(library)
visit_library,
visit_method(method)
visit_method,
visit_namespace(ns)
visit_namespace,
visit_node(node : Node)
visit_node,
visit_node?(node : Node)
visit_node?,
visit_platform_specific(specific)
visit_platform_specific,
visit_struct(structure)
visit_struct,
visit_union(structure)
visit_union
Class Method Detail
Generates overloads for methods that accept a single block argument. Those methods are ambiguous because Crystal does not permit overloading through different type restrictions on the block; this processor rectifies this by requiring each overload to also specify the types of the block parameters. For example, the following code
def f(& : Int32 ->)
end
def f(& : Bool ->)
end
def f(& : Int32, Bool ->)
end
is transformed into
def f(_type1_ : Int32.class, & : Int32 ->)
end
def f(_type1_ : Bool.class, & : Bool ->)
end
def f(_type1_ : Int32.class, _type2_ : Bool.class, & : Int32, Bool ->)
end
Unambiguous methods that accept block arguments are unaffected.
Instance Method Detail
Generates overloads for methods that accept a single block argument. Those methods are ambiguous because Crystal does not permit overloading through different type restrictions on the block; this processor rectifies this by requiring each overload to also specify the types of the block parameters. For example, the following code
def f(& : Int32 ->)
end
def f(& : Bool ->)
end
def f(& : Int32, Bool ->)
end
is transformed into
def f(_type1_ : Int32.class, & : Int32 ->)
end
def f(_type1_ : Bool.class, & : Bool ->)
end
def f(_type1_ : Int32.class, _type2_ : Bool.class, & : Int32, Bool ->)
end
Unambiguous methods that accept block arguments are unaffected.
Visits a Graph::Class
. The default implementation calls
#visit_children
to visit all child nodes.
Visits a Graph::PlatformSpecific
.