Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
  • Loading branch information
c42f and vtjnash committed May 4, 2020
1 parent a050e00 commit f005a8c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ function include_string(mapexpr::Function, mod::Module, code::AbstractString,
catch exc
# TODO: Now that stacktraces are more reliable we should remove
# LoadError and expose the real error type directly.
rethrow(LoadError(String(loc.file), loc.line, exc))
rethrow(LoadError(filename, loc.line, exc))
end
end

Expand Down
7 changes: 3 additions & 4 deletions base/stacktraces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,10 @@ function Base.parentmodule(frame::StackFrame)
return def
else
return (def::Method).module
return def.module
end
else
# Bug: currently the module is not available for inlined frames and
# frames arising from the interpreter.
# The module is not always available (common reasons include inlined
# frames and frames arising from the interpreter)
nothing
end
end
Expand All @@ -290,7 +289,7 @@ end
Returns whether the `frame` is from the provided `Module`
"""
function from(frame::StackFrame, m::Module)
parentmodule(frame) == m
return parentmodule(frame) === m
end

end
10 changes: 4 additions & 6 deletions src/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,13 +1198,11 @@ JL_DLLEXPORT jl_value_t *jl_parse(const char *text, size_t text_len, jl_value_t
jl_value_t *result = jl_apply(args, 5);
ptls->world_age = last_age;
args[0] = result; // root during error checks below
if (!jl_is_svec(result)) {
jl_type_error("jl_parse", (jl_value_t*)jl_simplevector_type, result);
}
else if (jl_svec_len(result) != 2 || !jl_is_expr(jl_svecref(result, 0)) ||
!jl_is_long(jl_svecref(result, 1))) {
JL_TYPECHK(parse, simplevector, result);
if (jl_svec_len(result) != 2)
jl_error("Result from parser should be `svec(a::Expr, b::Int)`");
}
JL_TYPECHK(parse, expr, jl_svecref(result, 0));
JL_TYPECHK(parse, long, jl_svecref(result, 1));
JL_GC_POP();
return result;
}
Expand Down
1 change: 0 additions & 1 deletion stdlib/Distributed/test/distributed_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,6 @@ let
function test_include_fails_to_open_file(fname)
try
include(fname)
false
catch exc
path = joinpath(@__DIR__, fname)
@test exc isa SystemError
Expand Down

0 comments on commit f005a8c

Please sign in to comment.