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

Side by Side Diff: src/sksl/ir/SkSLConstructor.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/ir/SkSLBreakStatement.h ('k') | src/sksl/ir/SkSLContinueStatement.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_CONSTRUCTOR
9 #define SKSL_CONSTRUCTOR
10
11 #include "SkSLExpression.h"
12
13 namespace SkSL {
14
15 /**
16 * Represents the construction of a compound type, such as "vec2(x, y)".
17 */
18 struct Constructor : public Expression {
19 Constructor(Position position, std::shared_ptr<Type> type,
20 std::vector<std::unique_ptr<Expression>> arguments)
21 : INHERITED(position, kConstructor_Kind, std::move(type))
22 , fArguments(std::move(arguments)) {}
23
24 std::string description() const override {
25 std::string result = fType->description() + "(";
26 std::string separator = "";
27 for (size_t i = 0; i < fArguments.size(); i++) {
28 result += separator;
29 result += fArguments[i]->description();
30 separator = ", ";
31 }
32 result += ")";
33 return result;
34 }
35
36 bool isConstant() const override {
37 for (size_t i = 0; i < fArguments.size(); i++) {
38 if (!fArguments[i]->isConstant()) {
39 return false;
40 }
41 }
42 return true;
43 }
44
45 const std::vector<std::unique_ptr<Expression>> fArguments;
46
47 typedef Expression INHERITED;
48 };
49
50 } // namespace
51
52 #endif
OLDNEW
« no previous file with comments | « src/sksl/ir/SkSLBreakStatement.h ('k') | src/sksl/ir/SkSLContinueStatement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698