| 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_IRNODE | 
|---|
| 9 | #define SKSL_IRNODE | 
|---|
| 10 |  | 
|---|
| 11 | #include "src/sksl/SkSLLexer.h" | 
|---|
| 12 | #include "src/sksl/SkSLString.h" | 
|---|
| 13 |  | 
|---|
| 14 | namespace SkSL { | 
|---|
| 15 |  | 
|---|
| 16 | /** | 
|---|
| 17 | * Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved | 
|---|
| 18 | * version of the program (all types determined, everything validated), ready for code generation. | 
|---|
| 19 | */ | 
|---|
| 20 | struct IRNode { | 
|---|
| 21 | IRNode(int offset) | 
|---|
| 22 | : fOffset(offset) {} | 
|---|
| 23 |  | 
|---|
| 24 | virtual ~IRNode() {} | 
|---|
| 25 |  | 
|---|
| 26 | #ifdef SK_DEBUG | 
|---|
| 27 | virtual String description() const = 0; | 
|---|
| 28 | #endif | 
|---|
| 29 |  | 
|---|
| 30 | // character offset of this element within the program being compiled, for error reporting | 
|---|
| 31 | // purposes | 
|---|
| 32 | int fOffset; | 
|---|
| 33 | }; | 
|---|
| 34 |  | 
|---|
| 35 | } // namespace | 
|---|
| 36 |  | 
|---|
| 37 | #endif | 
|---|
| 38 |  | 
|---|