blob: 316a0ae7cc219895c058fc1976736695ebbdd5fc [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 */
Ethan Nicholas0df1b042017-03-31 13:56:23 -04007
ethannicholasb3058bd2016-07-01 08:22:01 -07008#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/**
Ethan Nicholas0df1b042017-03-31 13:56:23 -040017 * A parenthesized list of arguments following an expression, indicating a function call.
ethannicholasb3058bd2016-07-01 08:22:01 -070018 */
19struct ASTCallSuffix : public ASTSuffix {
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070020 ASTCallSuffix(int offset, std::vector<std::unique_ptr<ASTExpression>> arguments)
21 : INHERITED(offset, ASTSuffix::kCall_Kind)
ethannicholasb3058bd2016-07-01 08:22:01 -070022 , fArguments(std::move(arguments)) {}
23
Ethan Nicholas0df1b042017-03-31 13:56:23 -040024 String description() const override {
25 String result("(");
26 String 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