Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / src / sksl / ir / SkSLExpression.cpp
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 "include/sksl/SkSLErrorReporter.h"
9 #include "src/sksl/SkSLContext.h"
10 #include "src/sksl/ir/SkSLExpression.h"
11
12 namespace SkSL {
13
14 bool Expression::isIncomplete(const Context& context) const {
15     switch (this->kind()) {
16         case Kind::kFunctionReference:
17         case Kind::kExternalFunctionReference:
18             context.fErrors->error(fPosition.after(), "expected '(' to begin function call");
19             return true;
20
21         case Kind::kMethodReference:
22             context.fErrors->error(fPosition.after(), "expected '(' to begin method call");
23             return true;
24
25         case Kind::kTypeReference:
26             context.fErrors->error(fPosition.after(),
27                     "expected '(' to begin constructor invocation");
28             return true;
29
30         default:
31             return false;
32     }
33 }
34
35 ExpressionArray ExpressionArray::clone() const {
36     ExpressionArray cloned;
37     cloned.reserve_back(this->count());
38     for (const std::unique_ptr<Expression>& expr : *this) {
39         cloned.push_back(expr ? expr->clone() : nullptr);
40     }
41     return cloned;
42 }
43
44 }  // namespace SkSL