Flutter Engine
The Flutter Engine
third_party
skia
src
sksl
ir
SkSLExpression.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2021 Google Inc.
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
8
#include "
src/sksl/ir/SkSLExpression.h
"
9
10
#include "
src/sksl/SkSLBuiltinTypes.h
"
11
#include "
src/sksl/SkSLContext.h
"
12
#include "
src/sksl/SkSLDefines.h
"
13
#include "
src/sksl/SkSLErrorReporter.h
"
14
#include "
src/sksl/SkSLOperator.h
"
15
16
namespace
SkSL
{
17
18
std::string
Expression::description
()
const
{
19
return
this->
description
(
OperatorPrecedence::kExpression
);
20
}
21
22
bool
Expression::isIncomplete
(
const
Context
& context)
const
{
23
switch
(this->
kind
()) {
24
case
Kind::kFunctionReference:
25
context.
fErrors
->
error
(
fPosition
.
after
(),
"expected '(' to begin function call"
);
26
return
true
;
27
28
case
Kind::kMethodReference:
29
context.
fErrors
->
error
(
fPosition
.
after
(),
"expected '(' to begin method call"
);
30
return
true
;
31
32
case
Kind::kTypeReference:
33
context.
fErrors
->
error
(
fPosition
.
after
(),
34
"expected '(' to begin constructor invocation"
);
35
return
true
;
36
37
case
Kind::kVariableReference:
38
if
(this->
type
().
matches
(*context.
fTypes
.
fSkCaps
)) {
39
context.
fErrors
->
error
(
fPosition
,
"invalid expression"
);
40
return
true
;
41
}
42
return
false
;
43
44
default
:
45
return
false
;
46
}
47
}
48
49
ExpressionArray
ExpressionArray::clone
()
const
{
50
ExpressionArray
cloned;
51
cloned.
reserve_exact
(this->
size
());
52
for
(
const
std::unique_ptr<Expression>& expr : *
this
) {
53
cloned.
push_back
(expr ? expr->clone() :
nullptr
);
54
}
55
return
cloned;
56
}
57
58
}
// namespace SkSL
SkSLBuiltinTypes.h
SkSLContext.h
SkSLDefines.h
SkSLErrorReporter.h
SkSLExpression.h
SkSLOperator.h
SkAlignedSTStorage< SkContainerAllocator::RoundUp< std::unique_ptr< Expression > >(Nreq), std::unique_ptr< Expression > >::size
size_t size() const
Definition:
SkAlignedStorage.h:26
SkSL::BuiltinTypes::fSkCaps
const std::unique_ptr< Type > fSkCaps
Definition:
SkSLBuiltinTypes.h:162
SkSL::Context
Definition:
SkSLContext.h:24
SkSL::Context::fTypes
const BuiltinTypes & fTypes
Definition:
SkSLContext.h:30
SkSL::Context::fErrors
ErrorReporter * fErrors
Definition:
SkSLContext.h:36
SkSL::ErrorReporter::error
void error(Position position, std::string_view msg)
Definition:
SkSLErrorReporter.cpp:16
SkSL::ExpressionArray
Definition:
SkSLDefines.h:24
SkSL::ExpressionArray::clone
ExpressionArray clone() const
Definition:
SkSLExpression.cpp:49
SkSL::Expression::kind
Kind kind() const
Definition:
SkSLExpression.h:40
SkSL::Expression::isIncomplete
bool isIncomplete(const Context &context) const
Definition:
SkSLExpression.cpp:22
SkSL::Expression::type
const Type & type() const
Definition:
SkSLExpression.h:44
SkSL::Expression::description
std::string description() const final
Definition:
SkSLExpression.cpp:18
SkSL::IRNode::fPosition
Position fPosition
Definition:
SkSLIRNode.h:109
SkSL::Position::after
Position after() const
Definition:
SkSLPosition.h:62
skia_private::TArray::reserve_exact
void reserve_exact(int n)
Definition:
SkTArray.h:181
skia_private::TArray::push_back
T & push_back()
Definition:
SkTArray.h:205
SkSL
Definition:
SkCapabilities.h:15
SkSL::OperatorPrecedence::kExpression
@ kExpression
gen_manifest.matches
def matches(file)
Definition:
gen_manifest.py:38
Generated on Sun Jun 23 2024 21:56:34 for Flutter Engine by
1.9.4