xref: /aosp_15_r20/external/skia/src/sksl/ir/SkSLLiteral.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2022 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/SkSLString.h"
9 #include "src/sksl/ir/SkSLLiteral.h"
10 
11 namespace SkSL {
12 
description(OperatorPrecedence) const13 std::string Literal::description(OperatorPrecedence) const {
14     if (this->type().isBoolean()) {
15         return fValue ? "true" : "false";
16     }
17     if (this->type().isInteger()) {
18         return std::to_string(this->intValue());
19     }
20     return skstd::to_string(this->floatValue());
21 }
22 
23 }  // namespace SkSL
24