Skip to content

FillExpression

class FillExpression

Expression representing a sequence of repeated values: .fill(count, value).

DEFINITION
class FillExpression;

constructor FillExpression

Create a fill expression.

DEFINITION
FillExpression ( const Location & location,
Expression  count,
Expression  value );
PARAMETERDESCRIPTION
location

The location of the expression in the source code.

count

The expression representing the number of repetitions.

value

The expression representing the value to repeat.

method createstatic

Create an expression representing a FillExpression from arguments.

This may not create a FillExpression if the expression can be simplified.

DEFINITION
static Expression  create ( const Location & location,
const std::vector< Expression > & arguments );
PARAMETERDESCRIPTION
location

The location of the expression in the source code.

arguments

The arguments of the expression. Must contain exactly two expressions: the count and the value.

RETURNSDESCRIPTION
Expression

The created expression.

THROWSDESCRIPTION
LocationException

If the number of arguments is not exactly two or the first argument is not an unsigned integer expression.

method createstatic

Create an expression representing a FillExpression.

This may not create a FillExpression if the expression can be simplified.

DEFINITION
static Expression  create ( const Location & location,
const Expression & count,
const Expression & value );
PARAMETERDESCRIPTION
location

The location of the expression in the source code.

count

The expression representing the number of repetitions.

value

The expression representing the value to repeat.

RETURNSDESCRIPTION
Expression

The created expression.

THROWSDESCRIPTION
LocationException

If the first argument is not an unsigned integer expression.

method evaluatedconstvirtual

DEFINITION
virtual std::optional< Expression >  evaluated ( const EvaluationContext & context ) const;
PARAMETERDESCRIPTION
context
RETURNSDESCRIPTION
std::optional< Expression >

method serialize_subconstvirtual

Serialize the expression to a stream.

This method must be implemented by derived classes.

DEFINITION
virtual void  serialize_sub ( std::ostream & stream ) const;
PARAMETERDESCRIPTION
stream

The stream to serialize to.