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

#include <SkSLReturnStatement.h>

Inheritance diagram for SkSL::ReturnStatement:
SkSL::Statement SkSL::IRNode SkSL::Poolable

Public Member Functions

 ReturnStatement (Position pos, std::unique_ptr< Expression > expression)
 
std::unique_ptr< Expression > & expression ()
 
const std::unique_ptr< Expression > & expression () const
 
void setExpression (std::unique_ptr< Expression > expr)
 
std::string description () const override
 
- Public Member Functions inherited from SkSL::Statement
 Statement (Position pos, Kind kind)
 
Kind kind () const
 
virtual bool isEmpty () const
 
- 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< StatementMake (Position pos, std::unique_ptr< Expression > expression)
 
- 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::kReturn
 

Additional Inherited Members

- Public Types inherited from SkSL::Statement
using Kind = StatementKind
 
- 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 'return' statement.

Definition at line 19 of file SkSLReturnStatement.h.

Constructor & Destructor Documentation

◆ ReturnStatement()

SkSL::ReturnStatement::ReturnStatement ( Position  pos,
std::unique_ptr< Expression expression 
)
inline

Definition at line 23 of file SkSLReturnStatement.h.

24 : INHERITED(pos, kIRNodeKind)
25 , fExpression(std::move(expression)) {}
SkPoint pos
static constexpr Kind kIRNodeKind
std::unique_ptr< Expression > & expression()

Member Function Documentation

◆ description()

std::string SkSL::ReturnStatement::description ( ) const
inlineoverridevirtual

Implements SkSL::IRNode.

Definition at line 43 of file SkSLReturnStatement.h.

43 {
44 if (this->expression()) {
45 return "return " + this->expression()->description() + ";";
46 } else {
47 return "return;";
48 }
49 }

◆ expression() [1/2]

std::unique_ptr< Expression > & SkSL::ReturnStatement::expression ( )
inline

Definition at line 31 of file SkSLReturnStatement.h.

31 {
32 return fExpression;
33 }

◆ expression() [2/2]

const std::unique_ptr< Expression > & SkSL::ReturnStatement::expression ( ) const
inline

Definition at line 35 of file SkSLReturnStatement.h.

35 {
36 return fExpression;
37 }

◆ Make()

static std::unique_ptr< Statement > SkSL::ReturnStatement::Make ( Position  pos,
std::unique_ptr< Expression expression 
)
inlinestatic

Definition at line 27 of file SkSLReturnStatement.h.

27 {
28 return std::make_unique<ReturnStatement>(pos, std::move(expression));
29 }

◆ setExpression()

void SkSL::ReturnStatement::setExpression ( std::unique_ptr< Expression expr)
inline

Definition at line 39 of file SkSLReturnStatement.h.

39 {
40 fExpression = std::move(expr);
41 }

Member Data Documentation

◆ kIRNodeKind

constexpr Kind SkSL::ReturnStatement::kIRNodeKind = Kind::kReturn
inlinestaticconstexpr

Definition at line 21 of file SkSLReturnStatement.h.


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