LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/sksl/ast - SkSLASTInterfaceBlock.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 20 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_ASTINTERFACEBLOCK
       9             : #define SKSL_ASTINTERFACEBLOCK
      10             : 
      11             : #include "SkSLASTVarDeclaration.h"
      12             : #include "../ir/SkSLModifiers.h"
      13             : 
      14             : namespace SkSL {
      15             : 
      16             : /**
      17             :  * An interface block, as in:
      18             :  *
      19             :  * out gl_PerVertex {
      20             :  *   layout(builtin=0) vec4 gl_Position;
      21             :  *   layout(builtin=1) float gl_PointSize;
      22             :  * };
      23             :  */
      24           0 : struct ASTInterfaceBlock : public ASTDeclaration {
      25             :     // valueName is empty when it was not present in the source
      26           0 :     ASTInterfaceBlock(Position position,
      27             :                       Modifiers modifiers,
      28             :                       String typeName,
      29             :                       std::vector<std::unique_ptr<ASTVarDeclarations>> declarations,
      30             :                       String instanceName,
      31             :                       std::vector<std::unique_ptr<ASTExpression>> sizes)
      32           0 :     : INHERITED(position, kInterfaceBlock_Kind)
      33             :     , fModifiers(modifiers)
      34           0 :     , fTypeName(std::move(typeName))
      35           0 :     , fDeclarations(std::move(declarations))
      36           0 :     , fInstanceName(std::move(instanceName))
      37           0 :     , fSizes(std::move(sizes)) {}
      38             : 
      39           0 :     String description() const override {
      40           0 :         String result = fModifiers.description() + fTypeName + " {\n";
      41           0 :         for (size_t i = 0; i < fDeclarations.size(); i++) {
      42           0 :             result += fDeclarations[i]->description() + "\n";
      43             :         }
      44           0 :         result += "}";
      45           0 :         if (fInstanceName.size()) {
      46           0 :             result += " " + fInstanceName;
      47           0 :             for (const auto& size : fSizes) {
      48           0 :                 result += "[";
      49           0 :                 if (size) {
      50           0 :                     result += size->description();
      51             :                 }
      52           0 :                 result += "]";
      53             :             }
      54             :         }
      55           0 :         return result + ";";
      56             :     }
      57             : 
      58             :     const Modifiers fModifiers;
      59             :     const String fTypeName;
      60             :     const std::vector<std::unique_ptr<ASTVarDeclarations>> fDeclarations;
      61             :     const String fInstanceName;
      62             :     const std::vector<std::unique_ptr<ASTExpression>> fSizes;
      63             : 
      64             :     typedef ASTDeclaration INHERITED;
      65             : };
      66             : 
      67             : } // namespace
      68             : 
      69             : #endif

Generated by: LCOV version 1.13