Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
SkSL::VariableReference Class Referencefinal

#include <SkSLVariableReference.h>

Inheritance diagram for SkSL::VariableReference:
SkSL::Expression SkSL::IRNode SkSL::Poolable

Public Types

using RefKind = VariableRefKind
 
- Public Types inherited from SkSL::Expression
enum class  ComparisonResult { kUnknown = -1 , kNotEqual , kEqual }
 
using Kind = ExpressionKind
 

Public Member Functions

 VariableReference (Position pos, const Variable *variable, RefKind refKind)
 
 VariableReference (const VariableReference &)=delete
 
VariableReferenceoperator= (const VariableReference &)=delete
 
const Variablevariable () const
 
RefKind refKind () const
 
void setRefKind (RefKind refKind)
 
void setVariable (const Variable *variable)
 
std::unique_ptr< Expressionclone (Position pos) const override
 
std::string description (OperatorPrecedence) const override
 
- Public Member Functions inherited from SkSL::Expression
 Expression (Position pos, Kind kind, const Type *type)
 
Kind kind () const
 
const Typetype () const
 
bool isAnyConstructor () const
 
bool isIntLiteral () const
 
bool isFloatLiteral () const
 
bool isBoolLiteral () const
 
AnyConstructorasAnyConstructor ()
 
const AnyConstructorasAnyConstructor () const
 
bool isIncomplete (const Context &context) const
 
virtual ComparisonResult compareConstant (const Expression &other) const
 
CoercionCost coercionCost (const Type &target) const
 
virtual bool supportsConstantValues () const
 
virtual std::optional< double > getConstantValue (int n) const
 
virtual std::unique_ptr< Expressionclone (Position pos) const =0
 
std::unique_ptr< Expressionclone () const
 
std::string description () const final
 
virtual std::string description (OperatorPrecedence parentPrecedence) const =0
 
- Public Member Functions inherited from SkSL::IRNode
virtual ~IRNode ()
 
virtual std::string description () const =0
 
 IRNode (const IRNode &)=delete
 
IRNodeoperator= (const IRNode &)=delete
 
Position position () const
 
void setPosition (Position p)
 
template<typename T >
bool is () const
 
template<typename T >
const Tas () const
 
template<typename T >
Tas ()
 

Static Public Member Functions

static std::unique_ptr< ExpressionMake (Position pos, const Variable *variable, RefKind refKind=RefKind::kRead)
 
- Static Public Member Functions inherited from SkSL::Poolable
static void * operator new (const size_t size)
 
static void operator delete (void *ptr)
 

Static Public Attributes

static constexpr Kind kIRNodeKind = Kind::kVariableReference
 

Additional Inherited Members

- Public Attributes inherited from SkSL::IRNode
Position fPosition
 
- Protected Member Functions inherited from SkSL::IRNode
 IRNode (Position position, int kind)
 
- Protected Attributes inherited from SkSL::IRNode
int fKind
 

Detailed Description

A reference to a variable, through which it can be read or written. In the statement:

x = x + 1;

there is only one Variable 'x', but two VariableReferences to it.

Definition at line 41 of file SkSLVariableReference.h.

Member Typedef Documentation

◆ RefKind

Definition at line 43 of file SkSLVariableReference.h.

Constructor & Destructor Documentation

◆ VariableReference() [1/2]

SkSL::VariableReference::VariableReference ( Position  pos,
const Variable variable,
RefKind  refKind 
)

Definition at line 14 of file SkSLVariableReference.cpp.

15 : INHERITED(pos, kIRNodeKind, &variable->type())
16 , fVariable(variable)
17 , fRefKind(refKind) {
18 SkASSERT(this->variable());
19}
SkPoint pos
#define SkASSERT(cond)
Definition: SkAssert.h:116
const Type & type() const
Definition: SkSLSymbol.h:42
const Variable * variable() const
static constexpr Kind kIRNodeKind

◆ VariableReference() [2/2]

SkSL::VariableReference::VariableReference ( const VariableReference )
delete

Member Function Documentation

◆ clone()

std::unique_ptr< Expression > SkSL::VariableReference::clone ( Position  pos) const
inlineoverridevirtual

Implements SkSL::Expression.

Definition at line 72 of file SkSLVariableReference.h.

72 {
73 return std::make_unique<VariableReference>(pos, this->variable(), this->refKind());
74 }

◆ description()

std::string SkSL::VariableReference::description ( OperatorPrecedence  ) const
overridevirtual

Implements SkSL::Expression.

Definition at line 21 of file SkSLVariableReference.cpp.

21 {
22 return std::string(this->variable()->name());
23}
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ Make()

static std::unique_ptr< Expression > SkSL::VariableReference::Make ( Position  pos,
const Variable variable,
RefKind  refKind = RefKind::kRead 
)
inlinestatic

Definition at line 51 of file SkSLVariableReference.h.

53 {
55 return std::make_unique<VariableReference>(pos, variable, refKind);
56 }

◆ operator=()

VariableReference & SkSL::VariableReference::operator= ( const VariableReference )
delete

◆ refKind()

RefKind SkSL::VariableReference::refKind ( ) const
inline

Definition at line 65 of file SkSLVariableReference.h.

65 {
66 return fRefKind;
67 }

◆ setRefKind()

void SkSL::VariableReference::setRefKind ( RefKind  refKind)

Definition at line 25 of file SkSLVariableReference.cpp.

25 {
26 fRefKind = refKind;
27}

◆ setVariable()

void SkSL::VariableReference::setVariable ( const Variable variable)

Definition at line 29 of file SkSLVariableReference.cpp.

29 {
30 fVariable = variable;
31}

◆ variable()

const Variable * SkSL::VariableReference::variable ( ) const
inline

Definition at line 61 of file SkSLVariableReference.h.

61 {
62 return fVariable;
63 }

Member Data Documentation

◆ kIRNodeKind

constexpr Kind SkSL::VariableReference::kIRNodeKind = Kind::kVariableReference
inlinestaticconstexpr

Definition at line 45 of file SkSLVariableReference.h.


The documentation for this class was generated from the following files: