Coverage Report

Created: 2024-09-14 07:19

/src/skia/src/sksl/ir/SkSLSwitchCase.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2023 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
#include "src/sksl/ir/SkSLSwitchCase.h"
9
10
namespace SkSL {
11
12
std::unique_ptr<SwitchCase> SwitchCase::Make(Position pos,
13
                                             SKSL_INT value,
14
128
                                             std::unique_ptr<Statement> statement) {
15
128
    return std::unique_ptr<SwitchCase>(new SwitchCase(pos, /*isDefault=*/false, value,
16
128
                                                      std::move(statement)));
17
128
}
18
19
std::unique_ptr<SwitchCase> SwitchCase::MakeDefault(Position pos,
20
0
                                                    std::unique_ptr<Statement> statement) {
21
0
    return std::unique_ptr<SwitchCase>(new SwitchCase(pos, /*isDefault=*/true, /*value=*/-1,
22
0
                                                      std::move(statement)));
23
0
}
24
25
0
std::string SwitchCase::description() const {
26
0
    return fDefault ? "default: \n" + fStatement->description()
27
0
                    : "case " + std::to_string(fValue) + ": \n" + fStatement->description();
28
0
}
29
30
}  // namespace SkSL