Class: NSBDNode

Inherits:
BDNode show all
Defined in:
lib/tecsgen/core/syntaxobj.rb

Overview

Namespace 名を持つ BDNode

Namespace(Region), Signature, Celltype, CompositeCelltype, Cell

Direct Known Subclasses

Cell, Celltype, CompositeCelltype, Namespace, Signature

Instance Method Summary collapse

Methods inherited from BDNode

#get_owner, #set_owner

Methods inherited from Node

#cdl_error, #cdl_error2, #cdl_error3, #cdl_info, #cdl_info2, #cdl_warning, #cdl_warning2, #get_locale, #locale_str, #set_locale

Constructor Details

#initializeNSBDNode

Returns a new instance of NSBDNode.



171
172
173
# File 'lib/tecsgen/core/syntaxobj.rb', line 171

def initialize
  super
end

Instance Method Details

#get_namespaceObject

属する namespace を得る

owner を namespace にたどり着くまで上にたどる



177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/tecsgen/core/syntaxobj.rb', line 177

def get_namespace
  if @owner.is_a? Namespace
    return @owner
  elsif !@owner.nil?
    return @owner.get_namespace
  else
    # @owner == nil なら "::"
    if @name != "::"
      raise "non-root namespace has no owner #{self.class.name}##{@name} #{self}"
    end
    return nil
  end
end

#get_namespace_pathObject

NamespacePath を得る



201
202
203
# File 'lib/tecsgen/core/syntaxobj.rb', line 201

def get_namespace_path
  return @NamespacePath
end

#is_imported?Boolean

Returns:

  • (Boolean)


205
206
207
208
209
210
211
# File 'lib/tecsgen/core/syntaxobj.rb', line 205

def is_imported?
  if @import
    return @import.is_imported?
  else
    return false # mikan: 仮 @import が nil になるケースが追求できていない
  end
end

#set_namespace_pathObject



191
192
193
194
195
196
197
198
# File 'lib/tecsgen/core/syntaxobj.rb', line 191

def set_namespace_path
  ns = get_namespace
  if ns
    @NamespacePath = ns.get_namespace_path.append(get_name)
  else
    raise "get_namespace_path: no namespace found"
  end
end