aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLSectionAndParameterHelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sksl/SkSLSectionAndParameterHelper.h')
-rw-r--r--src/sksl/SkSLSectionAndParameterHelper.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/sksl/SkSLSectionAndParameterHelper.h b/src/sksl/SkSLSectionAndParameterHelper.h
index fccfff473b..919cc7860c 100644
--- a/src/sksl/SkSLSectionAndParameterHelper.h
+++ b/src/sksl/SkSLSectionAndParameterHelper.h
@@ -39,11 +39,11 @@ namespace SkSL {
class SectionAndParameterHelper {
public:
SectionAndParameterHelper(const Program& program, ErrorReporter& errors) {
- for (const auto& p : program.fElements) {
- switch (p->fKind) {
+ for (const auto& p : program) {
+ switch (p.fKind) {
case ProgramElement::kVar_Kind: {
- const VarDeclarations* decls = (const VarDeclarations*) p.get();
- for (const auto& raw : decls->fVars) {
+ const VarDeclarations& decls = (const VarDeclarations&) p;
+ for (const auto& raw : decls.fVars) {
const VarDeclaration& decl = (VarDeclaration&) *raw;
if (IsParameter(*decl.fVar)) {
fParameters.push_back(decl.fVar);
@@ -52,28 +52,28 @@ public:
break;
}
case ProgramElement::kSection_Kind: {
- const Section* s = (const Section*) p.get();
- if (IsSupportedSection(s->fName.c_str())) {
- if (SectionAcceptsArgument(s->fName.c_str())) {
- if (!s->fArgument.size()) {
- errors.error(s->fOffset,
- ("section '@" + s->fName +
+ const Section& s = (const Section&) p;
+ if (IsSupportedSection(s.fName.c_str())) {
+ if (SectionAcceptsArgument(s.fName.c_str())) {
+ if (!s.fArgument.size()) {
+ errors.error(s.fOffset,
+ ("section '@" + s.fName +
"' requires one parameter").c_str());
}
- } else if (s->fArgument.size()) {
- errors.error(s->fOffset,
- ("section '@" + s->fName + "' has no parameters").c_str());
+ } else if (s.fArgument.size()) {
+ errors.error(s.fOffset,
+ ("section '@" + s.fName + "' has no parameters").c_str());
}
} else {
- errors.error(s->fOffset,
- ("unsupported section '@" + s->fName + "'").c_str());
+ errors.error(s.fOffset,
+ ("unsupported section '@" + s.fName + "'").c_str());
}
- if (!SectionPermitsDuplicates(s->fName.c_str()) &&
- fSections.find(s->fName) != fSections.end()) {
- errors.error(s->fOffset,
- ("duplicate section '@" + s->fName + "'").c_str());
+ if (!SectionPermitsDuplicates(s.fName.c_str()) &&
+ fSections.find(s.fName) != fSections.end()) {
+ errors.error(s.fOffset,
+ ("duplicate section '@" + s.fName + "'").c_str());
}
- fSections[s->fName].push_back(s);
+ fSections[s.fName].push_back(&s);
break;
}
default: