Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SkSL::IRNode Class Referenceabstract

#include <SkSLIRNode.h>

Inheritance diagram for SkSL::IRNode:
SkSL::Poolable SkSL::Expression SkSL::ProgramElement SkSL::Statement SkSL::Symbol SkSL::AnyConstructor SkSL::BinaryExpression SkSL::ChildCall SkSL::EmptyExpression SkSL::FieldAccess SkSL::FunctionCall SkSL::FunctionReference SkSL::IndexExpression SkSL::Literal SkSL::MethodReference SkSL::Poison SkSL::PostfixExpression SkSL::PrefixExpression SkSL::Setting SkSL::Swizzle SkSL::TernaryExpression SkSL::TypeReference SkSL::VariableReference SkSL::Extension SkSL::FunctionDefinition SkSL::FunctionPrototype SkSL::GlobalVarDeclaration SkSL::InterfaceBlock SkSL::ModifiersDeclaration SkSL::StructDefinition SkSL::Block SkSL::BreakStatement SkSL::ContinueStatement SkSL::DiscardStatement SkSL::DoStatement SkSL::ExpressionStatement SkSL::ForStatement SkSL::IfStatement SkSL::Nop SkSL::ReturnStatement SkSL::SwitchCase SkSL::SwitchStatement SkSL::VarDeclaration SkSL::FieldSymbol SkSL::FunctionDeclaration SkSL::Type SkSL::Variable

Public Member Functions

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 ()
 

Public Attributes

Position fPosition
 

Protected Member Functions

 IRNode (Position position, int kind)
 

Protected Attributes

int fKind
 

Additional Inherited Members

- Static Public Member Functions inherited from SkSL::Poolable
static void * operator new (const size_t size)
 
static void operator delete (void *ptr)
 

Detailed Description

Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved version of the program (all types determined, everything validated), ready for code generation.

Definition at line 98 of file SkSLIRNode.h.

Constructor & Destructor Documentation

◆ ~IRNode()

virtual SkSL::IRNode::~IRNode ( )
inlinevirtual

Definition at line 100 of file SkSLIRNode.h.

100{}

◆ IRNode() [1/2]

SkSL::IRNode::IRNode ( const IRNode )
delete

◆ IRNode() [2/2]

SkSL::IRNode::IRNode ( Position  position,
int  kind 
)
inlineprotected

Definition at line 145 of file SkSLIRNode.h.

147 , fKind(kind) {}
Position position() const
Definition: SkSLIRNode.h:111
Position fPosition
Definition: SkSLIRNode.h:109

Member Function Documentation

◆ as() [1/2]

template<typename T >
T & SkSL::IRNode::as ( )
inline

Definition at line 139 of file SkSLIRNode.h.

139 {
140 SkASSERT(this->is<T>());
141 return static_cast<T&>(*this);
142 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define T
Definition: precompiler.cc:65

◆ as() [2/2]

template<typename T >
const T & SkSL::IRNode::as ( ) const
inline

Use as<T> to downcast IRNodes. e.g. replace (ReturnStatement&) s with s.as<ReturnStatement>().

Definition at line 133 of file SkSLIRNode.h.

133 {
134 SkASSERT(this->is<T>());
135 return static_cast<const T&>(*this);
136 }

◆ description()

virtual std::string SkSL::IRNode::description ( ) const
pure virtual

◆ is()

template<typename T >
bool SkSL::IRNode::is ( ) const
inline

Use is<T> to check the type of an IRNode. e.g. replace s.kind() == Statement::Kind::kReturn with s.is<ReturnStatement>().

Definition at line 124 of file SkSLIRNode.h.

124 {
125 return this->fKind == (int)T::kIRNodeKind;
126 }

◆ operator=()

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

◆ position()

Position SkSL::IRNode::position ( ) const
inline

Definition at line 111 of file SkSLIRNode.h.

111 {
112 return fPosition;
113 }

◆ setPosition()

void SkSL::IRNode::setPosition ( Position  p)
inline

Definition at line 115 of file SkSLIRNode.h.

Member Data Documentation

◆ fKind

int SkSL::IRNode::fKind
protected

Definition at line 149 of file SkSLIRNode.h.

◆ fPosition

Position SkSL::IRNode::fPosition

Definition at line 109 of file SkSLIRNode.h.


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