gloss 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Gemfile.lock +3 -3
 - data/lib/gloss/cli.rb +2 -1
 - data/lib/gloss/prog_loader.rb +2 -2
 - data/lib/gloss/runtime.rb +5 -1
 - data/lib/gloss/type_checker.rb +2 -2
 - data/lib/gloss/version.rb +1 -1
 - data/src/lib/gloss/cli.gl +2 -1
 - data/src/lib/gloss/prog_loader.gl +1 -2
 - data/src/lib/gloss/runtime.gl +4 -1
 - data/src/lib/gloss/type_checker.gl +2 -2
 - data/src/lib/gloss/version.gl +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0f65447f0ea2606334c6c17956f4c8ec7c8be413918fa4d2d423f973407a451b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bf09ca8cfc5f0b6d4f7f6c77d8e1cb93da94d1359452218fc514160cf54c571a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2d788c4b489e5e16e66e304d64f9c0830922d9ef861de818ac170e3c54d64b99e0d45cf6752beca1a392e88f15dc1d3627f02f66f79eb2437659807d1b5551d2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9b285072b81d675ac0ca5485a732e7c46e83aca2b6bf09d288b58b7a6b9503e976711f0a2cb51d3d04edbf2c573d8625a0c8f9f35e4d158b11145a2d5919c3bd
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                gloss (0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
                gloss (0.1.7)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  fast_blank
         
     | 
| 
       6 
6 
     | 
    
         
             
                  listen
         
     | 
| 
       7 
7 
     | 
    
         
             
                  rbs (= 1.0.4)
         
     | 
| 
         @@ -25,10 +25,10 @@ GEM 
     | 
|
| 
       25 
25 
     | 
    
         
             
                diff-lcs (1.4.4)
         
     | 
| 
       26 
26 
     | 
    
         
             
                fast_blank (1.0.0)
         
     | 
| 
       27 
27 
     | 
    
         
             
                ffi (1.15.0)
         
     | 
| 
       28 
     | 
    
         
            -
                i18n (1.8. 
     | 
| 
      
 28 
     | 
    
         
            +
                i18n (1.8.10)
         
     | 
| 
       29 
29 
     | 
    
         
             
                  concurrent-ruby (~> 1.0)
         
     | 
| 
       30 
30 
     | 
    
         
             
                language_server-protocol (3.15.0.2)
         
     | 
| 
       31 
     | 
    
         
            -
                listen (3.5. 
     | 
| 
      
 31 
     | 
    
         
            +
                listen (3.5.1)
         
     | 
| 
       32 
32 
     | 
    
         
             
                  rb-fsevent (~> 0.10, >= 0.10.3)
         
     | 
| 
       33 
33 
     | 
    
         
             
                  rb-inotify (~> 0.9, >= 0.9.10)
         
     | 
| 
       34 
34 
     | 
    
         
             
                method_source (1.0.0)
         
     | 
    
        data/lib/gloss/cli.rb
    CHANGED
    
    | 
         @@ -27,7 +27,8 @@ case command 
     | 
|
| 
       27 
27 
     | 
    
         
             
                        puts(Gloss::VERSION)
         
     | 
| 
       28 
28 
     | 
    
         
             
                      when "watch", "build"
         
     | 
| 
       29 
29 
     | 
    
         
             
                        Gloss.load_config
         
     | 
| 
       30 
     | 
    
         
            -
                        type_checker =  
     | 
| 
      
 30 
     | 
    
         
            +
                        type_checker = TypeChecker.new(Config.src_dir)
         
     | 
| 
      
 31 
     | 
    
         
            +
                        type_checker = ProgLoader.new(type_checker)
         
     | 
| 
       31 
32 
     | 
    
         
             
            .run
         
     | 
| 
       32 
33 
     | 
    
         
             
                        (if command.==("watch")
         
     | 
| 
       33 
34 
     | 
    
         
             
                          files = files.map() { |f|
         
     | 
    
        data/lib/gloss/prog_loader.rb
    CHANGED
    
    | 
         @@ -7,7 +7,8 @@ module Gloss 
     | 
|
| 
       7 
7 
     | 
    
         
             
              OUTPUT_BY_PATH = Hash.new
         
     | 
| 
       8 
8 
     | 
    
         
             
              class ProgLoader
         
     | 
| 
       9 
9 
     | 
    
         
             
                attr_reader(:"type_checker")
         
     | 
| 
       10 
     | 
    
         
            -
                def initialize(entrypoint_path = nil, entrypoint_contents = nil)
         
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize(type_checker, entrypoint_path = nil, entrypoint_contents = nil)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @type_checker = type_checker
         
     | 
| 
       11 
12 
     | 
    
         
             
                  entrypoint_path ||= Config.entrypoint
         
     | 
| 
       12 
13 
     | 
    
         
             
                  (if entrypoint_path.==(nil) || entrypoint_path.==("")
         
     | 
| 
       13 
14 
     | 
    
         
             
                    throw(:"error", "Entrypoint is not yet set in .gloss.yml")
         
     | 
| 
         @@ -25,7 +26,6 @@ module Gloss 
     | 
|
| 
       25 
26 
     | 
    
         
             
                  core_types = Utils.abs_path_with_contents(File.join(__dir__ || "", "..", "..", "sig", "core.rbs"))
         
     | 
| 
       26 
27 
     | 
    
         
             
                  @files_to_process = [entrypoint, core_types]
         
     | 
| 
       27 
28 
     | 
    
         
             
                  @processed_files = Set.new
         
     | 
| 
       28 
     | 
    
         
            -
                  @type_checker = TypeChecker.new
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         
             
                def run()
         
     | 
| 
       31 
31 
     | 
    
         
             
                  @files_to_process.each() { |__arg0|
         
     | 
    
        data/lib/gloss/runtime.rb
    CHANGED
    
    | 
         @@ -7,11 +7,15 @@ module Gloss 
     | 
|
| 
       7 
7 
     | 
    
         
             
              class Runtime
         
     | 
| 
       8 
8 
     | 
    
         
             
                NON_EXISTENT_FILEPATH = "__string__"
         
     | 
| 
       9 
9 
     | 
    
         
             
                def self.process_string(str, options = Config.default_config)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  (if str.empty?
         
     | 
| 
      
 11 
     | 
    
         
            +
                    return ["", nil].freeze
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end)
         
     | 
| 
       10 
13 
     | 
    
         
             
                  out_io = StringIO.new
         
     | 
| 
       11 
14 
     | 
    
         
             
                  error_msg = catch(:"error") { ||
         
     | 
| 
       12 
15 
     | 
    
         
             
                    tree = Parser.new(str)
         
     | 
| 
       13 
16 
     | 
    
         
             
            .run
         
     | 
| 
       14 
     | 
    
         
            -
                    tc =  
     | 
| 
      
 17 
     | 
    
         
            +
                    tc = TypeChecker.new(".")
         
     | 
| 
      
 18 
     | 
    
         
            +
                    tc = ProgLoader.new(tc, NON_EXISTENT_FILEPATH, str)
         
     | 
| 
       15 
19 
     | 
    
         
             
            .run
         
     | 
| 
       16 
20 
     | 
    
         
             
                    rb_output = Visitor.new(tree, tc)
         
     | 
| 
       17 
21 
     | 
    
         
             
            .run
         
     | 
    
        data/lib/gloss/type_checker.rb
    CHANGED
    
    | 
         @@ -11,7 +11,7 @@ module Gloss 
     | 
|
| 
       11 
11 
     | 
    
         
             
                  Lenient = "lenient"
         
     | 
| 
       12 
12 
     | 
    
         
             
                  Default = "default"
         
     | 
| 
       13 
13 
     | 
    
         
             
                end
         
     | 
| 
       14 
     | 
    
         
            -
                def initialize()
         
     | 
| 
      
 14 
     | 
    
         
            +
                def initialize(src_dir)
         
     | 
| 
       15 
15 
     | 
    
         
             
                  options = Steep::Project::Options.new
         
     | 
| 
       16 
16 
     | 
    
         
             
            case Config.type_checking_strictness
         
     | 
| 
       17 
17 
     | 
    
         
             
                    when Strictness::Strict
         
     | 
| 
         @@ -26,7 +26,7 @@ case Config.type_checking_strictness 
     | 
|
| 
       26 
26 
     | 
    
         
             
                  @rbs_gem_dir = Utils.gem_path_for("rbs")
         
     | 
| 
       27 
27 
     | 
    
         
             
                  env_loader = RBS::EnvironmentLoader.new
         
     | 
| 
       28 
28 
     | 
    
         
             
                  @env = RBS::Environment.from_loader(env_loader)
         
     | 
| 
       29 
     | 
    
         
            -
                  project = Steep::Project.new(steepfile_path:       Pathname.new( 
     | 
| 
      
 29 
     | 
    
         
            +
                  project = Steep::Project.new(steepfile_path:       Pathname.new(src_dir)
         
     | 
| 
       30 
30 
     | 
    
         
             
            .realpath)
         
     | 
| 
       31 
31 
     | 
    
         
             
                  project.targets
         
     | 
| 
       32 
32 
     | 
    
         
             
            .<<(@steep_target)
         
     | 
    
        data/lib/gloss/version.rb
    CHANGED
    
    
    
        data/src/lib/gloss/cli.gl
    CHANGED
    
    | 
         @@ -22,7 +22,8 @@ module Gloss 
     | 
|
| 
       22 
22 
     | 
    
         
             
                      puts Gloss::VERSION
         
     | 
| 
       23 
23 
     | 
    
         
             
                    when "watch", "build"
         
     | 
| 
       24 
24 
     | 
    
         
             
                      Gloss.load_config
         
     | 
| 
       25 
     | 
    
         
            -
                      type_checker =  
     | 
| 
      
 25 
     | 
    
         
            +
                      type_checker = TypeChecker.new(Config.src_dir)
         
     | 
| 
      
 26 
     | 
    
         
            +
                      type_checker = ProgLoader.new(type_checker).run
         
     | 
| 
       26 
27 
     | 
    
         
             
                      if command == "watch"
         
     | 
| 
       27 
28 
     | 
    
         
             
                        files = files.map do |f|
         
     | 
| 
       28 
29 
     | 
    
         
             
                          path = Pathname.new(f).absolute? ? f : File.join(Dir.pwd, f)
         
     | 
| 
         @@ -6,7 +6,7 @@ module Gloss 
     | 
|
| 
       6 
6 
     | 
    
         
             
              class ProgLoader
         
     | 
| 
       7 
7 
     | 
    
         
             
                attr_reader :type_checker
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
                def initialize(entrypoint_path = nil, entrypoint_contents = nil)
         
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(@type_checker : TypeChecker, entrypoint_path = nil, entrypoint_contents = nil)
         
     | 
| 
       10 
10 
     | 
    
         
             
                  entrypoint_path ||= Config.entrypoint
         
     | 
| 
       11 
11 
     | 
    
         
             
                  if entrypoint_path == nil || entrypoint_path == ""
         
     | 
| 
       12 
12 
     | 
    
         
             
                    throw :error, "Entrypoint is not yet set in .gloss.yml"
         
     | 
| 
         @@ -21,7 +21,6 @@ module Gloss 
     | 
|
| 
       21 
21 
     | 
    
         
             
                  core_types = Utils.abs_path_with_contents(File.join((__dir__||""), "..", "..", "sig", "core.rbs"))
         
     | 
| 
       22 
22 
     | 
    
         
             
                  @files_to_process = [entrypoint, core_types]
         
     | 
| 
       23 
23 
     | 
    
         
             
                  @processed_files = Set.new
         
     | 
| 
       24 
     | 
    
         
            -
                  @type_checker = TypeChecker.new
         
     | 
| 
       25 
24 
     | 
    
         
             
                end
         
     | 
| 
       26 
25 
     | 
    
         | 
| 
       27 
26 
     | 
    
         
             
                def run
         
     | 
    
        data/src/lib/gloss/runtime.gl
    CHANGED
    
    | 
         @@ -5,10 +5,13 @@ module Gloss 
     | 
|
| 
       5 
5 
     | 
    
         
             
                NON_EXISTENT_FILEPATH = "__string__"
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                def self.process_string(str : String, options = Config.default_config)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  return "", nil if str.empty?
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       8 
10 
     | 
    
         
             
                  out_io = StringIO.new
         
     | 
| 
       9 
11 
     | 
    
         
             
                  error_msg = catch :error do
         
     | 
| 
       10 
12 
     | 
    
         
             
                    tree = Parser.new(str).run
         
     | 
| 
       11 
     | 
    
         
            -
                    tc =  
     | 
| 
      
 13 
     | 
    
         
            +
                    tc = TypeChecker.new(".")
         
     | 
| 
      
 14 
     | 
    
         
            +
                    tc = ProgLoader.new(tc, NON_EXISTENT_FILEPATH, str).run
         
     | 
| 
       12 
15 
     | 
    
         
             
                    rb_output = Visitor.new(tree, tc).run
         
     | 
| 
       13 
16 
     | 
    
         
             
                    tc.run(NON_EXISTENT_FILEPATH, rb_output)
         
     | 
| 
       14 
17 
     | 
    
         
             
                    Writer.new(rb_output, NON_EXISTENT_FILEPATH, out_io).run
         
     | 
| 
         @@ -10,7 +10,7 @@ module Gloss 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  Default = "default"
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                def initialize
         
     | 
| 
      
 13 
     | 
    
         
            +
                def initialize(src_dir : String)
         
     | 
| 
       14 
14 
     | 
    
         
             
                  options = Steep::Project::Options.new
         
     | 
| 
       15 
15 
     | 
    
         
             
                  case Config.type_checking_strictness
         
     | 
| 
       16 
16 
     | 
    
         
             
                  when Strictness::Strict
         
     | 
| 
         @@ -31,7 +31,7 @@ module Gloss 
     | 
|
| 
       31 
31 
     | 
    
         
             
                  @rbs_gem_dir = Utils.gem_path_for("rbs")
         
     | 
| 
       32 
32 
     | 
    
         
             
                  env_loader = RBS::EnvironmentLoader.new
         
     | 
| 
       33 
33 
     | 
    
         
             
                  @env = RBS::Environment.from_loader(env_loader)
         
     | 
| 
       34 
     | 
    
         
            -
                  project = Steep::Project.new(steepfile_path: Pathname.new( 
     | 
| 
      
 34 
     | 
    
         
            +
                  project = Steep::Project.new(steepfile_path: Pathname.new(src_dir).realpath)
         
     | 
| 
       35 
35 
     | 
    
         
             
                  project.targets << @steep_target
         
     | 
| 
       36 
36 
     | 
    
         
             
                  loader = Steep::Project::FileLoader.new(project: project)
         
     | 
| 
       37 
37 
     | 
    
         
             
                  #loader.load_signatures
         
     | 
    
        data/src/lib/gloss/version.gl
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: gloss
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - johansenja
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-04-01 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: fast_blank
         
     |