Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
14
15namespace SkSL {
16
17std::string Expression::description() const {
19}
20
21bool Expression::isIncomplete(const Context& context) const {
22 switch (this->kind()) {
23 case Kind::kFunctionReference:
24 context.fErrors->error(fPosition.after(), "expected '(' to begin function call");
25 return true;
26
27 case Kind::kMethodReference:
28 context.fErrors->error(fPosition.after(), "expected '(' to begin method call");
29 return true;
30
31 case Kind::kTypeReference:
32 context.fErrors->error(fPosition.after(),
33 "expected '(' to begin constructor invocation");
34 return true;
35
36 default:
37 return false;
38 }
39}
40
42 ExpressionArray cloned;
43 cloned.reserve_exact(this->size());
44 for (const std::unique_ptr<Expression>& expr : *this) {
45 cloned.push_back(expr ? expr->clone() : nullptr);
46 }
47 return cloned;
48}
49
50} // namespace SkSL
size_t size() const
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
std::string description() const final
Position fPosition
Definition SkSLIRNode.h:109
Position after() const
void reserve_exact(int n)
Definition SkTArray.h:176