class Ameba::AST::Assignment

Overview

Represents the assignment to the variable. Holds the assign node and the variable.

Defined in:

ameba/ast/variabling/assignment.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope) #

Creates a new assignment.

Assignment.new(node, variable, scope)

[View source]

Instance Method Detail

def branch : Branch | Nil #

Branch of this assignment.


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

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

[View source]
def in_branch? #

Returns true if this assignment is in a branch, false if not. For example, this assignment is in a branch:

a = 1 if a.nil?

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

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

[View source]
def node : Crystal::ASTNode #

The actual assignment node.


[View source]
def op_assign? #

Returns true if this assignment is an op assign, false if not. For example, this is an op assign:

a ||= 1

[View source]
def referenced=(referenced : Bool) #

[View source]
def referenced? : Bool #

[View source]
def referenced_in_loop? #

[View source]
def scope : Scope #

A scope assignment belongs to


[View source]
def target_node #

Returns the target node of the variable in this assignment.


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

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

[View source]
def transformed? #

Indicates whether the node is a transformed assignment by the compiler. i.e.

collection.each do |(a, b)|
  puts b
end

is transformed to:

collection.each do |__arg0|
  a = __arg0[0]
  b = __arg0[1]
  puts(b)
end

[View source]
def variable : Variable #

Variable of this assignment.


[View source]