Chromium Code Reviews| Index: src/sksl/ast/SkSLASTSuffix.h |
| diff --git a/src/sksl/ast/SkSLASTSuffix.h b/src/sksl/ast/SkSLASTSuffix.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bf96405b4043e9bb6896f390e0fa06ff5deba2e4 |
| --- /dev/null |
| +++ b/src/sksl/ast/SkSLASTSuffix.h |
| @@ -0,0 +1,51 @@ |
| +/* |
| + * Copyright 2016 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#ifndef SKSL_ASTSUFFIX |
| +#define SKSL_ASTSUFFIX |
| + |
| +#include "SkSLASTPositionNode.h" |
| +#include "SkSLASTExpression.h" |
| + |
| +namespace SkSL { |
| + |
| +/** |
| + * Abstract supertype of all expression suffixes, such as '[0]' or '.rgb'. Suffixes are not |
|
dogben
2016/06/20 16:23:18
nit: "Abstract" is not quite true, since this is i
|
| + * expressions in and of themselves; they are attached to expressions to modify them. |
| + */ |
| +struct ASTSuffix : public ASTPositionNode { |
| + enum Kind { |
| + kIndex_Kind, |
| + kCall_Kind, |
| + kField_Kind, |
| + kPostIncrement_Kind, |
| + kPostDecrement_Kind |
| + }; |
| + |
| + ASTSuffix(Position position, Kind kind) |
| + : INHERITED(position) |
| + , fKind(kind) {} |
| + |
| + std::string description() const override { |
| + switch (fKind) { |
| + case kPostIncrement_Kind: |
| + return "++"; |
| + case kPostDecrement_Kind: |
| + return "--"; |
| + default: |
| + ABORT("unsupported suffix operator"); |
| + } |
| + } |
| + |
| + Kind fKind; |
| + |
| + typedef ASTPositionNode INHERITED; |
| +}; |
| + |
| +} // namespace |
| + |
| +#endif |