Module: Rubber::RegisterChildren

Included in:
C_Array, C_Class, C_Enum, C_Flags, C_Float, C_GCRefPool, C_GEnum, C_GFlags, C_Integer, C_Module, C_String, C_Struct
Defined in:
lib/rubber/codegen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#child_namesObject (readonly)

Returns the value of attribute child_names


86
87
88
# File 'lib/rubber/codegen.rb', line 86

def child_names
  @child_names
end

#source_fileObject

Returns the value of attribute source_file


85
86
87
# File 'lib/rubber/codegen.rb', line 85

def source_file
  @source_file
end

#source_lineObject

Returns the value of attribute source_line


85
86
87
# File 'lib/rubber/codegen.rb', line 85

def source_line
  @source_line
end

Instance Method Details

#cnameObject


101
102
103
104
105
106
107
# File 'lib/rubber/codegen.rb', line 101

def cname
	if parent && parent.child_names && parent.child_names[name] && parent.child_names[name] != self
		parent.child_names[name].cname 
	else
		default_cname()
	end
end

#register_children(io) ⇒ Object


87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/rubber/codegen.rb', line 87

def register_children(io)
    @child_names = {}
    contents.each { |f| 
   		f.register(io, @child_names.has_key?(f.name)) 
	if @child_names.has_key?(f.name)
		puts "#{self.cname} has duplicate definitiion of #{f.name}"
	else
   		@child_names[f.name]= f 
	end
    }
    if respond_to?(:register_aliases)
    	register_aliases(io)
    end
end