class Crystal::MacroInterpreter

Defined in:

compiler/crystal/macros/interpreter.cr
compiler/crystal/macros/methods.cr

Constructors

Instance Method Summary

Instance methods inherited from class Crystal::Visitor

accept(node) accept, end_visit(node) end_visit, end_visit_any(node) end_visit_any, visit_any(node) visit_any

Instance methods inherited from class Reference

==(other : self)
==(other : JSON::Any)
==(other : YAML::Any)
==(other)
==
, dup dup, hash(hasher) hash, initialize initialize, inspect(io : IO) : Nil inspect, object_id : UInt64 object_id, pretty_print(pp) : Nil pretty_print, same?(other : Reference) : Bool
same?(other : Nil)
same?
, to_s(io : IO) : Nil to_s

Constructor methods inherited from class Reference

new new, unsafe_construct(address : Pointer, *args, **opts) : self unsafe_construct

Class methods inherited from class Reference

pre_initialize(address : Pointer) pre_initialize

Instance methods inherited from class Object

! : Bool !, !=(other) !=, !~(other) !~, ==(other) ==, ===(other : JSON::Any)
===(other : YAML::Any)
===(other)
===
, =~(other) =~, as(type : Class) as, as?(type : Class) as?, class class, dup dup, hash(hasher)
hash
hash
, in?(collection : Object) : Bool
in?(*values : Object) : Bool
in?
, inspect(io : IO) : Nil
inspect : String
inspect
, is_a?(type : Class) : Bool is_a?, itself itself, nil? : Bool nil?, not_nil!(message)
not_nil!
not_nil!
, pretty_inspect(width = 79, newline = "\n", indent = 0) : String pretty_inspect, pretty_print(pp : PrettyPrint) : Nil pretty_print, responds_to?(name : Symbol) : Bool responds_to?, tap(&) tap, to_json(io : IO) : Nil
to_json : String
to_json
, to_pretty_json(indent : String = " ") : String
to_pretty_json(io : IO, indent : String = " ") : Nil
to_pretty_json
, to_s(io : IO) : Nil
to_s : String
to_s
, to_yaml(io : IO) : Nil
to_yaml : String
to_yaml
, try(&) try, unsafe_as(type : T.class) forall T unsafe_as

Class methods inherited from class Object

from_json(string_or_io : String | IO, root : String)
from_json(string_or_io : String | IO)
from_json
, from_yaml(string_or_io : String | IO) from_yaml

Macros inherited from class Object

class_getter(*names, &block) class_getter, class_getter!(*names) class_getter!, class_getter?(*names, &block) class_getter?, class_property(*names, &block) class_property, class_property!(*names) class_property!, class_property?(*names, &block) class_property?, class_setter(*names) class_setter, def_clone def_clone, def_equals(*fields) def_equals, def_equals_and_hash(*fields) def_equals_and_hash, def_hash(*fields) def_hash, delegate(*methods, to object) delegate, forward_missing_to(delegate) forward_missing_to, getter(*names, &block) getter, getter!(*names) getter!, getter?(*names, &block) getter?, property(*names, &block) property, property!(*names) property!, property?(*names, &block) property?, setter(*names) setter

Constructor Detail

def self.new(program, scope : Type, path_lookup : Type, a_macro : Macro, call, a_def : Def | Nil = nil, in_macro = false) #

[View source]
def self.new(program : Program, scope : Type, path_lookup : Type, location : Location | Nil, vars : Hash(String, Crystal::ASTNode) = {} of String => ASTNode, block : Block | Nil = nil, def __arg3 : Def | Nil = nil, in_macro : Bool = false, call : Call | Nil = nil) #

[View source]

Instance Method Detail

def accept(node) #

[View source]
def define_var(name : String, value : ASTNode) : Nil #

[View source]
def free_vars : Hash(String, TypeVar) | Nil #

[View source]
def free_vars=(free_vars : Hash(String, TypeVar) | Nil) #

[View source]
def interpret_compare_versions(node) #

[View source]
def interpret_debug(node) #

[View source]
def interpret_env(node) #

[View source]
def interpret_file_exists?(node) #

[View source]
def interpret_flag?(node) #

[View source]
def interpret_p(node) #

[View source]
def interpret_parse_type(node) #

[View source]
def interpret_pp!(node) #

[View source]
def interpret_print(node) #

[View source]
def interpret_puts(node) #

[View source]
def interpret_raise(node) #

[View source]
def interpret_read_file(node, nilable = false) #

[View source]
def interpret_run(node) #

[View source]
def interpret_skip_file(node) #

[View source]
def interpret_system(node) #

[View source]
def interpret_top_level_call(node) #

[View source]
def interpret_top_level_call?(node) #

[View source]
def interpret_warning(node) #

[View source]
def interpreted_hook(node : ASTNode, *, location custom_location : Location | Nil = nil) : ASTNode #

Calls the program's interpreted_node_hook hook with the macro ASTNode that was interpreted.


[View source]
def last : ASTNode #

[View source]
def macro_expansion_pragmas : Hash(Int32, Array(Lexer::LocPragma)) | Nil #

[View source]
def macro_expansion_pragmas=(macro_expansion_pragmas : Hash(Int32, Array(Lexer::LocPragma)) | Nil) #

[View source]
def not_interpreted_hook(node : ASTNode, use_significant_node : Bool = false, *, location custom_location : Location | Nil = nil) : ASTNode #

Calls the program's interpreted_node_hook hook with the macro ASTNode that was not interpreted.


[View source]
def replace_block_vars(body, vars) #

[View source]
def resolve(node : Path) #

[View source]
def resolve(node : Generic | Metaclass | ProcNotation) #

[View source]
def resolve(node : Union) #

[View source]
def resolve(node : ASTNode | Nil) #

[View source]
def resolve?(node : Path) #

[View source]
def resolve?(node : Generic | Metaclass | ProcNotation) #

[View source]
def resolve?(node : Union) #

[View source]
def resolve?(node : ASTNode) #

[View source]
def to_s : String #
Description copied from class Object

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.


[View source]
def visit(node : Expressions) #

[View source]
def visit(node : MacroExpression) #

[View source]
def visit(node : MacroLiteral) #

[View source]
def visit(node : MacroVerbatim) #

[View source]
def visit(node : Var) #

[View source]
def visit(node : StringInterpolation) #

[View source]
def visit(node : MacroIf) #

[View source]
def visit(node : MacroFor) #

[View source]
def visit(node : MacroVar) #

[View source]
def visit(node : Assign) #

[View source]
def visit(node : OpAssign) #

[View source]
def visit(node : MultiAssign) #

[View source]
def visit(node : And) #

[View source]
def visit(node : Or) #

[View source]
def visit(node : Not) #

[View source]
def visit(node : If) #

[View source]
def visit(node : Unless) #

[View source]
def visit(node : Call) #

[View source]
def visit(node : Yield) #

[View source]
def visit(node : Path) #

[View source]
def visit(node : Generic) #

[View source]
def visit(node : SizeOf) #

[View source]
def visit(node : AlignOf) #

[View source]
def visit(node : Splat) #

[View source]
def visit(node : DoubleSplat) #

[View source]
def visit(node : IsA) #

[View source]
def visit(node : InstanceVar) #

[View source]
def visit(node : TupleLiteral) #

[View source]
def visit(node : ArrayLiteral) #

[View source]
def visit(node : HashLiteral) #

[View source]
def visit(node : NamedTupleLiteral) #

[View source]

[View source]
def visit(node : ASTNode) #

[View source]
def visit_macro_for_array_like(node, exp) #

[View source]
def visit_macro_for_array_like(node, exp, entries, &) #

[View source]
def visit_macro_for_hash_like(node, exp, entries, &) #

[View source]
def warnings(*args, **options) #

[View source]
def warnings(*args, **options, &) #

[View source]