mirror of
https://github.com/JuliaLang/julia.git
synced 2026-05-28 03:10:33 +08:00
Add `soft_scope::Union{Nothing,Bool}=nothing` to `lower`, `lower_step`,
`eval`, and `_eval` so that callers can explicitly control soft scope
behavior without relying on the marker-based heuristic. Also add a TODO
for future propagation through the `jl_lower` C API.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
1.1 KiB
Julia
27 lines
1.1 KiB
Julia
# This file is a part of Julia. License is MIT: https://julialang.org/license
|
|
|
|
# Call Julia's builtin flisp-based parser. `offset` is 0-based offset into the
|
|
# byte buffer or string.
|
|
function fl_parse(text::Union{Core.SimpleVector,String},
|
|
filename::String, lineno, offset, options)
|
|
if text isa Core.SimpleVector
|
|
# Will be generated by C entry points jl_parse_string etc
|
|
text, text_len = text
|
|
else
|
|
text_len = sizeof(text)
|
|
end
|
|
ccall(:jl_fl_parse, Any, (Ptr{UInt8}, Csize_t, Any, Csize_t, Csize_t, Any),
|
|
text, text_len, filename, lineno, offset, options)
|
|
end
|
|
|
|
function fl_parse(text::AbstractString, filename::AbstractString, lineno, offset, options)
|
|
fl_parse(String(text), String(filename), lineno, offset, options)
|
|
end
|
|
|
|
function fl_lower(ex, mod::Module, filename::Union{String,Ptr{UInt8}}="none",
|
|
lineno::Integer=0, world::UInt=typemax(Csize_t), warn::Bool=false)
|
|
warn = warn ? 1 : 0
|
|
ccall(:jl_fl_lower, Any, (Any, Any, Ptr{UInt8}, Csize_t, Csize_t, Cint),
|
|
ex, mod, filename, lineno, world, warn)
|
|
end
|