ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 1 | /* |
| 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 Nicholas | 0df1b04 | 2017-03-31 13:56:23 -0400 | [diff] [blame] | 7 | |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 8 | #ifndef SKSL_CONTEXT |
| 9 | #define SKSL_CONTEXT |
| 10 | |
John Stiles | fbd050b | 2020-08-03 13:21:46 -0400 | [diff] [blame] | 11 | #include <memory> |
| 12 | |
John Stiles | ac01aca | 2021-01-15 11:12:46 -0500 | [diff] [blame] | 13 | #include "src/sksl/SkSLBuiltinTypes.h" |
John Stiles | b30151e | 2021-01-11 16:13:08 -0500 | [diff] [blame] | 14 | #include "src/sksl/SkSLErrorReporter.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 15 | #include "src/sksl/ir/SkSLExpression.h" |
| 16 | #include "src/sksl/ir/SkSLType.h" |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 17 | |
| 18 | namespace SkSL { |
| 19 | |
| 20 | /** |
| 21 | * Contains compiler-wide objects, which currently means the core types. |
| 22 | */ |
| 23 | class Context { |
| 24 | public: |
John Stiles | b30151e | 2021-01-11 16:13:08 -0500 | [diff] [blame] | 25 | Context(ErrorReporter& errors); |
Brian Salomon | 2a51de8 | 2016-11-16 12:06:01 -0500 | [diff] [blame] | 26 | |
John Stiles | 54e7c05 | 2021-01-11 14:22:36 -0500 | [diff] [blame] | 27 | // The Context holds all of the built-in types. |
| 28 | BuiltinTypes fTypes; |
Brian Salomon | 2a51de8 | 2016-11-16 12:06:01 -0500 | [diff] [blame] | 29 | |
John Stiles | b30151e | 2021-01-11 16:13:08 -0500 | [diff] [blame] | 30 | // The Context holds a reference to our error reporter. |
| 31 | ErrorReporter& fErrors; |
| 32 | |
John Stiles | 54e7c05 | 2021-01-11 14:22:36 -0500 | [diff] [blame] | 33 | // A sentinel expression used to mark that a variable has a value during dataflow analysis (when |
Leon Scroggins III | 577536a | 2020-07-31 13:47:50 -0400 | [diff] [blame] | 34 | // it could have several different values, or the analyzer is otherwise unable to assign it a |
ethannicholas | 22f939e | 2016-10-13 13:25:34 -0700 | [diff] [blame] | 35 | // specific expression) |
| 36 | const std::unique_ptr<Expression> fDefined_Expression; |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 37 | }; |
| 38 | |
John Stiles | a6841be | 2020-08-06 14:11:56 -0400 | [diff] [blame] | 39 | } // namespace SkSL |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 40 | |
| 41 | #endif |