Skip to content

Commit

Permalink
references canceled
Browse files Browse the repository at this point in the history
  • Loading branch information
olynch committed Sep 19, 2023
1 parent b9a5b88 commit 3dfbd98
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 392 deletions.
4 changes: 2 additions & 2 deletions src/models/SymbolicModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ function internal_constructors(theory::GAT)::Vector{JuliaFunction}

check_or_error = Expr(:(||), :(!strict), check_expr, throw_expr)
exprs = [idents(termcon.args)..., idents(termcon.localcontext)...]
expr_lookup = Dict{Reference, Any}(map(exprs) do x
Reference(x) => build_infer_expr(first(eqs[x]))
expr_lookup = Dict{Ident, Any}(map(exprs) do x
x => build_infer_expr(first(eqs[x]))
end)

build = Expr(
Expand Down
137 changes: 0 additions & 137 deletions src/stdlib/models/ScopeTrees.jl

This file was deleted.

2 changes: 0 additions & 2 deletions src/stdlib/models/module.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ include("FinSets.jl")
include("FinMatrices.jl")
include("SliceCategories.jl")
include("Nothings.jl")
include("ScopeTrees.jl")
include("GATs.jl")

@reexport using .FinSets
@reexport using .FinMatrices
@reexport using .SliceCategories
@reexport using .Nothings
@reexport using .ScopeTrees
@reexport using .GATs

end
64 changes: 0 additions & 64 deletions src/syntax/ExprInterop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,68 +69,4 @@ function fromexpr(c::Context, e, ::Type{Ident}; sig=nothing)
end
end

function reftolist(c::Context, ref::Reference; kw...)
symbols = []
while !isempty(ref)
x = first(ref)
push!(symbols, toexpr(c, x; kw...))
ref = rest(ref)
if !isempty(ref)
c = getvalue(c, x)
end
end
symbols
end

function toexpr(c::Context, ref::Reference; kw...)
symbols = reftolist(c, ref; kw...)
if isempty(symbols)
:(_)
else
expr = symbols[1]
for x in symbols[2:end]
expr = Expr(:(.), expr, QuoteNode(x))
end
expr
end
end

function flattendotexpr(e)
syms = Symbol[]
while !(e isa Symbol)
@match e begin
Expr(:(.), e′, QuoteNode(y)) => begin
push!(syms, y)
e = e′
end
_ => error("unexpected syntax for reference: $e")
end
end
@match e begin
:(_) => nothing
x::Symbol => push!(syms, x)
end
reverse(syms)
end

function reffromlist(c::Context, syms::AbstractVector{Symbol}; sig=nothing)
if isempty(syms)
Reference()
else
x = fromexpr(c, syms[1], Ident; sig)
c′ = getvalue(c, x)
r = if c′ isa Context
reffromlist(c′, @view syms[2:end])
else
length(syms) == 1 || error("the value of $x is not a context: $(c′)")
Reference()
end
Reference(x, r)
end
end

function fromexpr(c::Context, e, ::Type{Reference}; sig=nothing)
reffromlist(c, flattendotexpr(e); sig)
end

end # module
Loading

0 comments on commit 3dfbd98

Please sign in to comment.