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
1254 1255 1256 |
# File 'lib/t_ruby/ir.rb', line 1254 def initialize super("type_annotation_cleanup") end |
Instance Method Details
#transform(node) ⇒ Object
1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 |
# File 'lib/t_ruby/ir.rb', line 1258 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 |