Skip to content

Commit b9adc4a

Browse files
committed
Core files can now work with frozen string literals, both from magic comments and from the CLI option.
1 parent 45da015 commit b9adc4a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Changes:
2828
Performance:
2929

3030
* Sped up accesses to native memory through FFI::Pointer.
31+
* All core files now make use of frozen `String` literals, reducing the number
32+
of `String` allocations for core methods.
3133

3234
# 1.0 RC 10
3335

src/main/java/org/truffleruby/parser/BodyTranslator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,10 +2880,7 @@ public RubyNode visitStrNode(StrParseNode node) {
28802880
final Rope rope = context.getRopeCache().getRope(node.getValue(), node.getCodeRange());
28812881
final RubyNode ret;
28822882

2883-
// isFrozen() is set with the magic frozen_string_literal comment or the command line flag.
2884-
// For the command line flag, we do not want to apply it to the core library files.
2885-
// TODO (eregon, 28 Feb 2018): we should respect the magic comment in core (although not used currently).
2886-
if (node.isFrozen() && !inCore()) {
2883+
if (node.isFrozen()) {
28872884
final DynamicObject frozenString = context.getFrozenStringLiteral(rope);
28882885

28892886
ret = new DefinedWrapperNode(context.getCoreStrings().EXPRESSION,

0 commit comments

Comments
 (0)