Skip to content

Commit

Permalink
Merge pull request #126 from JuliaLang/tk/fixprecompile
Browse files Browse the repository at this point in the history
Fix loading of precompiled JSON when DataStructures is not present
  • Loading branch information
tkelman committed Sep 26, 2015
2 parents fb33673 + 0716a1c commit fe9de2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ sudo: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd()); Pkg.build("JSON"); Pkg.test("JSON"; coverage=true)';
- julia -e 'using JSON' # loading after precompiled, but without DataStructures present
after_success:
- julia -e 'cd(Pkg.dir("JSON")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())';
13 changes: 7 additions & 6 deletions src/Parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ module Parser #JSON
using Compat

#Define ordered dictionary from DataStructures if present
_HAVE_DATASTRUCTURES = try
using DataStructures
import DataStructures.OrderedDict
true
catch
false
function __init__()
global _HAVE_DATASTRUCTURES = try
@eval import DataStructures.OrderedDict

This comment has been minimized.

Copy link
@stevengj

stevengj Sep 29, 2015

Member

Precompiling IJulia (which uses JSON) is giving me:

WARNING: eval from module Parser to IJulia:    
Expr(:import, :DataStructures, :OrderedDict)::Any
  ** incremental compilation may be broken for this module **

Why not just REQUIRE the DataStructure.jl module? I don't understand the reason for the conditional import here.

This comment has been minimized.

Copy link
@tkelman

tkelman Sep 29, 2015

Author Contributor

Hm, this may need to be modified to be more careful about importing into its own module then?

DataStructures is bigger than JSON and the ordered feature is optional AIUI, though I didn't write the feature.

true
catch
false
end
end

const TYPES = Any # Union{Dict, Array, AbstractString, Number, Bool, Void} # Types it may encounter
Expand Down

0 comments on commit fe9de2d

Please sign in to comment.