ValMap<T> class
ValMap represents a MiniScript map, which under the hood is just a Dictionary of Value, Value pairs.
Constructors
- ValMap([Dictionary? map])
Properties
- assignOverride ↔ bool Function(Value? key, Value? value)?
-
Assignment override function: return true to cancel (override)
the assignment, or false to allow it to happen as normal.
getter/setter pair
- count → int
-
Get the number of entries in this map.
no setter
-
evalOverride
↔ bool Function(Value? key, ValuePointer<
Value> valuePointer)? -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keys
→ List<
Value?> -
Return the keys list for this map.
no setter
- map ↔ Dictionary
-
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userData ↔ T?
-
getter/setter pair
Methods
-
boolValue(
) → bool -
A map is considered true if it is nonempty.
override
-
canSetElem(
) → bool -
Can we set elements within this value? (I.e., is it a list or map?)
override
-
codeForm(
Machine? vm, {int recursionLimit = -1}) → String -
Get this value in the form of a MiniScript literal.
override
-
containsKey(
Value? key) → bool - Convenience method to check whether this map contains a given key (of arbitrary type).
-
containsKeyWithIdentifier(
String identifier) → bool - Convenience method to check whether the map contains a given string key.
-
doubleValue(
) → double -
Get the numeric value of this Value as a double-precision floating-point number.
inherited
-
equality(
Value? rhs) → double -
Check whether this Value is equal to another Value.
override
-
evalCopy(
Context context) → ValMap -
floatValue(
) → double -
Get the numeric value of this Value as a single-precision float.
inherited
-
fullEval(
Context context) → Value -
Similar to Val, but recurses into the sub-values contained by this
value (if it happens to be a container, such as a list or map).
override
-
getKeyValuePair(
int index) → ValMap - Get the indicated key/value pair as another map containing "key" and "value". (This is used when iterating over a map with "for".)
-
hash(
) → int -
Get a hash value for this Value. Two values that are considered
equal will return the same hash value.
override
-
intValue(
) → int -
Get the numeric value of this Value as an integer.
inherited
-
isA(
Value? type, Machine vm) → bool -
Return whether this value is the given type (or some subclass thereof)
in the context of the given virtual machine.
override
-
lookup(
Value? key, ValuePointer< Value> valueFoundIn) → Value? - Look up a value in this dictionary, walking the __isa chain to find it in a parent object if necessary.
-
lookupWithMap(
Value? key, ValuePointer< ValMap> valueFoundIn) → Value? - Look up a value in this dictionary, walking the __isa chain to find it in a parent object if necessary; return both the value found and (via the output parameter) the map it was found in.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recursiveEqual(
Value rhs) → bool -
Compare lhs and rhs for equality, in a way that traverses down
the tree when it finds a list or map. For any other type, this
just calls through to the regular Equality method.
inherited
-
recursiveHash(
) → int -
Hash function that works correctly with nested lists and maps.
inherited
-
setElem(
Value? index, Value? value) → void -
Set the value associated with the given key (index). This is where
we take the opportunity to look for an assignment override function,
and if found, give that a chance to handle it instead.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
toStringWithVM(
[Machine? vm]) → String -
override
-
tryGetValue(
Value key, ValuePointer< Value> valuePointer) → bool - Look up the given identifier as quickly as possible, without walking the __isa chain or doing anything fancy. (This is used when looking up local variables.)
-
tryGetValueWithIdentifier(
String identifier, ValuePointer< Value> value) → bool - Look up the given identifier in the backing map (unless overridden by the evalOverride function).
-
uintValue(
) → int -
Get the numeric value of this Value as an unsigned integer.
inherited
-
val(
Context context) → Value? -
Get the current value of this Value in the given context. Basic types
evaluate to themselves, but some types (e.g. variable references) may
evaluate to something else.
inherited
-
valWithMap(
Context context, ValuePointer< ValMap> valueFoundIn) → Value? -
This version of Val is like the one above, but also returns
(via the output parameter) the ValMap the value was found in,
which could be several steps up the __isa chain.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String identifier) → Value? - Accessor to get/set on element of this map by a string key, walking the __isa chain as needed. (Note that if you want to avoid that, then simply look up your value in .map directly.)
-
operator []=(
String identifier, Value? value) → void
Constants
- maxIsaDepth → const int
- Define a maximum depth we will allow an inheritance ("__isa") chain to be. This is used to avoid locking up the app if some bozo creates a loop in the __isa chain, but it also means we can't allow actual inheritance trees to be longer than this. So, use a reasonably generous value.