1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Look up the language module

Look up language module with `MakeMakefile.[]`, insted of a
accessing constant under that module directly, to get rid of
expose the constant to the toplevel inadvertently.
This commit is contained in:
Nobuyoshi Nakada 2019-09-18 23:31:53 +09:00
parent 15d5de59fb
commit 842f600a93
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 12 additions and 2 deletions

View file

@ -1,6 +1,6 @@
# frozen_string_literal: false
cxx = MakeMakefile::CXX
cxx = MakeMakefile["C++"]
ok = cxx.try_compile(<<~'begin', "") do |x|
#include "ruby/config.h"

View file

@ -2776,7 +2776,17 @@ distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
realclean: distclean
"
module CXX
@lang = Hash.new(self)
def self.[](name)
@lang.fetch(name)
end
def self.[]=(name, mod)
@lang[name] = mod
end
self["C++"] = Module.new do
include MakeMakefile
extend self