ethannicholas | 5961bc9 | 2016-10-12 06:39:56 -0700 | [diff] [blame] | 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 | */ |
Ethan Nicholas | 0df1b04 | 2017-03-31 13:56:23 -0400 | [diff] [blame] | 7 | |
ethannicholas | 5961bc9 | 2016-10-12 06:39:56 -0700 | [diff] [blame] | 8 | #ifndef SKSL_MODIFIERDECLARATION |
| 9 | #define SKSL_MODIFIERDECLARATION |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "src/sksl/ir/SkSLModifiers.h" |
| 12 | #include "src/sksl/ir/SkSLProgramElement.h" |
ethannicholas | 5961bc9 | 2016-10-12 06:39:56 -0700 | [diff] [blame] | 13 | |
| 14 | namespace SkSL { |
| 15 | |
| 16 | /** |
| 17 | * A declaration that consists only of modifiers, e.g.: |
| 18 | * |
| 19 | * layout(blend_support_all_equations) out; |
| 20 | */ |
| 21 | struct ModifiersDeclaration : public ProgramElement { |
| 22 | ModifiersDeclaration(Modifiers modifiers) |
Ethan Nicholas | 5b5f096 | 2017-09-11 13:50:14 -0700 | [diff] [blame] | 23 | : INHERITED(-1, kModifiers_Kind) |
ethannicholas | 5961bc9 | 2016-10-12 06:39:56 -0700 | [diff] [blame] | 24 | , fModifiers(modifiers) {} |
| 25 | |
Ethan Nicholas | 0054311 | 2018-07-31 09:44:36 -0400 | [diff] [blame] | 26 | std::unique_ptr<ProgramElement> clone() const override { |
| 27 | return std::unique_ptr<ProgramElement>(new ModifiersDeclaration(fModifiers)); |
| 28 | } |
| 29 | |
| 30 | String description() const override { |
ethannicholas | 5961bc9 | 2016-10-12 06:39:56 -0700 | [diff] [blame] | 31 | return fModifiers.description() + ";"; |
| 32 | } |
| 33 | |
| 34 | Modifiers fModifiers; |
| 35 | |
| 36 | typedef ProgramElement INHERITED; |
| 37 | }; |
| 38 | |
| 39 | } // namespace |
| 40 | |
| 41 | #endif |