LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/sksl/ast - SkSLASTFunction.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 17 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_ASTFUNCTION
       9             : #define SKSL_ASTFUNCTION
      10             : 
      11             : #include "SkSLASTBlock.h"
      12             : #include "SkSLASTDeclaration.h"
      13             : #include "SkSLASTParameter.h"
      14             : #include "SkSLASTType.h"
      15             : 
      16             : namespace SkSL {
      17             : 
      18             : /**
      19             :  * A function declaration or definition. The fBody field will be null for declarations.
      20             :  */
      21           0 : struct ASTFunction : public ASTDeclaration {
      22           0 :     ASTFunction(Position position, std::unique_ptr<ASTType> returnType, String name,
      23             :                 std::vector<std::unique_ptr<ASTParameter>> parameters,
      24             :                 std::unique_ptr<ASTBlock> body)
      25           0 :     : INHERITED(position, kFunction_Kind)
      26           0 :     , fReturnType(std::move(returnType))
      27           0 :     , fName(std::move(name))
      28           0 :     , fParameters(std::move(parameters))
      29           0 :     , fBody(std::move(body)) {}
      30             : 
      31           0 :     String description() const override {
      32           0 :         String result = fReturnType->description() + " " + fName + "(";
      33           0 :         for (size_t i = 0; i < fParameters.size(); i++) {
      34           0 :             if (i > 0) {
      35           0 :                 result += ", ";
      36             :             }
      37           0 :             result += fParameters[i]->description();
      38             :         }
      39           0 :         if (fBody) {
      40           0 :             result += ") " + fBody->description();
      41             :         } else {
      42           0 :             result += ");";
      43             :         }
      44           0 :         return result;
      45             :     }
      46             : 
      47             :     const std::unique_ptr<ASTType> fReturnType;
      48             :     const String fName;
      49             :     const std::vector<std::unique_ptr<ASTParameter>> fParameters;
      50             :     const std::unique_ptr<ASTBlock> fBody;
      51             : 
      52             :     typedef ASTDeclaration INHERITED;
      53             : };
      54             : 
      55             : } // namespace
      56             : 
      57             : #endif

Generated by: LCOV version 1.13