blob: e3a0c36a0d789b5e2c9f5aac89fd9ede19297a23 [file] [log] [blame]
ethannicholasd598f792016-07-25 10:08:54 -07001/*
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 */
Ethan Nicholas0df1b042017-03-31 13:56:23 -04007
ethannicholasd598f792016-07-25 10:08:54 -07008#ifndef SKSL_CONTEXT
9#define SKSL_CONTEXT
10
John Stilesfbd050b2020-08-03 13:21:46 -040011#include <memory>
12
John Stilesac01aca2021-01-15 11:12:46 -050013#include "src/sksl/SkSLBuiltinTypes.h"
John Stilesb30151e2021-01-11 16:13:08 -050014#include "src/sksl/SkSLErrorReporter.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050015#include "src/sksl/ir/SkSLExpression.h"
16#include "src/sksl/ir/SkSLType.h"
ethannicholasd598f792016-07-25 10:08:54 -070017
18namespace SkSL {
19
20/**
21 * Contains compiler-wide objects, which currently means the core types.
22 */
23class Context {
24public:
John Stilesb30151e2021-01-11 16:13:08 -050025 Context(ErrorReporter& errors);
Brian Salomon2a51de82016-11-16 12:06:01 -050026
John Stiles54e7c052021-01-11 14:22:36 -050027 // The Context holds all of the built-in types.
28 BuiltinTypes fTypes;
Brian Salomon2a51de82016-11-16 12:06:01 -050029
John Stilesb30151e2021-01-11 16:13:08 -050030 // The Context holds a reference to our error reporter.
31 ErrorReporter& fErrors;
32
John Stiles54e7c052021-01-11 14:22:36 -050033 // A sentinel expression used to mark that a variable has a value during dataflow analysis (when
Leon Scroggins III577536a2020-07-31 13:47:50 -040034 // it could have several different values, or the analyzer is otherwise unable to assign it a
ethannicholas22f939e2016-10-13 13:25:34 -070035 // specific expression)
36 const std::unique_ptr<Expression> fDefined_Expression;
ethannicholasd598f792016-07-25 10:08:54 -070037};
38
John Stilesa6841be2020-08-06 14:11:56 -040039} // namespace SkSL
ethannicholasd598f792016-07-25 10:08:54 -070040
41#endif