Skip to content

Commit 0978735

Browse files
eregonandrykonchin
authored andcommitted
Have a single caller for setSourceCharIndex/setSourceLength
1 parent c5dfc10 commit 0978735

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,17 @@ public void unsafeSetSourceSection(SourceIndexLength sourceIndexLength) {
8989
assert !hasSource();
9090

9191
if (sourceIndexLength != null) {
92-
setSourceCharIndex(sourceIndexLength.getCharIndex());
93-
setSourceLength(sourceIndexLength.getLength());
92+
unsafeSetSourceSection(sourceIndexLength.getCharIndex(), sourceIndexLength.getLength());
9493
}
9594
}
9695

9796
public void unsafeSetSourceSection(SourceSection sourceSection) {
9897
assert !hasSource();
9998

10099
if (sourceSection.isAvailable()) {
101-
setSourceCharIndex(sourceSection.getCharIndex());
102-
setSourceLength(sourceSection.getCharLength());
100+
unsafeSetSourceSection(sourceSection.getCharIndex(), sourceSection.getCharLength());
103101
} else {
104-
setSourceCharIndex(0);
105-
setSourceLength(SourceIndexLength.UNAVAILABLE);
102+
unsafeSetSourceSection(0, SourceIndexLength.UNAVAILABLE);
106103
}
107104
}
108105

@@ -115,8 +112,7 @@ public void unsafeSetSourceSection(int charIndex, int sourceLength) {
115112

116113
public RubyNode copySourceSection(RubyNode from) {
117114
if (from.hasSource()) {
118-
setSourceCharIndex(from.getSourceCharIndex());
119-
setSourceLength(from.getSourceLength());
115+
unsafeSetSourceSection(from.getSourceCharIndex(), from.getSourceLength());
120116
}
121117
return this;
122118
}

0 commit comments

Comments
 (0)