Skip to content

Commit

Permalink
Only alias require is allowed with Elixir 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyalIcing committed Jan 21, 2025
1 parent f493fdc commit 91c5be3
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/orb/i32.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Orb.I32 do

import Kernel, except: [and: 2, or: 2]

require alias Orb.Ops
alias require Orb.Ops
alias Orb.Instruction
alias Orb.InstructionSequence

Expand Down
2 changes: 1 addition & 1 deletion lib/orb/i64.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Orb.I64 do
Type for 64-bit integer.
"""

require alias Orb.Ops
alias require Orb.Ops
alias Orb.Instruction

with @behaviour Orb.CustomType do
Expand Down
4 changes: 2 additions & 2 deletions lib/orb/if_else.ex
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ defmodule Orb.IfElse do

defimpl Orb.ToWat do
import Orb.ToWat.Helpers
require Orb.Ops |> alias
alias require Orb.Ops

def to_wat(
%Orb.IfElse{
Expand Down Expand Up @@ -178,7 +178,7 @@ defmodule Orb.IfElse do

import Kernel, except: [if: 2, unless: 2]

require InstructionSequence |> alias
alias require InstructionSequence

# Multi-line
defmacro if(condition, [result: result], do: when_true, else: when_false) do
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/instruction/const.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Orb.Instruction.Const do
@moduledoc false
defstruct [:push_type, :value]

require alias Orb.Ops
alias require Orb.Ops

def new(push_type, value) do
%__MODULE__{push_type: push_type, value: value}
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/memory/load.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Orb.Memory.Load do

defstruct push_type: nil, load_instruction: :load, address: nil, align: nil

require Orb.Ops |> alias
alias require Orb.Ops

def new(type, address, opts) when is_atom(type) do
load_instruction =
Expand Down
4 changes: 2 additions & 2 deletions lib/orb/memory/slice.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ defmodule Orb.Memory.Slice do
Similar to [Rust’s slice](https://doc.rust-lang.org/1.77.0/std/primitive.slice.html) but across all memory.
"""

require Orb.I64 |> alias
require Orb.I32 |> alias
alias require Orb.I64
alias require Orb.I32

with @behaviour Orb.CustomType do
@impl Orb.CustomType
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/memory/store.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Orb.Memory.Store do
value: nil

alias Orb.Memory.Load
require Orb.Ops |> alias
alias require Orb.Ops

def new(type, address, value, opts) when is_atom(type) do
load_instruction =
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/numeric/add.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Orb.Numeric.Add do
"""
alias Orb.CustomType

require alias Orb.Ops
alias require Orb.Ops

# Perform at comptime.
def optimized(_type, a, b) when is_integer(a) and is_integer(b), do: a + b
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/numeric/dsl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Orb.Numeric.DSL do
"""

import Kernel, except: [+: 2, -: 2, *: 2, ===: 2, !==: 2, not: 1, or: 2]
require alias Orb.Ops
alias require Orb.Ops

def left + right do
case Ops.extract_common_type(left, right) do
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/numeric/multiply.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Orb.Numeric.Multiply do
"""
alias Orb.CustomType

require alias Orb.Ops
alias require Orb.Ops

# Perform at comptime.
def optimized(_type, a, b) when is_integer(a) and is_integer(b), do: a * b
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/numeric/sub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Orb.Numeric.Subtract do
"""
alias Orb.CustomType

require alias Orb.Ops
alias require Orb.Ops

# Perform at comptime.
def optimized(_type, a, b) when is_integer(a) and is_integer(b), do: a - b
Expand Down
4 changes: 2 additions & 2 deletions lib/orb/stack.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Orb.Stack do

defstruct instruction: nil, count: 0, pop_type: nil, push_type: nil

require alias Orb.Ops
alias require Orb.Ops

def new(instruction) do
{_pop, type} = Ops.pop_push_of(instruction)
Expand Down Expand Up @@ -64,7 +64,7 @@ defmodule Orb.Stack do

defstruct pop_type: nil, push_type: nil, count: 0

require alias Orb.Ops
alias require Orb.Ops

def new(type) do
count = type |> Ops.type_stack_count()
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/type_check_error.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Orb.TypeCheckError do
defexception [:expected_type, :received_type, :instruction_identifier, :message]

require Orb.Ops |> alias
alias require Orb.Ops

defp make_message(type_a, type_b, :if) do
"if/else expected consistent clause types, if: #{format_type(type_a)}, but else: #{format_type(type_b)}."
Expand Down

0 comments on commit 91c5be3

Please sign in to comment.