Skip to content

Commit 5059526

Browse files
authored
Merge pull request #2839 from ruby/reduce-surface-area
Reduce surface area
2 parents b863f9a + 4d8929f commit 5059526

32 files changed

Lines changed: 369 additions & 1323 deletions

Steepfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ target :lib do
88
check "lib"
99

1010
# TODO: Type-checking these files is still WIP
11-
ignore "lib/prism/debug.rb"
1211
ignore "lib/prism/desugar_compiler.rb"
1312
ignore "lib/prism/lex_compat.rb"
1413
ignore "lib/prism/serialize.rb"

bin/prism

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ module Prism
1515
when "encoding" then encoding(argv)
1616
when "lex" then lex(argv)
1717
when "locals" then locals(argv)
18-
when "memsize" then memsize
1918
when "parse" then parse(argv)
2019
when "parser" then parser(argv)
2120
when "ripper" then ripper(argv)
@@ -30,7 +29,6 @@ module Prism
3029
bin/prism encoding [encoding]
3130
bin/prism lex [source]
3231
bin/prism locals [source]
33-
bin/prism memsize
3432
bin/prism parse [source]
3533
bin/prism parser [source]
3634
bin/prism ripper [source]
@@ -246,35 +244,6 @@ module Prism
246244
end
247245
end
248246

249-
# bin/prism memsize
250-
def memsize
251-
require "yaml"
252-
253-
filepath = File.expand_path("../config.yml", __dir__)
254-
results =
255-
YAML.load_file(filepath).fetch("nodes").map do |node|
256-
[
257-
node["name"],
258-
node.fetch("fields", []).sum do |field|
259-
case field["type"]
260-
when "uint8" then 1
261-
when "uint32", "constant", "constant?" then 4
262-
when "node", "node?", "double" then 8
263-
when "location", "location?" then 16
264-
when "node[]", "string", "token", "token?", "constant[]" then 24
265-
when "integer" then 32
266-
when "flags" then 0
267-
else raise "Unknown type: #{field["type"]}"
268-
end
269-
end
270-
]
271-
end
272-
273-
results.sort_by(&:last).reverse_each do |name, size|
274-
puts "#{name}: #{size}"
275-
end
276-
end
277-
278247
# bin/prism parser [source]
279248
def parser(argv)
280249
require "parser/ruby34"

0 commit comments

Comments
 (0)