Line data Source code
1 : /*
2 : * Copyright 2016 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 : #ifndef SKSL_ASTCALLSUFFIX
9 : #define SKSL_ASTCALLSUFFIX
10 :
11 : #include <vector>
12 : #include "SkSLASTSuffix.h"
13 :
14 : namespace SkSL {
15 :
16 : /**
17 : * A parenthesized list of arguments following an expression, indicating a function call.
18 : */
19 0 : struct ASTCallSuffix : public ASTSuffix {
20 0 : ASTCallSuffix(Position position, std::vector<std::unique_ptr<ASTExpression>> arguments)
21 0 : : INHERITED(position, ASTSuffix::kCall_Kind)
22 0 : , fArguments(std::move(arguments)) {}
23 :
24 0 : String description() const override {
25 0 : String result("(");
26 0 : String separator;
27 0 : for (size_t i = 0; i < fArguments.size(); ++i) {
28 0 : result += separator;
29 0 : separator = ", ";
30 0 : result += fArguments[i]->description();
31 : }
32 0 : result += ")";
33 0 : return result;
34 : }
35 :
36 : std::vector<std::unique_ptr<ASTExpression>> fArguments;
37 :
38 : typedef ASTSuffix INHERITED;
39 : };
40 :
41 : } // namespace
42 :
43 : #endif
|