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

#include <SkSLTypeReference.h>

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

Public Member Functions

 TypeReference (const Context &context, Position pos, const Type *value)
 
const Typevalue () const
 
std::string description (OperatorPrecedence) const override
 
std::unique_ptr< Expressionclone (Position pos) const override
 
- Public Member Functions inherited from SkSL::Expression
 Expression (Position pos, Kind kind, const Type *type)
 
Kind kind () const
 
virtual 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
 
std::unique_ptr< Expressionclone () const
 
std::string description () const final
 
- 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 bool VerifyType (const Context &context, const SkSL::Type *type, Position pos)
 
static std::unique_ptr< TypeReferenceConvert (const Context &context, Position pos, const Type *type)
 
static std::unique_ptr< TypeReferenceMake (const Context &context, Position pos, const Type *type)
 
- 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::kTypeReference
 

Additional Inherited Members

- Public Types inherited from SkSL::Expression
enum class  ComparisonResult { kUnknown = -1 , kNotEqual , kEqual }
 
using Kind = ExpressionKind
 
- 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

Represents an identifier referring to a type. This is an intermediate value: TypeReferences are always eventually replaced by Constructors in valid programs.

Definition at line 30 of file SkSLTypeReference.h.

Constructor & Destructor Documentation

◆ TypeReference()

SkSL::TypeReference::TypeReference ( const Context context,
Position  pos,
const Type value 
)
inline

Definition at line 34 of file SkSLTypeReference.h.

35 : TypeReference(pos, value, context.fTypes.fInvalid.get()) {}
SkPoint pos
TypeReference(const Context &context, Position pos, const Type *value)
const Type & value() const

Member Function Documentation

◆ clone()

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

Implements SkSL::Expression.

Definition at line 59 of file SkSLTypeReference.h.

59 {
60 return std::unique_ptr<Expression>(new TypeReference(pos, &this->value(), &this->type()));
61 }
virtual const Type & type() const

◆ Convert()

std::unique_ptr< TypeReference > SkSL::TypeReference::Convert ( const Context context,
Position  pos,
const Type type 
)
static

Definition at line 30 of file SkSLTypeReference.cpp.

32 {
33 return VerifyType(context, type, pos) ? TypeReference::Make(context, pos, type)
34 : nullptr;
35}
static bool VerifyType(const Context &context, const SkSL::Type *type, Position pos)
static std::unique_ptr< TypeReference > Make(const Context &context, Position pos, const Type *type)

◆ description()

std::string SkSL::TypeReference::description ( OperatorPrecedence  ) const
inlineoverridevirtual

Implements SkSL::Expression.

Definition at line 55 of file SkSLTypeReference.h.

55 {
56 return std::string(this->value().name());
57 }
const char * name
Definition fuchsia.cc:50

◆ Make()

std::unique_ptr< TypeReference > SkSL::TypeReference::Make ( const Context context,
Position  pos,
const Type type 
)
static

Definition at line 37 of file SkSLTypeReference.cpp.

39 {
40 SkASSERT(type->isAllowedInES2(context));
41 return std::make_unique<TypeReference>(context, pos, type);
42}
#define SkASSERT(cond)
Definition SkAssert.h:116
bool isAllowedInES2(const Context &context) const

◆ value()

const Type & SkSL::TypeReference::value ( ) const
inline

Definition at line 51 of file SkSLTypeReference.h.

51 {
52 return fValue;
53 }

◆ VerifyType()

bool SkSL::TypeReference::VerifyType ( const Context context,
const SkSL::Type type,
Position  pos 
)
static

Definition at line 16 of file SkSLTypeReference.cpp.

16 {
17 if (!context.fConfig->fIsBuiltinCode && type) {
18 if (type->isGeneric() || type->isLiteral()) {
19 context.fErrors->error(pos, "type '" + std::string(type->name()) + "' is generic");
20 return false;
21 }
22 if (!type->isAllowedInES2(context)) {
23 context.fErrors->error(pos, "type '" + std::string(type->name()) +"' is not supported");
24 return false;
25 }
26 }
27 return true;
28}
std::string_view name() const
Definition SkSLSymbol.h:51
bool isGeneric() const
Definition SkSLType.h:500
virtual bool isLiteral() const
Definition SkSLType.h:516

Member Data Documentation

◆ kIRNodeKind

constexpr Kind SkSL::TypeReference::kIRNodeKind = Kind::kTypeReference
inlinestaticconstexpr

Definition at line 32 of file SkSLTypeReference.h.


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