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

Make TokenStream less recursive. #57004

Merged
merged 1 commit into from
Jan 13, 2019
Merged

Commits on Jan 8, 2019

  1. Make TokenStream less recursive.

    `TokenStream` is currently recursive in *two* ways:
    
    - the `TokenTree` variant contains a `ThinTokenStream`, which can
      contain a `TokenStream`;
    
    - the `TokenStream` variant contains a `Vec<TokenStream>`.
    
    The latter is not necessary and causes significant complexity. This
    commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`.
    
    This reduces complexity significantly. In particular, `StreamCursor` is
    eliminated, and `Cursor` becomes much simpler, consisting now of just a
    `TokenStream` and an index.
    
    The commit also removes the `Extend` impl for `TokenStream`, because it
    is only used in tests. (The commit also removes those tests.)
    
    Overall, the commit reduces the number of lines of code by almost 200.
    nnethercote committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    e80a930 View commit details
    Browse the repository at this point in the history