Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
SkSL::DoStatement Class Referencefinal

#include <SkSLDoStatement.h>

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

Public Member Functions

 DoStatement (Position pos, std::unique_ptr< Statement > statement, std::unique_ptr< Expression > test)
 
std::unique_ptr< Statement > & statement ()
 
const std::unique_ptr< Statement > & statement () const
 
std::unique_ptr< Expression > & test ()
 
const std::unique_ptr< Expression > & test () const
 
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 ()
 
 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< StatementConvert (const Context &context, Position pos, std::unique_ptr< Statement > stmt, std::unique_ptr< Expression > test)
 
static std::unique_ptr< StatementMake (const Context &context, Position pos, std::unique_ptr< Statement > stmt, std::unique_ptr< Expression > test)
 
- 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::kDo
 

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 'do' statement.

Definition at line 27 of file SkSLDoStatement.h.

Constructor & Destructor Documentation

◆ DoStatement()

SkSL::DoStatement::DoStatement ( Position  pos,
std::unique_ptr< Statement statement,
std::unique_ptr< Expression test 
)
inline

Definition at line 31 of file SkSLDoStatement.h.

33 : INHERITED(pos, kIRNodeKind)
34 , fStatement(std::move(statement))
35 , fTest(std::move(test)) {}
SkPoint pos
static constexpr Kind kIRNodeKind
std::unique_ptr< Statement > & statement()

Member Function Documentation

◆ Convert()

std::unique_ptr< Statement > SkSL::DoStatement::Convert ( const Context context,
Position  pos,
std::unique_ptr< Statement stmt,
std::unique_ptr< Expression test 
)
static

Definition at line 20 of file SkSLDoStatement.cpp.

23 {
24 if (context.fConfig->strictES2Mode()) {
25 context.fErrors->error(pos, "do-while loops are not supported");
26 return nullptr;
27 }
28 test = context.fTypes.fBool->coerceExpression(std::move(test), context);
29 if (!test) {
30 return nullptr;
31 }
32 if (Analysis::DetectVarDeclarationWithoutScope(*stmt, context.fErrors)) {
33 return nullptr;
34 }
35 return DoStatement::Make(context, pos, std::move(stmt), std::move(test));
36}
static std::unique_ptr< Statement > Make(const Context &context, Position pos, std::unique_ptr< Statement > stmt, std::unique_ptr< Expression > test)
bool DetectVarDeclarationWithoutScope(const Statement &stmt, ErrorReporter *errors=nullptr)

◆ description()

std::string SkSL::DoStatement::description ( ) const
overridevirtual

Implements SkSL::IRNode.

Definition at line 48 of file SkSLDoStatement.cpp.

48 {
49 return "do " + this->statement()->description() +
50 " while (" + this->test()->description() + ");";
51}
std::unique_ptr< Expression > & test()

◆ Make()

std::unique_ptr< Statement > SkSL::DoStatement::Make ( const Context context,
Position  pos,
std::unique_ptr< Statement stmt,
std::unique_ptr< Expression test 
)
static

Definition at line 38 of file SkSLDoStatement.cpp.

41 {
42 SkASSERT(!context.fConfig->strictES2Mode());
43 SkASSERT(test->type().matches(*context.fTypes.fBool));
45 return std::make_unique<DoStatement>(pos, std::move(stmt), std::move(test));
46}
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ statement() [1/2]

std::unique_ptr< Statement > & SkSL::DoStatement::statement ( )
inline

Definition at line 49 of file SkSLDoStatement.h.

49 {
50 return fStatement;
51 }

◆ statement() [2/2]

const std::unique_ptr< Statement > & SkSL::DoStatement::statement ( ) const
inline

Definition at line 53 of file SkSLDoStatement.h.

53 {
54 return fStatement;
55 }

◆ test() [1/2]

std::unique_ptr< Expression > & SkSL::DoStatement::test ( )
inline

Definition at line 57 of file SkSLDoStatement.h.

57 {
58 return fTest;
59 }

◆ test() [2/2]

const std::unique_ptr< Expression > & SkSL::DoStatement::test ( ) const
inline

Definition at line 61 of file SkSLDoStatement.h.

61 {
62 return fTest;
63 }

Member Data Documentation

◆ kIRNodeKind

constexpr Kind SkSL::DoStatement::kIRNodeKind = Kind::kDo
inlinestaticconstexpr

Definition at line 29 of file SkSLDoStatement.h.


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