about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2019-01-23 21:39:15 +0100
committerDavid Wood <david@davidtw.co>2019-01-23 21:39:15 +0100
commit8ab12f6cc06033f483d085b37b766d681dcc61ca (patch)
treecc6c44cd4045b90a09ef94cfb3b9f8faa0b9c6c4 /src/rustllvm/RustWrapper.cpp
parent22f794b00fa8d84c9e827f8c8af762ee60074a8a (diff)
downloadrust-8ab12f6cc06033f483d085b37b766d681dcc61ca.tar.gz
rust-8ab12f6cc06033f483d085b37b766d681dcc61ca.zip
Optimize snapshot usage.
This commit implements a suggestion from @estebank that optimizes the
use of snapshots.

Instead of creating a snapshot for each recursion in `parse_path_segment`
and then replacing `self` with them until the first invocation where if
leading angle brackets are detected, `self` is not replaced and instead the
snapshot is used to inform how parsing should continue.

Now, a snapshot is created in the first invocation that acts as a backup
of the parser state before any generic arguments are parsed (and
therefore, before recursion starts). This backup replaces `self` if after
all parsing of generic arguments has concluded we can determine that
there are leading angle brackets. Parsing can then proceed from the
backup state making use of the now known number of unmatched leading
angle brackets to recover.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions