1 /* 2 * Copyright 2021 Google LLC. 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 "include/sksl/SkSLErrorReporter.h" 9 10 #include "include/private/SkStringView.h" 11 #include "src/sksl/SkSLCompiler.h" 12 #include "src/sksl/dsl/priv/DSLWriter.h" 13 14 namespace SkSL { 15 error(std::string_view msg,PositionInfo position)16void ErrorReporter::error(std::string_view msg, PositionInfo position) { 17 if (skstd::contains(msg, Compiler::POISON_TAG)) { 18 // don't report errors on poison values 19 return; 20 } 21 ++fErrorCount; 22 this->handleError(msg, position); 23 } 24 error(int line,std::string_view msg)25void ErrorReporter::error(int line, std::string_view msg) { 26 if (skstd::contains(msg, Compiler::POISON_TAG)) { 27 // don't report errors on poison values 28 return; 29 } 30 if (line == -1) { 31 ++fErrorCount; 32 fPendingErrors.push_back(std::string(msg)); 33 } else { 34 this->error(msg, PositionInfo(/*file=*/nullptr, line)); 35 } 36 } 37 38 } // namespace SkSL 39