blob: 356ac850f97db1efc9e34566e2b792ed9a8f2312 [file] [log] [blame]
ethannicholasb3058bd2016-07-01 08:22:01 -07001/*
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
ethannicholasb3058bd2016-07-01 08:22:01 -070011#include <vector>
12#include "SkSLASTSuffix.h"
13
14namespace SkSL {
15
16/**
17 * A parenthesized list of arguments following an expression, indicating a function call.
18 */
19struct ASTCallSuffix : public ASTSuffix {
20 ASTCallSuffix(Position position, std::vector<std::unique_ptr<ASTExpression>> arguments)
21 : INHERITED(position, ASTSuffix::kCall_Kind)
22 , fArguments(std::move(arguments)) {}
23
Ethan Nicholasd8df21a2016-11-17 16:13:37 -050024 SkString description() const override {
25 SkString result("(");
26 SkString separator;
ethannicholasb3058bd2016-07-01 08:22:01 -070027 for (size_t i = 0; i < fArguments.size(); ++i) {
28 result += separator;
29 separator = ", ";
30 result += fArguments[i]->description();
31 }
32 result += ")";
33 return result;
34 }
35
36 std::vector<std::unique_ptr<ASTExpression>> fArguments;
37
38 typedef ASTSuffix INHERITED;
39};
40
41} // namespace
42
43#endif