Skip to content

CurrentObjectExpression

INCLUDE FILE
#include "Expression/CurrentObjectExpression.h"

class CurrentObjectExpression

Represents an expression referring to the current object.

DEFINITION
class CurrentObjectExpression;

constructor CurrentObjectExpression

Constructs a CurrentObjectExpression.

DEFINITION
CurrentObjectExpression ( const Location & location );
PARAMETERDESCRIPTION
location

The location of the expression in the source code.

method createstatic

Creates a new CurrentObjectExpression.

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

The location of the expression in the source code.

RETURNSDESCRIPTION
Expression

A new CurrentObjectExpression.

method evaluatevirtual

Evaluate the expression in the given context.

The default implementation calls evaluate() on all sub-expressions using traverse(), and then calls evaluate_process().

Errors during evaluation should either be reported via DiagnosticOutput and result in the expression being marked as invalid, or an exception should be thrown.

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

The evaluation context.

RETURNSDESCRIPTION
std::optional< Expression >

The Expression to replace this expression with, {} if no replacement is needed.

method resolvevirtual

Resolve all names in the expression.

The default implementation calls resolve() on all sub-expressions using traverse().

If a name cannot be resolved, either an error should be reported via DiagnosticOutput and the expression marked as invalid, or an exception should be thrown.

DEFINITION
virtual void  resolve ( Scope * scope,
Entity * containing_entity );
PARAMETERDESCRIPTION
scope

The scope to resolve names in.

containing_entity

The entity that contains the expression.

method serialize_subconst virtual

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.

method typeconst virtual

Get the type of the expression's value.

The default implementation returns the type of the value of the expression if it is known, or {} otherwise. Subclasses should override this method if they can determine the type of the expression without knowing the exact value of the expression.

DEFINITION
virtual std::optional< Value::Type >  type ( ) const;
RETURNSDESCRIPTION
std::optional< Value::Type >

The type of the expression's value if it can be determined, {} otherwise.

member current_object_symbolstatic private

DEFINITION
static Symbol  current_object_symbol;

member variable_expressionprivate

DEFINITION
Expression  variable_expression;