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

Add ImportLocation to SymbolToken #12

Merged
merged 5 commits into from
Dec 17, 2019

Conversation

avneet-toor-bq
Copy link
Contributor

No description provided.

@avneet-toor-bq avneet-toor-bq changed the title Initial commit. Add ImportLocation to SymbolToken Dec 4, 2019
@avneet-toor-bq avneet-toor-bq force-pushed the token-latest-fix branch 2 times, most recently from 4752d00 to e52f9d8 Compare December 9, 2019 21:47
IonDotnet/ImportLocation.cs Outdated Show resolved Hide resolved
IonDotnet/ImportLocation.cs Show resolved Hide resolved
IonDotnet/SymbolToken.cs Outdated Show resolved Hide resolved
IonDotnet/SymbolToken.cs Outdated Show resolved Hide resolved
IonDotnet/Internals/SharedSymbolTable.cs Outdated Show resolved Hide resolved
IonDotnet/Internals/Text/RawTextReader.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@tgregg tgregg left a comment

Choose a reason for hiding this comment

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

This is looking good. Here are two bits of logic I don't see in here:

  1. When the reader encounters a symbol ID that occurs within a shared symbol table but that shared symbol table is not resolved in the catalog, the reader should return a SymbolToken with null text and an ImportLocation that identifies the name and SID in the unresolved shared symbol table.
  2. When the writer is provided with a SymbolToken with null text and with a valid ImportLocation, it should calculate the local symbol ID from the import symbol ID and write the local symbol ID.

This can be done in a separate CR if your prefer.

IonDotnet.Tests/Internals/SymbolTokenTest.cs Outdated Show resolved Hide resolved
IonDotnet/Internals/ReaderLocalTable.cs Outdated Show resolved Hide resolved
IonDotnet/Internals/ReaderLocalTable.cs Outdated Show resolved Hide resolved
IonDotnet/Internals/SharedSymbolTable.cs Outdated Show resolved Hide resolved
@avneet-toor-bq
Copy link
Contributor Author

This is looking good. Here are two bits of logic I don't see in here:

  1. When the reader encounters a symbol ID that occurs within a shared symbol table but that shared symbol table is not resolved in the catalog, the reader should return a SymbolToken with null text and an ImportLocation that identifies the name and SID in the unresolved shared symbol table.
  2. When the writer is provided with a SymbolToken with null text and with a valid ImportLocation, it should calculate the local symbol ID from the import symbol ID and write the local symbol ID.

This can be done in a separate CR if your prefer.

Sure.

@tgregg
Copy link
Contributor

tgregg commented Dec 16, 2019

This is looking good. Here are two bits of logic I don't see in here:

  1. When the reader encounters a symbol ID that occurs within a shared symbol table but that shared symbol table is not resolved in the catalog, the reader should return a SymbolToken with null text and an ImportLocation that identifies the name and SID in the unresolved shared symbol table.
  2. When the writer is provided with a SymbolToken with null text and with a valid ImportLocation, it should calculate the local symbol ID from the import symbol ID and write the local symbol ID.

This can be done in a separate CR if your prefer.

Sure.

I've created #31 for this.

Copy link
Contributor

@tgregg tgregg left a comment

Choose a reason for hiding this comment

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

Approving, pending the one comment below.

@@ -704,8 +704,8 @@ public IEnumerable<SymbolToken> GetTypeAnnotations()
throw new UnknownSymbolException(a.Sid);
}

var text = symtab.FindKnownSymbol(a.Sid);
yield return new SymbolToken(text, a.Sid);
var text = symtab.FindKnownSymbol(a.ImportLocation.Sid);
Copy link
Contributor

Choose a reason for hiding this comment

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

One last thing, and then this is good to go:
Line 699 should be if (a.Text is null && a.ImportLocation != null) since we're relying on ImportLocation now and not local SID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you mean if (a.Text is null && a.ImportLocation != default)? Or is null what we are checking for in this instance?

Copy link
Contributor

Choose a reason for hiding this comment

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

We want to know if a.ImportLocation is specified. If a.ImportLocation != default is the correct way to do that, then yes that's what I mean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@tgregg tgregg merged commit 1519607 into amazon-ion:master Dec 17, 2019
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