2016-07-01 15:22:01 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2017-03-31 17:56:23 +00:00
|
|
|
|
2016-07-01 15:22:01 +00:00
|
|
|
#ifndef SKSL_IRNODE
|
|
|
|
#define SKSL_IRNODE
|
|
|
|
|
2017-09-11 20:50:14 +00:00
|
|
|
#include "../SkSLLexer.h"
|
2016-07-01 15:22:01 +00:00
|
|
|
|
|
|
|
namespace SkSL {
|
|
|
|
|
|
|
|
/**
|
2017-03-31 17:56:23 +00:00
|
|
|
* Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved
|
2016-07-01 15:22:01 +00:00
|
|
|
* version of the program (all types determined, everything validated), ready for code generation.
|
|
|
|
*/
|
|
|
|
struct IRNode {
|
2017-09-11 20:50:14 +00:00
|
|
|
IRNode(int offset)
|
|
|
|
: fOffset(offset) {}
|
2016-07-01 15:22:01 +00:00
|
|
|
|
|
|
|
virtual ~IRNode() {}
|
|
|
|
|
2017-03-31 17:56:23 +00:00
|
|
|
virtual String description() const = 0;
|
2016-07-01 15:22:01 +00:00
|
|
|
|
2017-09-11 20:50:14 +00:00
|
|
|
// character offset of this element within the program being compiled, for error reporting
|
|
|
|
// purposes
|
2017-09-18 18:10:39 +00:00
|
|
|
int fOffset;
|
2016-07-01 15:22:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|