Skip to content

class Crystal::Normalizer
inherits Crystal::Transformer

Class methods

.new(program)

View source

Methods

#after_transform(node)

View source

#before_transform(node)

View source

#comparison?(name)

View source

#current_def : Def?

The current method where we are normalizing. This is used to expand argless super and previous_def to their version with arguments copied from the current method.

View source

#current_def=(current_def : Def?)

The current method where we are normalizing. This is used to expand argless super and previous_def to their version with arguments copied from the current method.

View source

#program : Program

View source

#transform(node : StringInterpolation)

View source

#transform(node : OpAssign)

Convert a += b to a = a + b

View source

#transform(node : Assign)

Checks if the right hand side is dead code

View source

#transform(node : Until)

Convert until to while:

From:

until foo bar end

To:

while !foo bar end

View source

#transform(node : Unless)

Convert unless to if:

From:

unless foo
  bar
else
  baz
end

To:

if foo
  baz
else
  bar
end
View source

#transform(node : If)

View source

#transform(node : Macro)

View source

#transform(node : Def)

View source

#transform(node : Call)

View source

#transform(node : Expressions)

View source

#transform_op_assign_call(node, target)

View source

#transform_op_assign_index(node, target)

View source

#transform_op_assign_simple(node, target)

View source