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

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: more cleanups Created 4 years, 6 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
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>> parameters)
dogben 2016/06/22 17:43:57 nit: s/parameters/arguments/g
ethannicholas 2016/06/24 21:23:09 Wow. I had always thought those were interchangeab
dogben 2016/06/26 03:57:53 In 99% of contexts, I use them interchangeably. It
21 : INHERITED(position, kConstructor_Kind, type)
dogben 2016/06/22 17:43:57 nit: std::move
22 , fParameters(std::move(parameters)) {}
23
24 virtual std::string description() const override {
dogben 2016/06/22 17:43:57 nit: remove virtual
25 std::string result = fType->description() + "(";
26 std::string separator = "";
27 for (size_t i = 0; i < fParameters.size(); i++) {
28 result += separator;
29 result += fParameters[i]->description();
30 separator = ", ";
31 }
32 result += ")";
33 return result;
34 }
35
36 bool isConstant() const override {
37 for (size_t i = 0; i < fParameters.size(); i++) {
38 if (!fParameters[i]->isConstant()) {
39 return false;
40 }
41 }
42 return true;
43 }
44
45 const std::vector<std::unique_ptr<Expression>> fParameters;
46
47 typedef Expression INHERITED;
48 };
49
50 } // namespace
51
52 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698