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 struct ASTCallSuffix : public ASTSuffix { ASTCallSuffixASTCallSuffix20 ASTCallSuffix(int offset, std::vector<std::unique_ptr<ASTExpression>> arguments) 21 : INHERITED(offset, ASTSuffix::kCall_Kind) 22 , fArguments(std::move(arguments)) {} 23 descriptionASTCallSuffix24 String description() const override { 25 String result("("); 26 String separator; 27 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 44