Skip to content

Commit

Permalink
Drop empty “else # go on” branches
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed Aug 3, 2020
1 parent f863e00 commit e2a27a7
Show file tree
Hide file tree
Showing 22 changed files with 0 additions and 82 deletions.
2 changes: 0 additions & 2 deletions samples/llvm/brainfuck.cr
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ class Program
open_count += 1
when ']'
open_count -= 1
else
# go on
end

if open_count == 0
Expand Down
6 changes: 0 additions & 6 deletions samples/sdl/fire.cr
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ while true
speed_down[3] = true
when LibSDL::Key::L
turn_right[3] = true
else
# ignore
end
when LibSDL::KEYUP
case event.key.key_sym.sym
Expand Down Expand Up @@ -423,11 +421,7 @@ while true
speed_down[3] = false
when LibSDL::Key::L
turn_right[3] = false
else
# ignore
end
else
# ignore
end
end

Expand Down
2 changes: 0 additions & 2 deletions src/char.cr
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,6 @@ struct Char
else # at the beginning of the set or escaped
return not_negated if self == char
end
else
# go on
end

if range && previous
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/codegen/call.cr
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,6 @@ class Crystal::CodeGenVisitor
else
@last = llvm_nil
end
else
# go on
end
end

Expand Down
6 changes: 0 additions & 6 deletions src/compiler/crystal/codegen/cast.cr
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ class Crystal::CodeGenVisitor
value = upcast(value, compatible_type, value_type)
return assign(target_pointer, target_type, compatible_type, value)
end
else
# go on
end

value = to_rhs(value, value_type)
Expand Down Expand Up @@ -461,8 +459,6 @@ class Crystal::CodeGenVisitor
value = downcast(value, to_type, compatible_type, true)
return value
end
else
# go on
end

_, value_ptr = union_type_and_value_pointer(value, from_type)
Expand Down Expand Up @@ -677,8 +673,6 @@ class Crystal::CodeGenVisitor
value = upcast(value, compatible_type, from_type)
return upcast(value, to_type, compatible_type)
end
else
# go on
end

union_ptr = alloca(llvm_type(to_type))
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/codegen/class_var.cr
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ class Crystal::CodeGenVisitor
return read_virtual_class_var_ptr(class_var, owner)
when VirtualMetaclassType
return read_virtual_metaclass_class_var_ptr(class_var, owner)
else
# go on
end

initializer = class_var.initializer
Expand Down
4 changes: 0 additions & 4 deletions src/compiler/crystal/codegen/codegen.cr
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ module Crystal
@codegen.personality_name, GET_EXCEPTION_NAME, RAISE_OVERFLOW_NAME,
ONCE_INIT, ONCE
@codegen.accept node
else
# go on
end

false
Expand Down Expand Up @@ -1111,8 +1109,6 @@ module Crystal
when ClassVar
# This is the case of a class var initializer
initialize_class_var(var)
else
# go on
end

@last = llvm_nil
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/codegen/primitives.cr
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,11 @@ class Crystal::CodeGenVisitor
when ">=" then return codegen_binary_op_gte(t1, t2, p1, p2)
when "==" then return codegen_binary_op_eq(t1, t2, p1, p2)
when "!=" then return codegen_binary_op_ne(t1, t2, p1, p2)
else # go on
end

case op
when "+", "-", "*"
return codegen_binary_op_with_overflow(op, t1, t2, p1, p2)
else # go on
end

tmax, p1, p2 = codegen_binary_extend_int(t1, t2, p1, p2)
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/codegen/types.cr
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ module Crystal
when IntegerType, EnumType
interpreter = MathInterpreter.new(namespace, visitor)
@compile_time_value = interpreter.interpret(value) rescue nil
else
# go on
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/macros/interpreter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,6 @@ module Crystal
return NamedTupleLiteral.new(entries)
when UnionType
return TupleLiteral.map(matched_type.union_types) { |t| TypeNode.new(t) }
else
# go on
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/semantic/lib.cr
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ class Crystal::Call
return if convert_numeric_argument self_arg, unaliased_type, expected_type, actual_type, index
when FloatType
return if convert_numeric_argument self_arg, unaliased_type, expected_type, actual_type, index
else
# go on
end

implicit_call = Conversions.try_to_unsafe(self_arg.clone, parent_visitor) do |ex|
Expand Down
18 changes: 0 additions & 18 deletions src/compiler/crystal/semantic/main_visitor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1421,8 +1421,6 @@ module Crystal
case exp
when Var, InstanceVar, ClassVar, Global
next
else
# go on
end

temp_var = @program.new_temp_var.at(arg.location)
Expand Down Expand Up @@ -1566,8 +1564,6 @@ module Crystal
if instance_type.namespace.is_a?(LibType) && (named_args = node.named_args)
return special_c_struct_or_union_new_with_named_args(node, instance_type, named_args)
end
else
# go on, nothing special
end
end

Expand Down Expand Up @@ -1839,8 +1835,6 @@ module Crystal
when Expressions
return unless exp = exp.single_expression?
return get_expression_var(exp)
else
# go on
end
nil
end
Expand All @@ -1865,8 +1859,6 @@ module Crystal
node.raise "can't cast to Reference yet"
when @program.class_type
node.raise "can't cast to Class yet"
else
# go on
end

obj_type = node.obj.type?
Expand Down Expand Up @@ -1972,8 +1964,6 @@ module Crystal
elsif or_right_type_filters
filter_vars or_right_type_filters.not
end
else
# go on
end

before_else_vars = @vars.dup
Expand All @@ -1994,8 +1984,6 @@ module Crystal
@or_left_type_filters = or_left_type_filters = then_type_filters
@or_right_type_filters = or_right_type_filters = else_type_filters
@type_filters = TypeFilters.or(cond_type_filters, then_type_filters, else_type_filters)
else
# go on: a regular if
end
end

Expand Down Expand Up @@ -2287,8 +2275,6 @@ module Crystal
when Expressions
return unless node = node.single_expression?
return get_while_cond_assign_target(node)
else
# go on
end

nil
Expand Down Expand Up @@ -2512,8 +2498,6 @@ module Crystal
node.extra = convert_call
return
end
else
# go on
end

unsafe_call = Conversions.to_unsafe(node, Var.new("value").at(node), self, actual_type, expected_type)
Expand Down Expand Up @@ -3124,8 +3108,6 @@ module Crystal
case exp
when Var, IsA, RespondsTo, Not
return type_filters.not
else
# go on
end
end

Expand Down
4 changes: 0 additions & 4 deletions src/compiler/crystal/semantic/semantic_visitor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,6 @@ abstract class Crystal::SemanticVisitor < Crystal::Visitor
expanded = expanded_type.value
when Type
expanded = TypeNode.new(expanded_type)
else
# go on
end
end
expanded
Expand Down Expand Up @@ -486,8 +484,6 @@ abstract class Crystal::SemanticVisitor < Crystal::Visitor
when @program.experimental_annotation
# ditto DeprecatedAnnotation
ExperimentalAnnotation.from(ann)
else
# go on
end
end

Expand Down
4 changes: 0 additions & 4 deletions src/compiler/crystal/semantic/top_level_visitor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ class Crystal::TopLevelVisitor < Crystal::SemanticVisitor
receiver.raise "can't define method in generic instance #{metaclass}"
when GenericModuleInstanceMetaclassType
receiver.raise "can't define method in generic instance #{metaclass}"
else
# go on
end
metaclass
end
Expand Down Expand Up @@ -824,8 +822,6 @@ class Crystal::TopLevelVisitor < Crystal::SemanticVisitor
# Don't give an error yet: wait to see if the
# call doesn't resolve to a method/macro
return false
else
# go on
end

node.raise "can't apply visibility modifier"
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/semantic/type_guess_visitor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ module Crystal
value = process_assign_instance_var(owner, target, value)
when GenericModuleType
value = process_assign_instance_var(owner, target, value)
else
# go on
end

unless current_type.allows_instance_vars?
Expand Down
6 changes: 0 additions & 6 deletions src/compiler/crystal/semantic/type_lookup.cr
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ class Crystal::Type
type_var.raise "can only splat tuple type, not #{splat_type}"
end
next
else
# go on
end

# Check the case of T resolving to a number
Expand All @@ -266,8 +264,6 @@ class Crystal::Type
when ASTNode
type_vars << type
next
else
# go on
end
end

Expand All @@ -278,8 +274,6 @@ class Crystal::Type
case instance_type
when GenericUnionType, PointerType, StaticArrayType, TupleType, ProcType
check_type_can_be_stored(type_var, type, "can't use #{type} as a generic type argument")
else
# go on
end

type_vars << type.virtual_type
Expand Down
4 changes: 0 additions & 4 deletions src/compiler/crystal/syntax/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2717,8 +2717,6 @@ module Crystal
!exp.block
return
end
else
# Go on
end

raise "expression of exhaustive case (case ... in) must be a constant (like `IO::Memory`), a generic (like `Array(Int32)`) a bool literal (true or false), a nil literal (nil) or a question method (like `.red?`)", exp.location.not_nil!
Expand Down Expand Up @@ -3965,8 +3963,6 @@ module Crystal
a_else = parse_expressions
when :elsif
a_else = parse_if check_end: false
else
# go on
end
end

Expand Down
2 changes: 0 additions & 2 deletions src/compiler/crystal/tools/context.cr
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ module Crystal
if (obj = cond.obj).is_a?(Var)
filters = TypeFilters.new(obj, SimpleTypeFilter.new(cond.const.type))
end
else
# go on
end

if filters
Expand Down
4 changes: 0 additions & 4 deletions src/compiler/crystal/tools/doc/type.cr
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ class Crystal::Doc::Type
superclass = type.superclass
when GenericClassInstanceType
superclass = type.superclass
else
# go on
end

if superclass
Expand Down Expand Up @@ -268,8 +266,6 @@ class Crystal::Doc::Type
next
when NonGenericClassType
next if subclass.extern?
else
# go on
end

next unless @generator.must_include?(subclass)
Expand Down
2 changes: 0 additions & 2 deletions src/csv/lexer/string_based.cr
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class CSV::Lexer::StringBased < CSV::Lexer
break
when @quote_char
raise "Unexpected quote"
else
# go on
end
end
@reader.string.byte_slice(start_pos, end_pos - start_pos)
Expand Down
2 changes: 0 additions & 2 deletions src/dir/glob.cr
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ class Dir
yield fullpath if next_cmd.path == entry.name
when EntryMatch
yield fullpath if next_cmd.matches?(entry.name)
else
# go on
end

if entry.dir?
Expand Down
2 changes: 0 additions & 2 deletions src/llvm/abi/aarch64.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class LLVM::ABI::AArch64 < LLVM::ABI
check_array(type)
when Type::Kind::Struct
check_struct(type)
else
# go on
end

# Ensure we have at most four uniquely addressable members
Expand Down

0 comments on commit e2a27a7

Please sign in to comment.