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

Deterministic variable ordering, version 1.2.0 #244

merged 3 commits into from Apr 8, 2019


None yet
2 participants
Copy link

Protryon commented Apr 8, 2019

Allows deterministic ordering after being used in a HashMap/HashTable/other non-deterministic structure.

@Protryon Protryon requested a review from bakkot Apr 8, 2019

@@ -407,12 +442,13 @@ private State(
this.atsForParent = atsForParent;
this.potentiallyVarScopedFunctionDeclarations = potentiallyVarScopedFunctionDeclarations;
this.hasParameterExpressions = hasParameterExpressions;
this.counter = counter;

This comment has been minimized.

Copy link

bakkot Apr 8, 2019


nit: as this is the first parameter, it should be the first line of the constructor (for all constructors which take it).

@@ -484,11 +525,15 @@ private State finish(@Nonnull Node astNode, @Nonnull Scope.Type scopeType, boole
case ParameterExpression:
// resolve only block-scoped free declarations
ImmutableList<Variable> variables3 = variables;
for (Pair<String, ImmutableList<Declaration>> entry2 : this.blockScopedDeclarations.merge(this.functionDeclarations, ImmutableList::append).entries()) {
ImmutableList<Pair<String, ImmutableList<Declaration>>> declarationEntries = this.blockScopedDeclarations.merge(this.functionDeclarations, ImmutableList::append).entries();
List<Pair<String, ImmutableList<Declaration>>> declarationEntriesSorted =, Spliterator.ORDERED), false)

This comment has been minimized.

Copy link

bakkot Apr 8, 2019


It might be cleaner to dedupe the three places this pattern occurs (List declarationEntriesSorted = ...; for ...; into a static method.

@Protryon Protryon force-pushed the variable-ordering branch from 5399d33 to 418cb5d Apr 8, 2019

@Protryon Protryon changed the title Deterministic variable ordering Deterministic variable ordering, version 1.2.0 Apr 8, 2019


bakkot approved these changes Apr 8, 2019

@bakkot bakkot merged commit 3fff462 into es2017 Apr 8, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed

@bakkot bakkot deleted the variable-ordering branch Apr 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.