Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Decode is not the inverse of encode #197

@ncordon

Description

@ncordon

This should hold for the binary format, but a minimal example shows that the bytes are not preserved:

from bblfsh import *
file = "fixtures/test.py"
client = BblfshClient("localhost:9432")
ctx = client.parse(file)
root = ctx.root.get()
pyCtx = context(root)

originalBytes = ctx._response.uast
encodedBytes = pyCtx.encode(fmt = 0)
# This is false
originalBytes == encodedBytes

# This is true
decode(encodedBytes).load() == root

For more context, check out scala-client#127. Problem may lie here, where we are not returning NODE_UINT in any case. In the scala-client we do return NODE_UINT for some cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions