Class: Estreet::ThrowStatement

Inherits:
Statement show all
Defined in:
lib/estreet/exceptions.rb

Instance Attribute Summary

Attributes inherited from Node

#source_location

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Statement

#<<, #to_statement

Methods inherited from Node

#as_json, #loc, #type

Constructor Details

#initialize(argument) ⇒ ThrowStatement

Returns a new instance of ThrowStatement.



3
4
5
# File 'lib/estreet/exceptions.rb', line 3

def initialize(argument)
  @argument = argument.to_expression
end

Class Method Details

.error(expression) ⇒ Object



11
12
13
# File 'lib/estreet/exceptions.rb', line 11

def self.error(expression)
  new(NewExpression.new(Identifier['Error'], [expression.to_expression]))
end

Instance Method Details

#attributesObject



7
8
9
# File 'lib/estreet/exceptions.rb', line 7

def attributes
  super.merge(argument: @argument)
end