From 2bb6ad5f61529c925f938e40d78b3547764204c8 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 1 Sep 2018 15:14:07 +0300 Subject: [PATCH] remove unused code Arrays and Hashes have to resolve to object creation calls Not to constants. In the future off course --- lib/ruby/logical_statement.rb | 8 ++++++++ lib/vool/array_statement.rb | 13 ------------- lib/vool/hash_statement.rb | 17 ----------------- lib/vool/logical_statement.rb | 16 ---------------- lib/vool/statement.rb | 3 --- 5 files changed, 8 insertions(+), 49 deletions(-) delete mode 100644 lib/vool/array_statement.rb delete mode 100644 lib/vool/hash_statement.rb delete mode 100644 lib/vool/logical_statement.rb diff --git a/lib/ruby/logical_statement.rb b/lib/ruby/logical_statement.rb index 77a6badb..f37596c1 100644 --- a/lib/ruby/logical_statement.rb +++ b/lib/ruby/logical_statement.rb @@ -1,6 +1,14 @@ module Ruby # Logical Statements are guaranteed to return boolean # either :and or :or, which may be written as && and || + # + # Also they guarantee that the right expression does not get evaluated + # if the whole expression fails on the left expression. + # ie: false && non_existant_method + # will never call the non_existant_method , but instead evaluate to false + # + # Vool has no concept of this, so the Statement is expanded into the if + # that it really is class LogicalStatement < Statement attr_reader :name , :left , :right diff --git a/lib/vool/array_statement.rb b/lib/vool/array_statement.rb deleted file mode 100644 index 42cef191..00000000 --- a/lib/vool/array_statement.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Vool - class ArrayStatement - attr_reader :values - - def initialize( values ) - @values = values - end - - def length - @values.length - end - end -end diff --git a/lib/vool/hash_statement.rb b/lib/vool/hash_statement.rb deleted file mode 100644 index af2adea3..00000000 --- a/lib/vool/hash_statement.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Vool - class HashStatement - attr_reader :hash - - def initialize( ) - @hash = {} - end - - def add(key , value) - @hash[key] = value - end - - def length - @hash.length - end - end -end diff --git a/lib/vool/logical_statement.rb b/lib/vool/logical_statement.rb deleted file mode 100644 index 3dfcde44..00000000 --- a/lib/vool/logical_statement.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Vool - # Logical Statements are guaranteed to return boolean - # either :and or :or, which may be written as && and || - class LogicalStatement < Statement - attr_reader :name , :left , :right - - def initialize(name , left , right) - @name , @left , @right = name , left , right - end - - def to_s(depth = 0) - at_depth(depth , "#{left} #{name} #{right}") - end - - end -end diff --git a/lib/vool/statement.rb b/lib/vool/statement.rb index 2b5d350f..33a49b45 100644 --- a/lib/vool/statement.rb +++ b/lib/vool/statement.rb @@ -62,14 +62,11 @@ end require_relative "assignment" -require_relative "array_statement" require_relative "basic_values" require_relative "block_statement" require_relative "call_statement" require_relative "class_statement" -require_relative "hash_statement" require_relative "if_statement" -require_relative "logical_statement" require_relative "ivar_assignment" require_relative "local_assignment" require_relative "method_statement"