Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
sksl
ir
SkSLEmptyExpression.h
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Google LLC.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
#ifndef SkSLEmptyExpression_DEFINED
8
#define SkSLEmptyExpression_DEFINED
9
10
#include "
src/sksl/SkSLBuiltinTypes.h
"
11
#include "
src/sksl/SkSLCompiler.h
"
12
#include "
src/sksl/SkSLContext.h
"
13
#include "
src/sksl/ir/SkSLExpression.h
"
14
15
namespace
SkSL
{
16
17
/**
18
* The EmptyExpression is a void-typed expression with nothing inside. EmptyExpressions can exist
19
* inside an ExpressionStatement; this construct is functionally equivalent to a Nop.
20
*/
21
class
EmptyExpression
:
public
Expression
{
22
public
:
23
inline
static
constexpr
Kind
kIRNodeKind
= Kind::kEmpty;
24
25
static
std::unique_ptr<Expression>
Make
(
Position
pos
,
const
Context
& context) {
26
return
std::make_unique<EmptyExpression>(
pos
, context.
fTypes
.
fVoid
.get());
27
}
28
29
EmptyExpression
(
Position
pos
,
const
Type
*
type
)
30
:
INHERITED
(
pos
,
kIRNodeKind
,
type
) {
31
SkASSERT
(
type
->
isVoid
());
32
}
33
34
std::unique_ptr<Expression>
clone
(
Position
pos
)
const override
{
35
return
std::make_unique<EmptyExpression>(
pos
, &this->
type
());
36
}
37
38
std::string
description
(
OperatorPrecedence
)
const override
{
39
// There's no way in GLSL to directly emit a void-typed expression.
40
// `false` is used here as a placeholder expression; the value of a void-typed expression is
41
// never meaningful, so this should be a decent substitute.
42
return
"false"
;
43
}
44
45
private
:
46
using
INHERITED =
Expression
;
47
};
48
49
}
// namespace SkSL
50
51
#endif
// SkSLEmptyExpression_DEFINED
pos
SkPoint pos
Definition
ImageShaderTest.cpp:27
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
SkSLBuiltinTypes.h
SkSLCompiler.h
SkSLContext.h
SkSLExpression.h
SkSL::BuiltinTypes::fVoid
const std::unique_ptr< Type > fVoid
Definition
SkSLBuiltinTypes.h:61
SkSL::Context
Definition
SkSLContext.h:24
SkSL::Context::fTypes
const BuiltinTypes & fTypes
Definition
SkSLContext.h:30
SkSL::EmptyExpression
Definition
SkSLEmptyExpression.h:21
SkSL::EmptyExpression::clone
std::unique_ptr< Expression > clone(Position pos) const override
Definition
SkSLEmptyExpression.h:34
SkSL::EmptyExpression::kIRNodeKind
static constexpr Kind kIRNodeKind
Definition
SkSLEmptyExpression.h:23
SkSL::EmptyExpression::EmptyExpression
EmptyExpression(Position pos, const Type *type)
Definition
SkSLEmptyExpression.h:29
SkSL::EmptyExpression::Make
static std::unique_ptr< Expression > Make(Position pos, const Context &context)
Definition
SkSLEmptyExpression.h:25
SkSL::EmptyExpression::description
std::string description(OperatorPrecedence) const override
Definition
SkSLEmptyExpression.h:38
SkSL::Expression
Definition
SkSLExpression.h:30
SkSL::Expression::type
virtual const Type & type() const
Definition
SkSLExpression.h:44
SkSL::Position
Definition
SkSLPosition.h:18
SkSL::Type::isVoid
bool isVoid() const
Definition
SkSLType.h:496
SkSL
Definition
SkCapabilities.h:15
SkSL::OperatorPrecedence
OperatorPrecedence
Definition
SkSLOperator.h:57
SkSL::ExpressionKind
ExpressionKind
Definition
SkSLIRNode.h:62
Type
Definition
asyncrescaleandread.cpp:530
Generated on Fri Apr 26 2024 06:17:31 for Flutter Engine by
1.9.8