Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/sksl/ast/SkSLASTFunction.h

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixed CMake build Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/sksl/ast/SkSLASTForStatement.h ('k') | src/sksl/ast/SkSLASTIdentifier.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_ASTFUNCTION
9 #define SKSL_ASTFUNCTION
10
11 #include "SkSLASTBlock.h"
12 #include "SkSLASTDeclaration.h"
13 #include "SkSLASTParameter.h"
14 #include "SkSLASTType.h"
15
16 namespace SkSL {
17
18 /**
19 * A function declaration or definition. The fBody field will be null for declar ations.
20 */
21 struct ASTFunction : public ASTDeclaration {
22 ASTFunction(Position position, std::unique_ptr<ASTType> returnType, std::str ing name,
23 std::vector<std::unique_ptr<ASTParameter>> parameters,
24 std::unique_ptr<ASTBlock> body)
25 : INHERITED(position, kFunction_Kind)
26 , fReturnType(std::move(returnType))
27 , fName(std::move(name))
28 , fParameters(std::move(parameters))
29 , fBody(std::move(body)) {}
30
31 std::string description() const override {
32 std::string result = fReturnType->description() + " " + fName + "(";
33 for (size_t i = 0; i < fParameters.size(); i++) {
34 if (i > 0) {
35 result += ", ";
36 }
37 result += fParameters[i]->description();
38 }
39 if (fBody) {
40 result += ") " + fBody->description();
41 } else {
42 result += ");";
43 }
44 return result;
45 }
46
47 const std::unique_ptr<ASTType> fReturnType;
48 const std::string fName;
49 const std::vector<std::unique_ptr<ASTParameter>> fParameters;
50 const std::unique_ptr<ASTBlock> fBody;
51
52 typedef ASTDeclaration INHERITED;
53 };
54
55 } // namespace
56
57 #endif
OLDNEW
« no previous file with comments | « src/sksl/ast/SkSLASTForStatement.h ('k') | src/sksl/ast/SkSLASTIdentifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698