| 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_PROGRAMELEMENT |
| 9 |
#define SKSL_PROGRAMELEMENT |
| 10 |
|
| 11 |
#include "src/sksl/ir/SkSLIRNode.h" |
| 12 |
|
| 13 |
#include <memory> |
| 14 |
|
| 15 |
namespace SkSL { |
| 16 |
|
| 17 |
/** |
| 18 |
* Represents a top-level element (e.g. function or global variable) in a program. |
| 19 |
*/ |
| 20 |
class ProgramElement : public IRNode { |
| 21 |
public: |
| 22 |
using Kind = ProgramElementKind; |
| 23 |
|
| 24 |
ProgramElement(Position pos, Kind kind) |
| 25 |
: INHERITED(pos, (int) kind) { |
| 26 |
SkASSERT(kind >= Kind::kFirst && kind <= Kind::kLast); |
| 27 |
} |
| 28 |
|
| 29 |
Kind kind() const { |
| 30 |
return (Kind) fKind; |
| 31 |
} |
| 32 |
|
| 33 |
private: |
| 34 |
using INHERITED = IRNode; |
| 35 |
}; |
| 36 |
|
| 37 |
} // namespace SkSL |
| 38 |
|
| 39 |
#endif |