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 {
IRNodeIRNode21     IRNode(int offset)
22     : fOffset(offset) {}
23 
~IRNodeIRNode24     virtual ~IRNode() {}
25 
26     virtual String description() const = 0;
27 
28     // character offset of this element within the program being compiled, for error reporting
29     // purposes
30     int fOffset;
31 };
32 
33 } // namespace
34 
35 #endif
36