Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 */ | |
| 7 | |
| 8 #ifndef SKSL_FIELD | |
| 9 #define SKSL_FIELD | |
| 10 | |
| 11 #include "SkSLModifiers.h" | |
| 12 #include "SkSLPosition.h" | |
| 13 #include "SkSLSymbol.h" | |
| 14 #include "SkSLType.h" | |
| 15 | |
| 16 namespace SkSL { | |
| 17 | |
| 18 /** | |
| 19 * A symbol which should be interpreted as a field access. Fields are added to t he symboltable | |
| 20 * whenever a bare reference to an identifier should refer to a struct field; in GLSL, this is the | |
| 21 * result of declaring anonymous interface blocks. | |
| 22 */ | |
| 23 struct Field : public Symbol { | |
|
dogben
2016/06/28 03:20:01
nit: maybe rename InterfaceField?
| |
| 24 Field(Position position, std::shared_ptr<Variable> owner, int fieldIndex) | |
| 25 : INHERITED(position, kField_Kind, owner->fType->fields()[fieldIndex].fName) | |
| 26 , fOwner(owner) | |
| 27 , fFieldIndex(fieldIndex) {} | |
| 28 | |
| 29 virtual std::string description() const override { | |
| 30 return fOwner->description() + "." + fOwner->fType->fields()[fFieldIndex ].fName; | |
| 31 } | |
| 32 | |
| 33 const std::shared_ptr<Variable> fOwner; | |
| 34 const int fFieldIndex; | |
| 35 | |
| 36 typedef Symbol INHERITED; | |
| 37 }; | |
| 38 | |
| 39 } // namespace SkSL | |
| 40 | |
| 41 #endif | |
| OLD | NEW |