Skip to content

Commit 2408aa8

Browse files
committed
Document some metadata setup
1 parent 2845e01 commit 2408aa8

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/main/java/org/jruby/prism/parser/ParserPrismBase.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,17 @@ private void appendUnsignedInt(ByteList buf, int value) {
250250
buf.append(value >>> 24);
251251
}
252252

253-
private byte[] encodeEvalScopes(ByteList buf, StaticScope scope) {
253+
private void encodeEvalScopes(ByteList buf, StaticScope scope) {
254254
int startIndex = buf.realSize();
255+
256+
// append uint 0 to reserve the space
255257
appendUnsignedInt(buf, 0);
258+
259+
// write the scopes to the buffer
256260
int count = encodeEvalScopesInner(buf, scope, 1);
261+
262+
// overwrite int 0 with scope count
257263
writeUnsignedInt(buf, startIndex, count);
258-
return buf.bytes();
259264
}
260265

261266
private int encodeEvalScopesInner(ByteList buf, StaticScope scope, int count) {
@@ -265,8 +270,13 @@ private int encodeEvalScopesInner(ByteList buf, StaticScope scope, int count) {
265270

266271
// once more for method scope
267272
String names[] = scope.getVariables();
273+
274+
// number of variables
268275
appendUnsignedInt(buf, names.length);
276+
277+
// forwarding flags
269278
buf.append(0);
279+
270280
for (String name : names) {
271281
// Get the bytes "raw" (which we use ISO8859_1 for) as this is how we record these in StaticScope.
272282
byte[] bytes = name.getBytes(ISO8859_1Encoding.INSTANCE.getCharset());

0 commit comments

Comments
 (0)