Class: RKelly::Nodes::VarDeclNode

Inherits:
Node
  • Object
show all
Defined in:
lib/rkelly/nodes/var_decl_node.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#comments, #filename, #line, #value

Instance Method Summary collapse

Methods inherited from Node

#==, #===, #each, #pointcut, #to_dots, #to_ecma, #to_real_sexp, #to_sexp

Methods included from Visitable

#accept

Constructor Details

#initialize(name, value, constant = false) ⇒ VarDeclNode

Returns a new instance of VarDeclNode.



5
6
7
8
9
# File 'lib/rkelly/nodes/var_decl_node.rb', line 5

def initialize(name, value, constant = false)
  super(value)
  @name = name
  @constant = constant
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/rkelly/nodes/var_decl_node.rb', line 4

def name
  @name
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/rkelly/nodes/var_decl_node.rb', line 4

def type
  @type
end

Instance Method Details

#constant?Boolean

Returns:

  • (Boolean)


11
# File 'lib/rkelly/nodes/var_decl_node.rb', line 11

def constant?; @constant; end

#variable?Boolean

Returns:

  • (Boolean)


12
# File 'lib/rkelly/nodes/var_decl_node.rb', line 12

def variable?; !@constant; end