Ameba::AST::Assignment - ameba 1.6.4-1-dev

# class Ameba::AST::Assignment

- Ameba::AST::Assignment
- Reference
- Object

##
Overview

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

##
Defined in:

ameba/ast/variabling/assignment.cr

##
Constructors

- .new(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)

  Creates a new assignment.

##
Instance Method Summary

- #branch : Branch | Nil

  Branch of this assignment.

- #end_location(*args, **options)
- #end_location(*args, **options, &)
- #in_branch?

  Returns `true` if this assignment is in a branch, `false` if not.

- #location(*args, **options)
- #location(*args, **options, &)
- #node : Crystal::ASTNode

  The actual assignment node.

- #op_assign?

  Returns `true` if this assignment is an op assign, `false` if not.

- #referenced=(referenced : Bool)
- #referenced? : Bool
- #referenced_in_loop?
- #scope : Scope

  A scope assignment belongs to

- #target_node

  Returns the target node of the variable in this assignment.

- #to_s(*args, **options)
- #to_s(*args, **options, &)
- #variable : Variable

  Variable of this assignment.

##
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)

##
Instance Method Detail

def branch : Branch | Nil #

Branch of this assignment.

def end_location(*args, **options) #
def end_location(*args, **options, &) #
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?

def location(*args, **options) #
def location(*args, **options, &) #
def node : Crystal::ASTNode #

The actual assignment node.

def op_assign? #

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

    a ||= 1

def referenced=(referenced : Bool) #
def referenced? : Bool #
def referenced_in_loop? #
def scope : Scope #

A scope assignment belongs to

def target_node #

Returns the target node of the variable in this assignment.

def to_s(*args, **options) #
def to_s(*args, **options, &) #
def variable : Variable #

Variable of this assignment.