Class: TRuby::IR::Passes::TypeAnnotationCleanup
- Defined in:
- lib/t_ruby/ir.rb
Overview
Type annotation cleanup
Instance Attribute Summary
Attributes inherited from Pass
Instance Method Summary collapse
-
#initialize ⇒ TypeAnnotationCleanup
constructor
A new instance of TypeAnnotationCleanup.
- #transform(node) ⇒ Object
Methods inherited from Pass
Constructor Details
#initialize ⇒ TypeAnnotationCleanup
Returns a new instance of TypeAnnotationCleanup.
1238 1239 1240 |
# File 'lib/t_ruby/ir.rb', line 1238 def initialize super("type_annotation_cleanup") end |
Instance Method Details
#transform(node) ⇒ Object
1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 |
# File 'lib/t_ruby/ir.rb', line 1242 def transform(node) case node when Program node.declarations.each { |d| transform(d) } when MethodDef # Remove redundant type annotations node.params.each do |param| if param.type_annotation && redundant_annotation?(param) param.type_annotation = nil @changes_made += 1 end end end node end |