Skip to content

Commit

Permalink
Use the new writeNetString api
Browse files Browse the repository at this point in the history
  • Loading branch information
qti3e committed Aug 10, 2019
1 parent 00ba16d commit f2ae932
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
10 changes: 2 additions & 8 deletions jsc/src/scope.ts
Expand Up @@ -24,19 +24,13 @@ export class Scope {
addFunction(name: string, id: number): void {
this.buffer.writeUint16(++this.num, 0);
this.buffer.put(1);
// TODO(qti3e) This is wrong... name.length is not the
// same as number of bytes.
this.buffer.writeUint16(name.length);
this.buffer.writeString(name);
this.buffer.writeNetString16(name);
this.buffer.writeUint16(id);
}

addVariable(name: string): void {
this.buffer.writeUint16(++this.num, 0);
this.buffer.put(0);
// TODO(qti3e) This is wrong... name.length is not the
// same as number of bytes.
this.buffer.writeUint16(name.length);
this.buffer.writeString(name);
this.buffer.writeNetString16(name);
}
}
3 changes: 1 addition & 2 deletions jsc/src/writer.ts
Expand Up @@ -51,8 +51,7 @@ export class Writer {

if (constantPoolData) {
const index = this.constantPool.getCursor();
this.constantPool.writeInt16(constantPoolData.length);
this.constantPool.writeString(constantPoolData);
this.constantPool.writeNetString16(constantPoolData);
this.codeSection.writeUint32(index);
}
}
Expand Down

0 comments on commit f2ae932

Please sign in to comment.