blob: 67e04667632b8c2ee5ee42fccaefab262ee36fd8 [file] [log] [blame]
ethannicholasb3058bd2016-07-01 08:22:01 -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 */
7
8#ifndef SKSL_TYPEREFERENCE
9#define SKSL_TYPEREFERENCE
10
ethannicholasd598f792016-07-25 10:08:54 -070011#include "SkSLContext.h"
ethannicholasb3058bd2016-07-01 08:22:01 -070012#include "SkSLExpression.h"
13
14namespace SkSL {
15
16/**
17 * Represents an identifier referring to a type. This is an intermediate value: TypeReferences are
18 * always eventually replaced by Constructors in valid programs.
19 */
20struct TypeReference : public Expression {
ethannicholasd598f792016-07-25 10:08:54 -070021 TypeReference(const Context& context, Position position, const Type& type)
22 : INHERITED(position, kTypeReference_Kind, *context.fInvalid_Type)
23 , fValue(type) {}
ethannicholasb3058bd2016-07-01 08:22:01 -070024
Greg Daniel792d0f12016-11-20 14:53:35 +000025 std::string description() const override {
ethannicholasea4567c2016-10-17 11:24:37 -070026 return fValue.name();
ethannicholasb3058bd2016-07-01 08:22:01 -070027 }
28
ethannicholasd598f792016-07-25 10:08:54 -070029 const Type& fValue;
ethannicholasb3058bd2016-07-01 08:22:01 -070030
31 typedef Expression INHERITED;
32};
33
34} // namespace
35
36#endif