Skip to content

Commit

Permalink
Traverse FieldAccess' base expression in visitExpression.
Browse files Browse the repository at this point in the history
The absence of the FieldAccess::fBase traversal appears to be a simple
oversight. This doesn't appear to affect any tests.

Change-Id: I82a5828acedd00f62bf177bd2cf70d67071a83fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319413
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
  • Loading branch information
johnstiles-google authored and Skia Commit-Bot committed Sep 25, 2020
1 parent 3b88c07 commit d7ab450
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/sksl/SkSLAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class MergeSampleUsageVisitor : public ProgramVisitor {

SampleUsage visit(const Program& program) {
fUsage = SampleUsage(); // reset to none
this->INHERITED::visit(program);
INHERITED::visit(program);
return fUsage;
}

Expand Down Expand Up @@ -125,7 +125,7 @@ class MergeSampleUsageVisitor : public ProgramVisitor {
}
}

return this->INHERITED::visitExpression(e);
return INHERITED::visitExpression(e);
}

using INHERITED = ProgramVisitor;
Expand All @@ -141,7 +141,7 @@ class BuiltinVariableVisitor : public ProgramVisitor {
const VariableReference& var = e.as<VariableReference>();
return var.fVariable->fModifiers.fLayout.fBuiltin == fBuiltin;
}
return this->INHERITED::visitExpression(e);
return INHERITED::visitExpression(e);
}

int fBuiltin;
Expand All @@ -160,17 +160,17 @@ class NodeCountVisitor : public ProgramVisitor {

bool visitExpression(const Expression& e) override {
++fCount;
return this->INHERITED::visitExpression(e);
return INHERITED::visitExpression(e);
}

bool visitProgramElement(const ProgramElement& p) override {
++fCount;
return this->INHERITED::visitProgramElement(p);
return INHERITED::visitProgramElement(p);
}

bool visitStatement(const Statement& s) override {
++fCount;
return this->INHERITED::visitStatement(s);
return INHERITED::visitStatement(s);
}

private:
Expand All @@ -197,7 +197,7 @@ class VariableWriteVisitor : public ProgramVisitor {
return true;
}
}
return this->INHERITED::visitExpression(e);
return INHERITED::visitExpression(e);
}

private:
Expand Down Expand Up @@ -254,7 +254,6 @@ bool ProgramVisitor::visitExpression(const Expression& e) {
case Expression::Kind::kBoolLiteral:
case Expression::Kind::kDefined:
case Expression::Kind::kExternalValue:
case Expression::Kind::kFieldAccess:
case Expression::Kind::kFloatLiteral:
case Expression::Kind::kFunctionReference:
case Expression::Kind::kIntLiteral:
Expand All @@ -279,6 +278,8 @@ bool ProgramVisitor::visitExpression(const Expression& e) {
if (this->visitExpression(*arg)) { return true; }
}
return false; }
case Expression::Kind::kFieldAccess:
return this->visitExpression(*e.as<FieldAccess>().fBase);
case Expression::Kind::kFunctionCall: {
const FunctionCall& c = e.as<FunctionCall>();
for (const auto& arg : c.fArguments) {
Expand Down

0 comments on commit d7ab450

Please sign in to comment.