From 4ba182a822dcf2e14eb38dffebd5aab3e2a11795 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 16 Jan 2017 17:24:32 +0200 Subject: [PATCH] rename compilers to passses --- .../{compilers => passes}/locals_collector.rb | 2 +- .../{compilers => passes}/method_collector.rb | 2 +- .../{compilers => passes}/method_compiler.rb | 2 +- lib/melon/{compilers => passes}/normalizer.rb | 2 +- .../{compilers => passes}/total_processor.rb | 2 +- .../{compilers => passes}/type_collector.rb | 2 +- lib/melon/ruby_compiler.rb | 22 +++++++++---------- test/melon/{compilers => passes}/helper.rb | 0 test/melon/{compilers => passes}/test_all.rb | 0 .../test_locals_collector.rb | 2 +- .../test_method_collector.rb | 2 +- .../{compilers => passes}/test_normalizer.rb | 2 +- .../test_type_collector.rb | 2 +- test/melon/test_all.rb | 2 +- 14 files changed, 22 insertions(+), 22 deletions(-) rename lib/melon/{compilers => passes}/locals_collector.rb (95%) rename lib/melon/{compilers => passes}/method_collector.rb (97%) rename lib/melon/{compilers => passes}/method_compiler.rb (98%) rename lib/melon/{compilers => passes}/normalizer.rb (87%) rename lib/melon/{compilers => passes}/total_processor.rb (91%) rename lib/melon/{compilers => passes}/type_collector.rb (96%) rename test/melon/{compilers => passes}/helper.rb (100%) rename test/melon/{compilers => passes}/test_all.rb (100%) rename test/melon/{compilers => passes}/test_locals_collector.rb (97%) rename test/melon/{compilers => passes}/test_method_collector.rb (98%) rename test/melon/{compilers => passes}/test_normalizer.rb (92%) rename test/melon/{compilers => passes}/test_type_collector.rb (98%) diff --git a/lib/melon/compilers/locals_collector.rb b/lib/melon/passes/locals_collector.rb similarity index 95% rename from lib/melon/compilers/locals_collector.rb rename to lib/melon/passes/locals_collector.rb index 575a479a..3f76b810 100644 --- a/lib/melon/compilers/locals_collector.rb +++ b/lib/melon/passes/locals_collector.rb @@ -1,5 +1,5 @@ module Melon - module Compilers + module Passes class LocalsCollector < TotalProcessor def initialize diff --git a/lib/melon/compilers/method_collector.rb b/lib/melon/passes/method_collector.rb similarity index 97% rename from lib/melon/compilers/method_collector.rb rename to lib/melon/passes/method_collector.rb index 1b5e90b7..7b3644c3 100644 --- a/lib/melon/compilers/method_collector.rb +++ b/lib/melon/passes/method_collector.rb @@ -1,5 +1,5 @@ module Melon - module Compilers + module Passes class MethodCollector < TotalProcessor diff --git a/lib/melon/compilers/method_compiler.rb b/lib/melon/passes/method_compiler.rb similarity index 98% rename from lib/melon/compilers/method_compiler.rb rename to lib/melon/passes/method_compiler.rb index 8c4b26ec..3fbb20a5 100644 --- a/lib/melon/compilers/method_compiler.rb +++ b/lib/melon/passes/method_compiler.rb @@ -1,5 +1,5 @@ module Melon - module Compilers + module Passes class MethodCompiler < AST::Processor diff --git a/lib/melon/compilers/normalizer.rb b/lib/melon/passes/normalizer.rb similarity index 87% rename from lib/melon/compilers/normalizer.rb rename to lib/melon/passes/normalizer.rb index 8647c570..0b45d42c 100644 --- a/lib/melon/compilers/normalizer.rb +++ b/lib/melon/passes/normalizer.rb @@ -1,5 +1,5 @@ module Melon - module Compilers + module Passes class Normalizer < AST::Processor diff --git a/lib/melon/compilers/total_processor.rb b/lib/melon/passes/total_processor.rb similarity index 91% rename from lib/melon/compilers/total_processor.rb rename to lib/melon/passes/total_processor.rb index a91c503e..ff5a0f40 100644 --- a/lib/melon/compilers/total_processor.rb +++ b/lib/melon/passes/total_processor.rb @@ -1,6 +1,6 @@ module Melon - module Compilers + module Passes class TotalProcessor < AST::Processor def handler_missing(node) diff --git a/lib/melon/compilers/type_collector.rb b/lib/melon/passes/type_collector.rb similarity index 96% rename from lib/melon/compilers/type_collector.rb rename to lib/melon/passes/type_collector.rb index 2ff47654..670aa7d5 100644 --- a/lib/melon/compilers/type_collector.rb +++ b/lib/melon/passes/type_collector.rb @@ -1,5 +1,5 @@ module Melon - module Compilers + module Passes class TypeCollector < TotalProcessor def initialize diff --git a/lib/melon/ruby_compiler.rb b/lib/melon/ruby_compiler.rb index ed7243a4..758c7e15 100644 --- a/lib/melon/ruby_compiler.rb +++ b/lib/melon/ruby_compiler.rb @@ -1,16 +1,16 @@ require "parser/ruby22" -require_relative "compilers/total_processor" -require_relative "compilers/type_collector" -require_relative "compilers/method_collector" -require_relative "compilers/method_compiler" -require_relative "compilers/locals_collector" -require_relative "compilers/normalizer" +require_relative "passes/total_processor" +require_relative "passes/type_collector" +require_relative "passes/method_collector" +require_relative "passes/method_compiler" +require_relative "passes/locals_collector" +require_relative "passes/normalizer" require_relative "ruby_method" module Melon - class RubyCompiler < Compilers::TotalProcessor + class RubyCompiler < Passes::TotalProcessor def self.compile( input ) ast = Parser::Ruby22.parse( input ) @@ -21,17 +21,17 @@ module Melon name , sup , body = *statement class_name = get_name(name) clazz = Parfait.object_space.get_class_by_name!(class_name , get_name(sup) ) - ivar_hash = Compilers::TypeCollector.new.collect(body) + ivar_hash = Passes::TypeCollector.new.collect(body) clazz.set_instance_type( Parfait::Type.for_hash( clazz , ivar_hash ) ) methods = create_methods(clazz , body) compile_methods(clazz,methods) end def create_methods(clazz , body) - methods = Compilers::MethodCollector.new.collect(body) + methods = Passes::MethodCollector.new.collect(body) methods.each do |method| clazz.add_method( method ) - normalizer = Compilers::Normalizer.new(method) + normalizer = Passes::Normalizer.new(method) method.normalize_source { |sourc| normalizer.process( sourc ) } end methods @@ -40,7 +40,7 @@ module Melon def compile_methods(clazz , methods) methods.each do |method| typed_method = method.create_vm_method(clazz.instance_type) - code = Compilers::MethodCompiler.new(method).get_code + code = Passes::MethodCompiler.new(method).get_code Vm::MethodCompiler.new( typed_method ).init_method.process( code) end end diff --git a/test/melon/compilers/helper.rb b/test/melon/passes/helper.rb similarity index 100% rename from test/melon/compilers/helper.rb rename to test/melon/passes/helper.rb diff --git a/test/melon/compilers/test_all.rb b/test/melon/passes/test_all.rb similarity index 100% rename from test/melon/compilers/test_all.rb rename to test/melon/passes/test_all.rb diff --git a/test/melon/compilers/test_locals_collector.rb b/test/melon/passes/test_locals_collector.rb similarity index 97% rename from test/melon/compilers/test_locals_collector.rb rename to test/melon/passes/test_locals_collector.rb index f081e254..8efbc1d3 100644 --- a/test/melon/compilers/test_locals_collector.rb +++ b/test/melon/passes/test_locals_collector.rb @@ -1,7 +1,7 @@ require_relative "helper" module Melon - module Compilers + module Passes class TestLocalsCollector < MiniTest::Test def setup diff --git a/test/melon/compilers/test_method_collector.rb b/test/melon/passes/test_method_collector.rb similarity index 98% rename from test/melon/compilers/test_method_collector.rb rename to test/melon/passes/test_method_collector.rb index c47db813..7a68204e 100644 --- a/test/melon/compilers/test_method_collector.rb +++ b/test/melon/passes/test_method_collector.rb @@ -1,7 +1,7 @@ require_relative "helper" module Melon - module Compilers + module Passes class TestMethodCollector < MiniTest::Test def setup diff --git a/test/melon/compilers/test_normalizer.rb b/test/melon/passes/test_normalizer.rb similarity index 92% rename from test/melon/compilers/test_normalizer.rb rename to test/melon/passes/test_normalizer.rb index e5cfaff2..246ee463 100644 --- a/test/melon/compilers/test_normalizer.rb +++ b/test/melon/passes/test_normalizer.rb @@ -1,7 +1,7 @@ require_relative "helper" module Melon - module Compilers + module Passes class TestNormalizer < MiniTest::Test def setup diff --git a/test/melon/compilers/test_type_collector.rb b/test/melon/passes/test_type_collector.rb similarity index 98% rename from test/melon/compilers/test_type_collector.rb rename to test/melon/passes/test_type_collector.rb index f2aa4bcf..57656b15 100644 --- a/test/melon/compilers/test_type_collector.rb +++ b/test/melon/passes/test_type_collector.rb @@ -1,7 +1,7 @@ require_relative "helper" module Melon - module Compilers + module Passes class TestTypeCollector < MiniTest::Test def setup diff --git a/test/melon/test_all.rb b/test/melon/test_all.rb index fc832cce..8661e584 100644 --- a/test/melon/test_all.rb +++ b/test/melon/test_all.rb @@ -1,4 +1,4 @@ -require_relative "compilers/test_all" +require_relative "passes/test_all" require_relative "fragments/test_all" require_relative "test_ruby_method" require_relative "test_compiler"