b61c3a9a01
This reverts commit efc8797880
.
Reason for revert: breakage due to std::max initializer list
Original change's description:
> moved BinaryExpression's data into IRNode
>
> This is another step in the process of merging the various IRNodes' data
> into the base class.
>
> Change-Id: Ide39c240e6178e23bb6fe317dd56addf2ffefcbb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317102
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: Ib8ef629ffa0ff8bb0aeddfa4f42b824e79ce72b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317384
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
52 lines
1008 B
C++
52 lines
1008 B
C++
/*
|
|
* 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_IRNODE
|
|
#define SKSL_IRNODE
|
|
|
|
#include "src/sksl/SkSLLexer.h"
|
|
#include "src/sksl/SkSLString.h"
|
|
|
|
namespace SkSL {
|
|
|
|
class Type;
|
|
|
|
/**
|
|
* Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved
|
|
* version of the program (all types determined, everything validated), ready for code generation.
|
|
*/
|
|
class IRNode {
|
|
public:
|
|
IRNode(int offset, int kind, const Type* type = nullptr)
|
|
: fOffset(offset)
|
|
, fKind(kind)
|
|
, fType(type) {}
|
|
|
|
virtual ~IRNode() {}
|
|
|
|
virtual String description() const = 0;
|
|
|
|
// character offset of this element within the program being compiled, for error reporting
|
|
// purposes
|
|
int fOffset;
|
|
|
|
const Type& type() const {
|
|
SkASSERT(fType);
|
|
return *fType;
|
|
}
|
|
|
|
protected:
|
|
int fKind;
|
|
|
|
private:
|
|
const Type* fType;
|
|
};
|
|
|
|
} // namespace SkSL
|
|
|
|
#endif
|