Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forchapeatl type meta #1825

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Forchapeatl
Copy link
Contributor

What does this PR do?

Related issues

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

@@ -44,6 +48,8 @@ export default class {
this.referenceResolver = new ReferenceResolver(this.binaryReader);
this.classResolver.init(this);
this.anySerializer = new AnySerializer(this);
this.typeMeta = new TypeMeta(BigInt(0),[]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from_bytes in TypeMeta is a static method, if you want to call it, you should replace by this.typeMeta = TypeMeta

return `
${this.builder.writer.int32(expectHash)};
${this.builder.writer.buffer(`Buffer.from("${metaInformation.toString("base64")}", "base64")`)};
${this.builder.writer.buffer(binaryBase64)};
Copy link
Member

@theweipeng theweipeng Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the base64 string is "AQAAAAAAAAACgATsEgsABQg="
the code you generated will be bw.buffer(AQAAAAAAAAACgATsEgsABQg=); it includes syntax error

@Forchapeatl
Copy link
Contributor Author

Hi @theweipeng on line 147 , when I do this

-    ${this.builder.typeMeta.from_bytes(this.builder.reader.ownName())}
+   ${this.builder.reader.buffer(buffer.byteLength)}

I pass 3 test
Screenshot from 2024-09-14 09-25-13

Please for a hint on what I am missing.

@theweipeng
Copy link
Member

Hi @theweipeng on line 147 , when I do this

-    ${this.builder.typeMeta.from_bytes(this.builder.reader.ownName())}

+   ${this.builder.reader.buffer(buffer.byteLength)}

I pass 3 test

Screenshot from 2024-09-14 09-25-13

Please for a hint on what I am missing.

Why did you remove reading the typeMeta? I am confused

@Forchapeatl
Copy link
Contributor Author

Forchapeatl commented Sep 19, 2024

Why did you remove reading the typeMeta? I am confused

@theweipeng I was just experimenting . After solving the syntax error, I was trying to figure out a way to pass the tests.

@theweipeng
Copy link
Member

Hi @theweipeng on line 147 , when I do this

-    ${this.builder.typeMeta.from_bytes(this.builder.reader.ownName())}

+   ${this.builder.reader.buffer(buffer.byteLength)}

I pass 3 test
Screenshot from 2024-09-14 09-25-13
Please for a hint on what I am missing.

Why did you remove reading the typeMeta? I am confused

Ensure that the byte length consumed from the reader matches the length written to the buffer in the writeStmt. In the context of your code, it should be expressed as ${this.builder.reader.buffer(buffer2.byteLength)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants