Skip to content

Commit

Permalink
Remove (superfluous now) calls to AstNode#id
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed Jan 2, 2018
1 parent 3acd811 commit d1898c4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/json/from_json.cr
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def Bool.new(pull : JSON::PullParser)
end

{% for type in Int::Primitive.union_types %}
def {{type.id}}.new(pull : JSON::PullParser)
{{type.id}}.new(pull.read_int)
def {{type}}.new(pull : JSON::PullParser)
{{type}}.new(pull.read_int)
end
{% end %}

Expand Down
28 changes: 14 additions & 14 deletions src/primitives.cr
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ end
{% binaries = {"+" => "adding", "-" => "subtracting", "*" => "multiplying", "/" => "dividing"} %}

{% for num in nums %}
struct {{num.id}}
struct {{num}}
{% for name, type in {
to_i: Int32, to_u: UInt32, to_f: Float64,
to_i8: Int8, to_i16: Int16, to_i32: Int32, to_i64: Int64, to_i128: Int128,
Expand All @@ -297,15 +297,15 @@ end
} %}
# Returns `true` if `self` is {{desc.id}} *other*.
@[Primitive(:binary)]
def {{op.id}}(other : {{num2.id}}) : Bool
def {{op.id}}(other : {{num2}}) : Bool
end
{% end %}
{% end %}
end
{% end %}

{% for int in ints %}
struct {{int.id}}
struct {{int}}
# Returns a `Char` that has the unicode codepoint of `self`,
# without checking if this integer is in the range valid for
# chars (`0..0x10ffff`).
Expand All @@ -325,65 +325,65 @@ end
{% if op != "/" %}
# Returns the result of {{desc.id}} `self` and *other*.
@[Primitive(:binary)]
def {{op.id}}(other : {{int2.id}}) : self
def {{op.id}}(other : {{int2}}) : self
end
{% end %}
{% end %}

# Returns the result of performing a bitwise OR of `self`'s and *other*'s bits.
@[Primitive(:binary)]
def |(other : {{int2.id}}) : self
def |(other : {{int2}}) : self
end

# Returns the result of performing a bitwise AND of `self`'s and *other*'s bits.
@[Primitive(:binary)]
def &(other : {{int2.id}}) : self
def &(other : {{int2}}) : self
end

# Returns the result of performing a bitwise XOR of `self`'s and *other*'s bits.
@[Primitive(:binary)]
def ^(other : {{int2.id}}) : self
def ^(other : {{int2}}) : self
end

# :nodoc:
@[Primitive(:binary)]
def unsafe_shl(other : {{int2.id}}) : self
def unsafe_shl(other : {{int2}}) : self
end

# :nodoc:
@[Primitive(:binary)]
def unsafe_shr(other : {{int2.id}}) : self
def unsafe_shr(other : {{int2}}) : self
end

# :nodoc:
@[Primitive(:binary)]
def unsafe_div(other : {{int2.id}}) : self
def unsafe_div(other : {{int2}}) : self
end

# :nodoc:
@[Primitive(:binary)]
def unsafe_mod(other : {{int2.id}}) : self
def unsafe_mod(other : {{int2}}) : self
end
{% end %}

{% for float in floats %}
{% for op, desc in binaries %}
# Returns the result of {{desc.id}} `self` and *other*.
@[Primitive(:binary)]
def {{op.id}}(other : {{float.id}}) : {{float.id}}
def {{op.id}}(other : {{float}}) : {{float}}
end
{% end %}
{% end %}
end
{% end %}

{% for float in floats %}
struct {{float.id}}
struct {{float}}
{% for num in nums %}
{% for op, desc in binaries %}
# Returns the result of {{desc.id}} `self` and *other*.
@[Primitive(:binary)]
def {{op.id}}(other : {{num.id}}) : self
def {{op.id}}(other : {{num}}) : self
end
{% end %}
{% end %}
Expand Down
4 changes: 2 additions & 2 deletions src/yaml/from_yaml.cr
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def Bool.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
end

{% for type in Int::Primitive.union_types %}
def {{type.id}}.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
{{type.id}}.new parse_scalar(ctx, node, Int64)
def {{type}}.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
{{type}}.new parse_scalar(ctx, node, Int64)
end
{% end %}

Expand Down

0 comments on commit d1898c4

Please sign in to comment.