summaryrefslogtreecommitdiffstats
path: root/gfx/skia/skia/src/sksl/ir/SkSLLiteral.cpp
blob: aa8c5c444042b49e8cc4cfa9a709fa4636215858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Copyright 2022 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "include/private/SkSLString.h"
#include "src/sksl/ir/SkSLLiteral.h"

namespace SkSL {

std::string Literal::description(OperatorPrecedence) const {
    if (this->type().isBoolean()) {
        return fValue ? "true" : "false";
    }
    if (this->type().isInteger()) {
        return std::to_string(this->intValue());
    }
    return skstd::to_string(this->floatValue());
}

}  // namespace SkSL