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:
parent
15d5de59fb
commit
842f600a93
2 changed files with 12 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
|
|
||||||
cxx = MakeMakefile::CXX
|
cxx = MakeMakefile["C++"]
|
||||||
|
|
||||||
ok = cxx.try_compile(<<~'begin', "") do |x|
|
ok = cxx.try_compile(<<~'begin', "") do |x|
|
||||||
#include "ruby/config.h"
|
#include "ruby/config.h"
|
||||||
|
|
12
lib/mkmf.rb
12
lib/mkmf.rb
|
@ -2776,7 +2776,17 @@ distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
||||||
realclean: distclean
|
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
|
include MakeMakefile
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue