Skip to content

Commit 5accfef

Browse files
authored
add activate! function as alias to enable_in_core! (#547)
1 parent 58082d9 commit 5accfef

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/expr.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function _string_to_Expr(args)
140140
# """\n a\n b""" ==> "a\nb"
141141
return only(args2)
142142
else
143-
# This only happens when the kind is K"string" or when an error has occurred.
143+
# This only happens when the kind is K"string" or when an error has occurred.
144144
return Expr(:string, args2...)
145145
end
146146
end
@@ -159,7 +159,7 @@ function _fixup_Expr_children!(head, loc, args)
159159
arg = args[i]
160160
was_parens = @isexpr(arg, :parens)
161161
arg = _strip_parens(arg)
162-
if @isexpr(arg, :(=)) && eq_to_kw_in_call && i > 1
162+
if @isexpr(arg, :(=)) && eq_to_kw_in_call && i > 1
163163
arg = Expr(:kw, arg.args...)
164164
elseif k != K"parens" && @isexpr(arg, :., 1) && arg.args[1] isa Tuple
165165
h, a = arg.args[1]::Tuple{SyntaxHead,Any}

src/hooks.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ end
290290

291291
_default_system_parser = _has_v1_6_hooks ? Core._parse : nothing
292292

293+
# hook into InteractiveUtils.@activate
294+
activate!(enable=true) = enable_in_core!(enable)
295+
293296
"""
294297
enable_in_core!([enable=true; freeze_world_age=true, debug_filename=nothing])
295298

src/syntax_tree.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ numchildren(node::TreeNode) = (isnothing(node.children) ? 0 : length(node.childr
131131
Base.getindex(node::AbstractSyntaxNode, i::Int) = children(node)[i]
132132
Base.getindex(node::AbstractSyntaxNode, rng::UnitRange) = view(children(node), rng)
133133
Base.firstindex(node::AbstractSyntaxNode) = 1
134-
Base.lastindex(node::AbstractSyntaxNode) = length(children(node))
134+
Base.length(node::AbstractSyntaxNode) = length(children(node))
135+
Base.lastindex(node::AbstractSyntaxNode) = length(node)
135136

136137
function Base.setindex!(node::SN, x::SN, i::Int) where {SN<:AbstractSyntaxNode}
137138
children(node)[i] = x

0 commit comments

Comments
 (0)