blob: 8ec5bf6789eeead099cb7255b44ea9bc61e9e455 [file] [log] [blame]
ethannicholasb3058bd2016-07-01 08:22:01 -07001/*
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 */
Ethan Nicholas0df1b042017-03-31 13:56:23 -04007
ethannicholasb3058bd2016-07-01 08:22:01 -07008#ifndef SKSL_ASTVARDECLARATIONSTATEMENT
9#define SKSL_ASTVARDECLARATIONSTATEMENT
10
11#include "SkSLASTStatement.h"
12#include "SkSLASTVarDeclaration.h"
13
14namespace SkSL {
15
16/**
17 * A variable declaration appearing as a statement within a function.
18 */
19struct ASTVarDeclarationStatement : public ASTStatement {
ethannicholas14fe8cc2016-09-07 13:37:16 -070020 ASTVarDeclarationStatement(std::unique_ptr<ASTVarDeclarations> decl)
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070021 : INHERITED(decl->fOffset, kVarDeclaration_Kind)
ethannicholas14fe8cc2016-09-07 13:37:16 -070022 , fDeclarations(std::move(decl)) {}
ethannicholasb3058bd2016-07-01 08:22:01 -070023
Ethan Nicholas0df1b042017-03-31 13:56:23 -040024 String description() const override {
ethannicholas14fe8cc2016-09-07 13:37:16 -070025 return fDeclarations->description() + ";";
ethannicholasb3058bd2016-07-01 08:22:01 -070026 }
27
ethannicholas14fe8cc2016-09-07 13:37:16 -070028 std::unique_ptr<ASTVarDeclarations> fDeclarations;
ethannicholasb3058bd2016-07-01 08:22:01 -070029
30 typedef ASTStatement INHERITED;
31};
32
33} // namespace
34
35#endif