mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-16 00:49:14 +00:00
Required special casing the ElseStatement, as this isn't actually owned by a BlockStatement. Change-Id: Ic33c207598b838a12b865a7694e596b2629c9208 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46443 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
// Copyright 2021 The Tint Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#ifndef SRC_SEMANTIC_STATEMENT_H_
|
|
#define SRC_SEMANTIC_STATEMENT_H_
|
|
|
|
#include "src/semantic/node.h"
|
|
|
|
namespace tint {
|
|
|
|
// Forward declarations
|
|
namespace ast {
|
|
class BlockStatement;
|
|
class Statement;
|
|
} // namespace ast
|
|
|
|
namespace semantic {
|
|
|
|
/// Statement holds the semantic information for a statement.
|
|
class Statement : public Castable<Statement, Node> {
|
|
public:
|
|
/// Constructor
|
|
/// @param declaration the AST node for this statement
|
|
/// @param block the owning AST block statement
|
|
Statement(const ast::Statement* declaration,
|
|
const ast::BlockStatement* block);
|
|
|
|
/// @return the AST node for this statement
|
|
const ast::Statement* Declaration() const { return declaration_; }
|
|
|
|
/// @return the owning AST block statement for this statement
|
|
const ast::BlockStatement* Block() const { return block_; }
|
|
|
|
private:
|
|
ast::Statement const* const declaration_;
|
|
ast::BlockStatement const* const block_;
|
|
};
|
|
|
|
} // namespace semantic
|
|
} // namespace tint
|
|
|
|
#endif // SRC_SEMANTIC_STATEMENT_H_
|