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_STATEMENT
|
|
|
|
#define SKSL_STATEMENT
|
|
|
|
|
|
|
|
#include "SkSLIRNode.h"
|
|
|
|
#include "SkSLType.h"
|
|
|
|
|
|
|
|
namespace SkSL {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract supertype of all statements.
|
|
|
|
*/
|
|
|
|
struct Statement : public IRNode {
|
|
|
|
enum Kind {
|
|
|
|
kBlock_Kind,
|
|
|
|
kBreak_Kind,
|
|
|
|
kContinue_Kind,
|
|
|
|
kDiscard_Kind,
|
|
|
|
kDo_Kind,
|
|
|
|
kExpression_Kind,
|
|
|
|
kFor_Kind,
|
2017-04-20 23:31:52 +00:00
|
|
|
kGroup_Kind,
|
2016-07-01 15:22:01 +00:00
|
|
|
kIf_Kind,
|
2017-04-20 23:31:52 +00:00
|
|
|
kNop_Kind,
|
2016-07-01 15:22:01 +00:00
|
|
|
kReturn_Kind,
|
2017-02-27 18:26:45 +00:00
|
|
|
kSwitch_Kind,
|
2016-09-07 20:37:16 +00:00
|
|
|
kVarDeclarations_Kind,
|
2016-07-01 15:22:01 +00:00
|
|
|
kWhile_Kind
|
|
|
|
};
|
|
|
|
|
2017-09-11 20:50:14 +00:00
|
|
|
Statement(int offset, Kind kind)
|
|
|
|
: INHERITED(offset)
|
2016-07-01 15:22:01 +00:00
|
|
|
, fKind(kind) {}
|
|
|
|
|
2017-04-20 23:31:52 +00:00
|
|
|
virtual bool isEmpty() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-07-01 15:22:01 +00:00
|
|
|
const Kind fKind;
|
|
|
|
|
|
|
|
typedef IRNode INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|