|
Bash++
Bash++ compiler internal documentation
|
Represents the expectations for the current parsing context. More...
#include <ContextExpectations.h>
Public Attributes | |
| bool | can_take_primitive = true |
| bool | can_take_object = false |
Represents the expectations for the current parsing context.
Copyright (C) 2025 rail5 Bash++: Bash with classes
can_take_primitive: Whether a primitive value is acceptable in the current context can_take_object: Whether a non-primitive object is acceptable in the current context
In the event that a non-primitive object is referenced in a place where only a primitive is acceptable, The Bash++ spec says that the .toPrimitive method should be called automatically.
Further: There are only three cases in which a non-primitive object can be used directly (without conversion to a primitive), And there is only one case in which a primitive cannot be used directly.
The three cases in which a non-primitive object can be used directly are:
The one case in which a primitive cannot be used directly is as the rvalue in a non-primitive assignment. I.e., @nonPrimitiveObject="primitive value"
In all other contexts: primitives are acceptable, and non-primitives are unacceptable.
| bool ContextExpectations::can_take_object = false |
| bool ContextExpectations::can_take_primitive = true |