Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following changes were made in this PR for initial support of dictionaries in Lox:
["a": 1, "b": 2]
LoxValue
can be a dictionary key, it needed to beHashable
sinceLoxDictionary
uses Swift dictionary as a backend for managing key/value pairsLoxValue
including those associated withUserDefinedFunction
s. And so I introduced anobjectId
property with aUUID
type that accomplishes the task==
forExpression
andResolvedExpression
because lists of tuples are not automaticallyEquatable
.Equatable
conformance for expressions and statements, and their resolved counterparts, is necessary only for unit testsInterpreter
count
,keys
, andvalues
, as well as native methodsremoveValue()
andmerge()
Interpreter.makeDictionary()
that is used both in the context of the interpreter as well as for unit tests