2 * Copyright 2021 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #include "include/sksl/SkSLErrorReporter.h"
9 #include "src/sksl/SkSLContext.h"
10 #include "src/sksl/ir/SkSLExpression.h"
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");
21 case Kind::kMethodReference:
22 context.fErrors->error(fPosition.after(), "expected '(' to begin method call");
25 case Kind::kTypeReference:
26 context.fErrors->error(fPosition.after(),
27 "expected '(' to begin constructor invocation");
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);