Skip to content

Commit 0e4ec4e

Browse files
committed
Remove dead code
1 parent 2d66534 commit 0e4ec4e

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

lib/parser.rb

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def node_to_type(node, path)
3535
end
3636
end
3737

38-
# Abstract global DF type.
38+
# Abstract node, named type or object reference.
3939
class Type
4040
attr_reader :node
4141

@@ -46,15 +46,11 @@ def initialize(node, path = [])
4646
@name = node['name'] || node['type-name']
4747
@comment = node['comment']
4848
@path = path.dup
49-
@local_name = ''
5049

5150
if node['ld:level'] == '0' && !@path.include?('global')
5251
@path.append(@name)
53-
@local_name = @name
5452
elsif @name
5553
@path.append("T_#{@name}")
56-
@local_name = @path.join('_').gsub('T_', '')
57-
# @name = @path.join('.').gsub('.T_', '_')
5854
end
5955

6056
@class_name = @path.join('.')
@@ -65,7 +61,6 @@ class EnumType < Type
6561
def initialize(node, path = [])
6662
super(node, path)
6763

68-
@class_name = @path.join('.')
6964
@attributes = node.xpath('enum-attr')
7065
@items = items
7166
end
@@ -217,7 +212,6 @@ class BitfieldType < Type
217212
def initialize(node, path = [])
218213
super(node, path)
219214

220-
@class_name = @path.join('.')
221215
@items = items
222216
end
223217

@@ -326,7 +320,6 @@ class StructType < Type
326320
def initialize(node, path = [])
327321
super(node, path)
328322

329-
@class_name = @path.join('.')
330323
@class = node['inherits-from']
331324
@fields = fields
332325
@methods = methods
@@ -455,7 +448,6 @@ class GlobalObject < Type
455448
def initialize(node, path = [])
456449
super(node, path)
457450

458-
@path = @path.slice(0..-1)
459451
@child = child
460452
@type = @child.type
461453
end
@@ -633,8 +625,8 @@ def initialize(node, path = [])
633625
super(node, path)
634626

635627
@name = node['name']
636-
@path = @path.slice(...-1)
637-
@class_name = @path.join('.')
628+
# The name of the function is appended, we need to remove it.
629+
@class_name = @path.slice(...-1).join('.')
638630
@return_type = return_type
639631
end
640632

@@ -672,10 +664,6 @@ def initialize(field, path = [])
672664
@comment = comment
673665

674666
@type = 'DFPointer<integer>' if @type == 'any' && node['ld:meta'] == 'pointer'
675-
676-
return unless field.name == 'item'
677-
678-
@name = path[0]
679667
end
680668

681669
def to_field

0 commit comments

Comments
 (0)