Skip to content

Commit ecca2be

Browse files
committed
Handle language options in Truffle::Boot.get_option
1 parent 1a0c802 commit ecca2be

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/org/truffleruby/language/TruffleBootNodes.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,16 @@ protected Object getOption(Object optionName,
318318

319319
final String optionNameString = libOptionName.getJavaString(optionName);
320320
final OptionDescriptor descriptor = OptionsCatalog.fromName("ruby." + optionNameString);
321-
322321
if (descriptor == null) {
323322
throw new RaiseException(
324323
getContext(),
325324
coreExceptions().nameError("option not defined", nil, optionNameString, this));
326325
}
327326

328-
final Object value = getContext().getOptions().fromDescriptor(descriptor);
327+
Object value = getContext().getOptions().fromDescriptor(descriptor);
328+
if (value == null) {
329+
value = getLanguage().options.fromDescriptor(descriptor);
330+
}
329331

330332
if (value instanceof Boolean || value instanceof Integer) {
331333
return value;
@@ -336,7 +338,8 @@ protected Object getOption(Object optionName,
336338
} else if (value instanceof String[]) {
337339
return toRubyArray((String[]) value);
338340
} else {
339-
throw CompilerDirectives.shouldNotReachHere();
341+
throw CompilerDirectives
342+
.shouldNotReachHere("Unknown value for option " + optionNameString + ": " + value);
340343
}
341344
}
342345

0 commit comments

Comments
 (0)