Flutter Engine
The Flutter Engine
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
9
15
16namespace SkSL {
17
18std::string Expression::description() const {
20}
21
22bool 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
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
const std::unique_ptr< Type > fSkCaps
const BuiltinTypes & fTypes
Definition: SkSLContext.h:30
ErrorReporter * fErrors
Definition: SkSLContext.h:36
void error(Position position, std::string_view msg)
ExpressionArray clone() const
Kind kind() const
bool isIncomplete(const Context &context) const
const Type & type() const
std::string description() const final
Position fPosition
Definition: SkSLIRNode.h:109
Position after() const
Definition: SkSLPosition.h:62
void reserve_exact(int n)
Definition: SkTArray.h:181
def matches(file)
Definition: gen_manifest.py:38