This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark" | |
struct Foo | |
def initialize(@size : Int32, @stride : Int32) | |
end | |
def step_from_class | |
0.step(to: @size, by: @stride) do |i| | |
yield i | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark" | |
struct Foo | |
def initialize(@size : Int32, @stride : Int32) | |
end | |
def step_from_class | |
0.step(to: @size, by: @stride) do |i| | |
yield i | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reset | |
user = current_user | |
return unless user | |
user_id = user.id | |
return unless user_id | |
server = VirtualMachine.find_by(user_id: user_id, id: params[:server_id]) | |
return unless server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec" | |
require "json" | |
require "yaml" | |
class JSON::Builder | |
def next_is_object_key? | |
state = @state.last | |
state.is_a?(ObjectState) && state.name | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 - [Bool, Int32, Int64, Slice(UInt8), String, UInt16, UInt32, UInt64, UInt8] | |
2 - [Crystal::Formatter::HeredocInfo, Crystal::StringInterpolation] | |
5 - [JSON::Builder::ArrayState, JSON::Builder::DocumentEndState, JSON::Builder::DocumentStartState, JSON::Builder::ObjectState, JSON::Builder::StartState] | |
3 - [Bool, Crystal::Compiler::Result, Nil] | |
2 - [Tuple(Int32), Tuple(Int32, Int32)] | |
2 - [Tuple(Char), Tuple(Char, Char)] | |
2 - [Pointer(Pointer(Void)), Pointer(Void)] | |
2 - [Bool, Slice(UInt8)] | |
3 - [Colorize::Color256, Colorize::ColorANSI, Colorize::ColorRGB] | |
2 - [HTTP::Headers::Key, String] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+13 | |
+19 | |
+11 | |
+15 | |
+1 | |
+7 | |
+17 | |
+14 | |
-16 | |
+15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/compiler/crystal/semantic/cleanup_transformer.cr b/src/compiler/crystal/semantic/cleanup_transformer.cr | |
index e108c12f1..59a21ef07 100644 | |
--- a/src/compiler/crystal/semantic/cleanup_transformer.cr | |
+++ b/src/compiler/crystal/semantic/cleanup_transformer.cr | |
@@ -23,6 +23,8 @@ module Crystal | |
initializer.node = initializer.node.transform(transformer) | |
end | |
end | |
+ | |
+ TypesAndMethodsPrinter.new.print_types_and_methods(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec" | |
require "json" | |
require "uuid" | |
require "uuid/json" | |
require "big/json" | |
module JSON | |
annotation Field | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec" | |
module UTF16 | |
def self.encode(string : String) : Slice(UInt16) | |
size = 0 | |
string.each_char do |char| | |
size += char.ord < 0x10000 ? 1 : 2 | |
end | |
slice = Slice(UInt16).new(size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def foo(x) | |
# Rename this call from "bar" to "baz": | |
# What other things change in this file? | |
# | |
# According to what's called, Bar#bar needs | |
# to change. But what about Baz#bar? I can | |
# also pass Baz.new to Foo.new.foo. There's | |
# no way to tell if that should be renamed too. | |
# |