Home | History | Annotate | Download | only in ir
      1 /*
      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  */
      7 
      8 #ifndef SKSL_EXPRESSIONSTATEMENT
      9 #define SKSL_EXPRESSIONSTATEMENT
     10 
     11 #include "SkSLExpression.h"
     12 #include "SkSLStatement.h"
     13 
     14 namespace SkSL {
     15 
     16 /**
     17  * A lone expression being used as a statement.
     18  */
     19 struct ExpressionStatement : public Statement {
     20     ExpressionStatement(std::unique_ptr<Expression> expression)
     21     : INHERITED(expression->fOffset, kExpression_Kind)
     22     , fExpression(std::move(expression)) {}
     23 
     24     String description() const override {
     25         return fExpression->description() + ";";
     26     }
     27 
     28     std::unique_ptr<Expression> fExpression;
     29 
     30     typedef Statement INHERITED;
     31 };
     32 
     33 } // namespace
     34 
     35 #endif
     36