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

Side by Side Diff: src/sksl/ast/SkSLASTBinaryExpression.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/SkSLUtil.cpp ('k') | src/sksl/ast/SkSLASTBlock.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_ASTBINARYEXPRESSION
9 #define SKSL_ASTBINARYEXPRESSION
10
11 #include "SkSLASTExpression.h"
12 #include "../SkSLToken.h"
13 #include <sstream>
14
15 namespace SkSL {
16
17 /**
18 * Represents a binary operation, with the operator represented by the token's t ype.
19 */
20 struct ASTBinaryExpression : public ASTExpression {
21 ASTBinaryExpression(std::unique_ptr<ASTExpression> left, Token op,
22 std::unique_ptr<ASTExpression> right)
23 : INHERITED(op.fPosition, kBinary_Kind)
24 , fLeft(std::move(left))
25 , fOperator(op.fKind)
26 , fRight(std::move(right)) {}
27
28 std::string description() const override {
29 return "(" + fLeft->description() + " " + Token::OperatorName(fOperator) + " " +
30 fRight->description() + ")";
31 }
32
33 const std::unique_ptr<ASTExpression> fLeft;
34 const Token::Kind fOperator;
35 const std::unique_ptr<ASTExpression> fRight;
36
37 typedef ASTExpression INHERITED;
38 };
39
40 } // namespace
41
42 #endif
OLDNEW
« no previous file with comments | « src/sksl/SkSLUtil.cpp ('k') | src/sksl/ast/SkSLASTBlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698