lib/tapioca/compilers/symbol_table/symbol_loader.rb in tapioca-0.3.1 vs lib/tapioca/compilers/symbol_table/symbol_loader.rb in tapioca-0.4.0
- old
+ new
@@ -1,19 +1,15 @@
# frozen_string_literal: true
# typed: true
require 'json'
-require 'pathname'
require 'tempfile'
-require 'shellwords'
module Tapioca
module Compilers
module SymbolTable
module SymbolLoader
- SORBET = Pathname.new(Gem::Specification.find_by_name("sorbet-static").full_gem_path) / "libexec" / "sorbet"
-
class << self
extend(T::Sig)
sig { params(paths: T::Array[Pathname]).returns(T::Set[String]) }
def list_from_paths(paths)
@@ -51,25 +47,10 @@
@ignored_symbols
end
def symbol_table_json_from(input, table_type: "symbol-table-json")
- IO.popen(
- [
- sorbet_path,
- # We don't want to pick up any sorbet/config files in cwd
- "--no-config",
- "--print=#{table_type}",
- "--quiet",
- input,
- ].join(' '),
- err: "/dev/null"
- ).read
- end
-
- sig { returns(String) }
- def sorbet_path
- SORBET.to_s.shellescape
+ Tapioca::Compilers::Sorbet.run("--no-config", "--print=#{table_type}", input)
end
end
class SymbolTableParser
def self.parse(object, parents = [])