Ethan Nicholas | c8d9c8e | 2020-09-22 15:05:37 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 Google LLC. |
| 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 | #include "src/sksl/ir/SkSLIRNode.h" |
| 9 | |
| 10 | #include "src/sksl/ir/SkSLExpression.h" |
| 11 | |
| 12 | namespace SkSL { |
| 13 | |
Ethan Nicholas | 59d660c | 2020-09-28 09:18:15 -0400 | [diff] [blame] | 14 | IRNode::IRNode(int offset, int kind, const BlockData& data, |
| 15 | std::vector<std::unique_ptr<Statement>> stmts) |
Ethan Nicholas | 7bd6043 | 2020-09-25 14:31:59 -0400 | [diff] [blame] | 16 | : fOffset(offset) |
| 17 | , fKind(kind) |
| 18 | , fData(data) |
| 19 | , fStatementChildren(std::move(stmts)) {} |
| 20 | |
Ethan Nicholas | 59d660c | 2020-09-28 09:18:15 -0400 | [diff] [blame] | 21 | IRNode::IRNode(int offset, int kind, const BoolLiteralData& data) |
| 22 | : fOffset(offset) |
| 23 | , fKind(kind) |
| 24 | , fData(data) {} |
| 25 | |
Ethan Nicholas | d83ded8 | 2020-09-29 17:05:54 -0400 | [diff] [blame] | 26 | IRNode::IRNode(int offset, int kind, const EnumData& data) |
| 27 | : fOffset(offset) |
| 28 | , fKind(kind) |
| 29 | , fData(data) {} |
| 30 | |
Ethan Nicholas | 6e86ec9 | 2020-09-30 14:29:56 -0400 | [diff] [blame] | 31 | IRNode::IRNode(int offset, int kind, const ExternalValueData& data) |
| 32 | : fOffset(offset) |
| 33 | , fKind(kind) |
| 34 | , fData(data) {} |
| 35 | |
Ethan Nicholas | e96cdd1 | 2020-09-28 16:27:18 -0400 | [diff] [blame] | 36 | IRNode::IRNode(int offset, int kind, const IntLiteralData& data) |
| 37 | : fOffset(offset) |
| 38 | , fKind(kind) |
| 39 | , fData(data) {} |
Ethan Nicholas | 59d660c | 2020-09-28 09:18:15 -0400 | [diff] [blame] | 40 | |
Ethan Nicholas | a3f22f1 | 2020-10-01 12:13:17 -0400 | [diff] [blame] | 41 | IRNode::IRNode(int offset, int kind, const FloatLiteralData& data) |
| 42 | : fOffset(offset) |
| 43 | , fKind(kind) |
| 44 | , fData(data) {} |
| 45 | |
Ethan Nicholas | efb09e2 | 2020-09-30 10:17:00 -0400 | [diff] [blame] | 46 | IRNode::IRNode(int offset, int kind, const String& data) |
| 47 | : fOffset(offset) |
| 48 | , fKind(kind) |
| 49 | , fData(data) {} |
| 50 | |
Ethan Nicholas | c8d9c8e | 2020-09-22 15:05:37 -0400 | [diff] [blame] | 51 | IRNode::IRNode(int offset, int kind, const Type* data) |
| 52 | : fOffset(offset) |
| 53 | , fKind(kind) |
| 54 | , fData(data) {} |
| 55 | |
Ethan Nicholas | 59d660c | 2020-09-28 09:18:15 -0400 | [diff] [blame] | 56 | IRNode::IRNode(int offset, int kind, const TypeTokenData& data) |
Ethan Nicholas | c8d9c8e | 2020-09-22 15:05:37 -0400 | [diff] [blame] | 57 | : fOffset(offset) |
| 58 | , fKind(kind) |
| 59 | , fData(data) {} |
| 60 | |
| 61 | IRNode::IRNode(const IRNode& other) |
| 62 | : fOffset(other.fOffset) |
| 63 | , fKind(other.fKind) |
| 64 | , fData(other.fData) { |
| 65 | // For now, we can't use a default copy constructor because of the std::unique_ptr children. |
| 66 | // Since we never copy nodes containing children, it's easiest just to assert we don't have any |
| 67 | // than bother with cloning them. |
| 68 | SkASSERT(other.fExpressionChildren.empty()); |
| 69 | } |
| 70 | |
| 71 | IRNode::~IRNode() {} |
| 72 | |
| 73 | } // namespace SkSL |