aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ast
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2016-11-20 14:53:35 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-20 14:53:48 +0000
commit792d0f13d6cb58ddf27b45e6835ba54c1d8ade77 (patch)
tree929ba3d4638561e480bb070da4d01eec2cce21ab /src/sksl/ast
parent7a5b48a75b6f5819c196d158eefa70677783554f (diff)
Revert "switched skslc from std::string to SkString"
This reverts commit d8df21a1e08b5b3380261f4b90acfbdc538ef93c. Reason for revert: Breaking Roll Original change's description: > switched skslc from std::string to SkString > > BUG=skia: > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4977 > > Change-Id: I15e24963b09b719a2c07da67745114f5ac66cee8 > Reviewed-on: https://skia-review.googlesource.com/4977 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > TBR=bsalomon@google.com,benjaminwagner@google.com,ethannicholas@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I84d5311beb9d5e607b7a4a3c138332f0c8f19648 Reviewed-on: https://skia-review.googlesource.com/5077 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/sksl/ast')
-rw-r--r--src/sksl/ast/SkSLASTBinaryExpression.h3
-rw-r--r--src/sksl/ast/SkSLASTBlock.h4
-rw-r--r--src/sksl/ast/SkSLASTBoolLiteral.h4
-rw-r--r--src/sksl/ast/SkSLASTBreakStatement.h4
-rw-r--r--src/sksl/ast/SkSLASTCallSuffix.h7
-rw-r--r--src/sksl/ast/SkSLASTContinueStatement.h4
-rw-r--r--src/sksl/ast/SkSLASTDiscardStatement.h4
-rw-r--r--src/sksl/ast/SkSLASTDoStatement.h2
-rw-r--r--src/sksl/ast/SkSLASTExpressionStatement.h2
-rw-r--r--src/sksl/ast/SkSLASTExtension.h6
-rw-r--r--src/sksl/ast/SkSLASTFieldSuffix.h6
-rw-r--r--src/sksl/ast/SkSLASTFloatLiteral.h2
-rw-r--r--src/sksl/ast/SkSLASTForStatement.h4
-rw-r--r--src/sksl/ast/SkSLASTFunction.h8
-rw-r--r--src/sksl/ast/SkSLASTIdentifier.h6
-rw-r--r--src/sksl/ast/SkSLASTIfStatement.h4
-rw-r--r--src/sksl/ast/SkSLASTIndexSuffix.h4
-rw-r--r--src/sksl/ast/SkSLASTIntLiteral.h2
-rw-r--r--src/sksl/ast/SkSLASTInterfaceBlock.h14
-rw-r--r--src/sksl/ast/SkSLASTLayout.h10
-rw-r--r--src/sksl/ast/SkSLASTModifiers.h4
-rw-r--r--src/sksl/ast/SkSLASTModifiersDeclaration.h2
-rw-r--r--src/sksl/ast/SkSLASTNode.h5
-rw-r--r--src/sksl/ast/SkSLASTParameter.h8
-rw-r--r--src/sksl/ast/SkSLASTPrecision.h12
-rw-r--r--src/sksl/ast/SkSLASTPrefixExpression.h2
-rw-r--r--src/sksl/ast/SkSLASTReturnStatement.h4
-rw-r--r--src/sksl/ast/SkSLASTSuffix.h6
-rw-r--r--src/sksl/ast/SkSLASTSuffixExpression.h2
-rw-r--r--src/sksl/ast/SkSLASTTernaryExpression.h2
-rw-r--r--src/sksl/ast/SkSLASTType.h6
-rw-r--r--src/sksl/ast/SkSLASTVarDeclaration.h14
-rw-r--r--src/sksl/ast/SkSLASTVarDeclarationStatement.h2
-rw-r--r--src/sksl/ast/SkSLASTWhileStatement.h2
34 files changed, 87 insertions, 84 deletions
diff --git a/src/sksl/ast/SkSLASTBinaryExpression.h b/src/sksl/ast/SkSLASTBinaryExpression.h
index c4b6e3a45b..88feba66a7 100644
--- a/src/sksl/ast/SkSLASTBinaryExpression.h
+++ b/src/sksl/ast/SkSLASTBinaryExpression.h
@@ -10,6 +10,7 @@
#include "SkSLASTExpression.h"
#include "../SkSLToken.h"
+#include <sstream>
namespace SkSL {
@@ -24,7 +25,7 @@ struct ASTBinaryExpression : public ASTExpression {
, fOperator(op.fKind)
, fRight(std::move(right)) {}
- SkString description() const override {
+ std::string description() const override {
return "(" + fLeft->description() + " " + Token::OperatorName(fOperator) + " " +
fRight->description() + ")";
}
diff --git a/src/sksl/ast/SkSLASTBlock.h b/src/sksl/ast/SkSLASTBlock.h
index 6b1e9c5551..09450a3db8 100644
--- a/src/sksl/ast/SkSLASTBlock.h
+++ b/src/sksl/ast/SkSLASTBlock.h
@@ -20,8 +20,8 @@ struct ASTBlock : public ASTStatement {
: INHERITED(position, kBlock_Kind)
, fStatements(std::move(statements)) {}
- SkString description() const override {
- SkString result("{");
+ std::string description() const override {
+ std::string result("{");
for (size_t i = 0; i < fStatements.size(); i++) {
result += "\n";
result += fStatements[i]->description();
diff --git a/src/sksl/ast/SkSLASTBoolLiteral.h b/src/sksl/ast/SkSLASTBoolLiteral.h
index 02f4bac0da..ff58822952 100644
--- a/src/sksl/ast/SkSLASTBoolLiteral.h
+++ b/src/sksl/ast/SkSLASTBoolLiteral.h
@@ -20,8 +20,8 @@ struct ASTBoolLiteral : public ASTExpression {
: INHERITED(position, kBool_Kind)
, fValue(value) {}
- SkString description() const override {
- return SkString(fValue ? "true" : "false");
+ std::string description() const override {
+ return fValue ? "true" : "false";
}
const bool fValue;
diff --git a/src/sksl/ast/SkSLASTBreakStatement.h b/src/sksl/ast/SkSLASTBreakStatement.h
index dad2a85c0a..ede548cc24 100644
--- a/src/sksl/ast/SkSLASTBreakStatement.h
+++ b/src/sksl/ast/SkSLASTBreakStatement.h
@@ -19,8 +19,8 @@ struct ASTBreakStatement : public ASTStatement {
ASTBreakStatement(Position position)
: INHERITED(position, kBreak_Kind) {}
- SkString description() const override {
- return SkString("break;");
+ std::string description() const override {
+ return "break;";
}
typedef ASTStatement INHERITED;
diff --git a/src/sksl/ast/SkSLASTCallSuffix.h b/src/sksl/ast/SkSLASTCallSuffix.h
index 356ac850f9..5cff6f6c93 100644
--- a/src/sksl/ast/SkSLASTCallSuffix.h
+++ b/src/sksl/ast/SkSLASTCallSuffix.h
@@ -8,6 +8,7 @@
#ifndef SKSL_ASTCALLSUFFIX
#define SKSL_ASTCALLSUFFIX
+#include <sstream>
#include <vector>
#include "SkSLASTSuffix.h"
@@ -21,9 +22,9 @@ struct ASTCallSuffix : public ASTSuffix {
: INHERITED(position, ASTSuffix::kCall_Kind)
, fArguments(std::move(arguments)) {}
- SkString description() const override {
- SkString result("(");
- SkString separator;
+ std::string description() const override {
+ std::string result("(");
+ std::string separator = "";
for (size_t i = 0; i < fArguments.size(); ++i) {
result += separator;
separator = ", ";
diff --git a/src/sksl/ast/SkSLASTContinueStatement.h b/src/sksl/ast/SkSLASTContinueStatement.h
index 4cded3b16b..d5ab7a5c74 100644
--- a/src/sksl/ast/SkSLASTContinueStatement.h
+++ b/src/sksl/ast/SkSLASTContinueStatement.h
@@ -19,8 +19,8 @@ struct ASTContinueStatement : public ASTStatement {
ASTContinueStatement(Position position)
: INHERITED(position, kContinue_Kind) {}
- SkString description() const override {
- return SkString("continue;");
+ std::string description() const override {
+ return "continue;";
}
typedef ASTStatement INHERITED;
diff --git a/src/sksl/ast/SkSLASTDiscardStatement.h b/src/sksl/ast/SkSLASTDiscardStatement.h
index 754bf95efe..4eaeec9ea4 100644
--- a/src/sksl/ast/SkSLASTDiscardStatement.h
+++ b/src/sksl/ast/SkSLASTDiscardStatement.h
@@ -19,8 +19,8 @@ struct ASTDiscardStatement : public ASTStatement {
ASTDiscardStatement(Position position)
: INHERITED(position, kDiscard_Kind) {}
- SkString description() const override {
- return SkString("discard;");
+ std::string description() const override {
+ return "discard;";
}
typedef ASTStatement INHERITED;
diff --git a/src/sksl/ast/SkSLASTDoStatement.h b/src/sksl/ast/SkSLASTDoStatement.h
index 9a0caced1c..a952d62eb5 100644
--- a/src/sksl/ast/SkSLASTDoStatement.h
+++ b/src/sksl/ast/SkSLASTDoStatement.h
@@ -22,7 +22,7 @@ struct ASTDoStatement : public ASTStatement {
, fStatement(std::move(statement))
, fTest(std::move(test)) {}
- SkString description() const override {
+ std::string description() const override {
return "do " + fStatement->description() + " while (" + fTest->description() + ");";
}
diff --git a/src/sksl/ast/SkSLASTExpressionStatement.h b/src/sksl/ast/SkSLASTExpressionStatement.h
index 2dbd20940d..450cca29fc 100644
--- a/src/sksl/ast/SkSLASTExpressionStatement.h
+++ b/src/sksl/ast/SkSLASTExpressionStatement.h
@@ -20,7 +20,7 @@ struct ASTExpressionStatement : public ASTStatement {
: INHERITED(expression->fPosition, kExpression_Kind)
, fExpression(std::move(expression)) {}
- SkString description() const override {
+ std::string description() const override {
return fExpression->description() + ";";
}
diff --git a/src/sksl/ast/SkSLASTExtension.h b/src/sksl/ast/SkSLASTExtension.h
index b9df3c52e9..896ac46c58 100644
--- a/src/sksl/ast/SkSLASTExtension.h
+++ b/src/sksl/ast/SkSLASTExtension.h
@@ -16,15 +16,15 @@ namespace SkSL {
* An extension declaration.
*/
struct ASTExtension : public ASTDeclaration {
- ASTExtension(Position position, SkString name)
+ ASTExtension(Position position, std::string name)
: INHERITED(position, kExtension_Kind)
, fName(std::move(name)) {}
- SkString description() const override {
+ std::string description() const override {
return "#extension " + fName + " : enable";
}
- const SkString fName;
+ const std::string fName;
typedef ASTDeclaration INHERITED;
};
diff --git a/src/sksl/ast/SkSLASTFieldSuffix.h b/src/sksl/ast/SkSLASTFieldSuffix.h
index 9ee8531bf1..cf141d822f 100644
--- a/src/sksl/ast/SkSLASTFieldSuffix.h
+++ b/src/sksl/ast/SkSLASTFieldSuffix.h
@@ -17,15 +17,15 @@ namespace SkSL {
* actually vector swizzle (which looks the same to the parser).
*/
struct ASTFieldSuffix : public ASTSuffix {
- ASTFieldSuffix(Position position, SkString field)
+ ASTFieldSuffix(Position position, std::string field)
: INHERITED(position, ASTSuffix::kField_Kind)
, fField(std::move(field)) {}
- SkString description() const override {
+ std::string description() const override {
return "." + fField;
}
- SkString fField;
+ std::string fField;
typedef ASTSuffix INHERITED;
};
diff --git a/src/sksl/ast/SkSLASTFloatLiteral.h b/src/sksl/ast/SkSLASTFloatLiteral.h
index ea0f595abc..89d43cc003 100644
--- a/src/sksl/ast/SkSLASTFloatLiteral.h
+++ b/src/sksl/ast/SkSLASTFloatLiteral.h
@@ -20,7 +20,7 @@ struct ASTFloatLiteral : public ASTExpression {
: INHERITED(position, kFloat_Kind)
, fValue(value) {}
- SkString description() const override {
+ std::string description() const override {
return to_string(fValue);
}
diff --git a/src/sksl/ast/SkSLASTForStatement.h b/src/sksl/ast/SkSLASTForStatement.h
index 2706a39954..f4f68c8f40 100644
--- a/src/sksl/ast/SkSLASTForStatement.h
+++ b/src/sksl/ast/SkSLASTForStatement.h
@@ -25,8 +25,8 @@ struct ASTForStatement : public ASTStatement {
, fNext(std::move(next))
, fStatement(std::move(statement)) {}
- SkString description() const override {
- SkString result("for (");
+ std::string description() const override {
+ std::string result = "for (";
if (fInitializer) {
result.append(fInitializer->description());
}
diff --git a/src/sksl/ast/SkSLASTFunction.h b/src/sksl/ast/SkSLASTFunction.h
index 32f4da71f2..c5c3b9ad83 100644
--- a/src/sksl/ast/SkSLASTFunction.h
+++ b/src/sksl/ast/SkSLASTFunction.h
@@ -19,7 +19,7 @@ namespace SkSL {
* A function declaration or definition. The fBody field will be null for declarations.
*/
struct ASTFunction : public ASTDeclaration {
- ASTFunction(Position position, std::unique_ptr<ASTType> returnType, SkString name,
+ ASTFunction(Position position, std::unique_ptr<ASTType> returnType, std::string name,
std::vector<std::unique_ptr<ASTParameter>> parameters,
std::unique_ptr<ASTBlock> body)
: INHERITED(position, kFunction_Kind)
@@ -28,8 +28,8 @@ struct ASTFunction : public ASTDeclaration {
, fParameters(std::move(parameters))
, fBody(std::move(body)) {}
- SkString description() const override {
- SkString result = fReturnType->description() + " " + fName + "(";
+ std::string description() const override {
+ std::string result = fReturnType->description() + " " + fName + "(";
for (size_t i = 0; i < fParameters.size(); i++) {
if (i > 0) {
result += ", ";
@@ -45,7 +45,7 @@ struct ASTFunction : public ASTDeclaration {
}
const std::unique_ptr<ASTType> fReturnType;
- const SkString fName;
+ const std::string fName;
const std::vector<std::unique_ptr<ASTParameter>> fParameters;
const std::unique_ptr<ASTBlock> fBody;
diff --git a/src/sksl/ast/SkSLASTIdentifier.h b/src/sksl/ast/SkSLASTIdentifier.h
index aa0179a18f..d67f64d39b 100644
--- a/src/sksl/ast/SkSLASTIdentifier.h
+++ b/src/sksl/ast/SkSLASTIdentifier.h
@@ -16,15 +16,15 @@ namespace SkSL {
* An identifier in an expression context.
*/
struct ASTIdentifier : public ASTExpression {
- ASTIdentifier(Position position, SkString text)
+ ASTIdentifier(Position position, std::string text)
: INHERITED(position, kIdentifier_Kind)
, fText(std::move(text)) {}
- SkString description() const override {
+ std::string description() const override {
return fText;
}
- const SkString fText;
+ const std::string fText;
typedef ASTExpression INHERITED;
};
diff --git a/src/sksl/ast/SkSLASTIfStatement.h b/src/sksl/ast/SkSLASTIfStatement.h
index d169702710..06f663d5fb 100644
--- a/src/sksl/ast/SkSLASTIfStatement.h
+++ b/src/sksl/ast/SkSLASTIfStatement.h
@@ -23,8 +23,8 @@ struct ASTIfStatement : public ASTStatement {
, fIfTrue(std::move(ifTrue))
, fIfFalse(std::move(ifFalse)) {}
- SkString description() const override {
- SkString result("if (");
+ std::string description() const override {
+ std::string result("if (");
result += fTest->description();
result += ") ";
result += fIfTrue->description();
diff --git a/src/sksl/ast/SkSLASTIndexSuffix.h b/src/sksl/ast/SkSLASTIndexSuffix.h
index 2b7cd48417..755029b0a2 100644
--- a/src/sksl/ast/SkSLASTIndexSuffix.h
+++ b/src/sksl/ast/SkSLASTIndexSuffix.h
@@ -26,11 +26,11 @@ struct ASTIndexSuffix : public ASTSuffix {
: INHERITED(expression ? expression->fPosition : Position(), ASTSuffix::kIndex_Kind)
, fExpression(std::move(expression)) {}
- SkString description() const override {
+ std::string description() const override {
if (fExpression) {
return "[" + fExpression->description() + "]";
} else {
- return SkString("[]");
+ return "[]";
}
}
diff --git a/src/sksl/ast/SkSLASTIntLiteral.h b/src/sksl/ast/SkSLASTIntLiteral.h
index f524bc04ad..2598847534 100644
--- a/src/sksl/ast/SkSLASTIntLiteral.h
+++ b/src/sksl/ast/SkSLASTIntLiteral.h
@@ -21,7 +21,7 @@ struct ASTIntLiteral : public ASTExpression {
: INHERITED(position, kInt_Kind)
, fValue(value) {}
- SkString description() const override {
+ std::string description() const override {
return to_string(fValue);
}
diff --git a/src/sksl/ast/SkSLASTInterfaceBlock.h b/src/sksl/ast/SkSLASTInterfaceBlock.h
index 8d86c7c4f1..c271362071 100644
--- a/src/sksl/ast/SkSLASTInterfaceBlock.h
+++ b/src/sksl/ast/SkSLASTInterfaceBlock.h
@@ -24,8 +24,8 @@ struct ASTInterfaceBlock : public ASTDeclaration {
// valueName is empty when it was not present in the source
ASTInterfaceBlock(Position position,
ASTModifiers modifiers,
- SkString interfaceName,
- SkString valueName,
+ std::string interfaceName,
+ std::string valueName,
std::vector<std::unique_ptr<ASTVarDeclarations>> declarations)
: INHERITED(position, kInterfaceBlock_Kind)
, fModifiers(modifiers)
@@ -33,21 +33,21 @@ struct ASTInterfaceBlock : public ASTDeclaration {
, fValueName(std::move(valueName))
, fDeclarations(std::move(declarations)) {}
- SkString description() const override {
- SkString result = fModifiers.description() + fInterfaceName + " {\n";
+ std::string description() const override {
+ std::string result = fModifiers.description() + fInterfaceName + " {\n";
for (size_t i = 0; i < fDeclarations.size(); i++) {
result += fDeclarations[i]->description() + "\n";
}
result += "}";
- if (fValueName.size()) {
+ if (fValueName.length()) {
result += " " + fValueName;
}
return result + ";";
}
const ASTModifiers fModifiers;
- const SkString fInterfaceName;
- const SkString fValueName;
+ const std::string fInterfaceName;
+ const std::string fValueName;
const std::vector<std::unique_ptr<ASTVarDeclarations>> fDeclarations;
typedef ASTDeclaration INHERITED;
diff --git a/src/sksl/ast/SkSLASTLayout.h b/src/sksl/ast/SkSLASTLayout.h
index cb7f3c175c..ae3c3b6168 100644
--- a/src/sksl/ast/SkSLASTLayout.h
+++ b/src/sksl/ast/SkSLASTLayout.h
@@ -48,7 +48,7 @@ struct ASTLayout : public ASTNode {
return "";
}
- static bool ReadFormat(SkString str, Format* format) {
+ static bool ReadFormat(std::string str, Format* format) {
if (str == "rgba32f") {
*format = Format::kRGBA32F;
return true;
@@ -90,9 +90,9 @@ struct ASTLayout : public ASTNode {
, fBlendSupportAllEquations(blendSupportAllEquations)
, fFormat(format) {}
- SkString description() const {
- SkString result;
- SkString separator;
+ std::string description() const {
+ std::string result;
+ std::string separator;
if (fLocation >= 0) {
result += separator + "location = " + to_string(fLocation);
separator = ", ";
@@ -129,7 +129,7 @@ struct ASTLayout : public ASTNode {
result += separator + FormatToStr(fFormat);
separator = ", ";
}
- if (result.size() > 0) {
+ if (result.length() > 0) {
result = "layout (" + result + ")";
}
return result;
diff --git a/src/sksl/ast/SkSLASTModifiers.h b/src/sksl/ast/SkSLASTModifiers.h
index 734169267c..61d2e9f25d 100644
--- a/src/sksl/ast/SkSLASTModifiers.h
+++ b/src/sksl/ast/SkSLASTModifiers.h
@@ -34,8 +34,8 @@ struct ASTModifiers : public ASTNode {
: fLayout(layout)
, fFlags(flags) {}
- SkString description() const override {
- SkString result = fLayout.description();
+ std::string description() const override {
+ std::string result = fLayout.description();
if (fFlags & kUniform_Flag) {
result += "uniform ";
}
diff --git a/src/sksl/ast/SkSLASTModifiersDeclaration.h b/src/sksl/ast/SkSLASTModifiersDeclaration.h
index 07efdf6024..f5cc620899 100644
--- a/src/sksl/ast/SkSLASTModifiersDeclaration.h
+++ b/src/sksl/ast/SkSLASTModifiersDeclaration.h
@@ -23,7 +23,7 @@ struct ASTModifiersDeclaration : public ASTDeclaration {
: INHERITED(Position(), kModifiers_Kind)
, fModifiers(modifiers) {}
- SkString description() const {
+ std::string description() const {
return fModifiers.description() + ";";
}
diff --git a/src/sksl/ast/SkSLASTNode.h b/src/sksl/ast/SkSLASTNode.h
index af065955f8..4305011fa5 100644
--- a/src/sksl/ast/SkSLASTNode.h
+++ b/src/sksl/ast/SkSLASTNode.h
@@ -8,7 +8,8 @@
#ifndef SKSL_ASTNODE
#define SKSL_ASTNODE
-#include "SkString.h"
+#include <memory>
+#include <string>
namespace SkSL {
@@ -19,7 +20,7 @@ namespace SkSL {
struct ASTNode {
virtual ~ASTNode() {}
- virtual SkString description() const = 0;
+ virtual std::string description() const = 0;
};
} // namespace
diff --git a/src/sksl/ast/SkSLASTParameter.h b/src/sksl/ast/SkSLASTParameter.h
index b1fd658434..8f1b4535f2 100644
--- a/src/sksl/ast/SkSLASTParameter.h
+++ b/src/sksl/ast/SkSLASTParameter.h
@@ -20,15 +20,15 @@ struct ASTParameter : public ASTPositionNode {
// 'sizes' is a list of the array sizes appearing on a parameter, in source order.
// e.g. int x[3][1] would have sizes [3, 1].
ASTParameter(Position position, ASTModifiers modifiers, std::unique_ptr<ASTType> type,
- SkString name, std::vector<int> sizes)
+ std::string name, std::vector<int> sizes)
: INHERITED(position)
, fModifiers(modifiers)
, fType(std::move(type))
, fName(std::move(name))
, fSizes(std::move(sizes)) {}
- SkString description() const override {
- SkString result = fModifiers.description() + fType->description() + " " + fName;
+ std::string description() const override {
+ std::string result = fModifiers.description() + fType->description() + " " + fName;
for (int size : fSizes) {
result += "[" + to_string(size) + "]";
}
@@ -37,7 +37,7 @@ struct ASTParameter : public ASTPositionNode {
const ASTModifiers fModifiers;
const std::unique_ptr<ASTType> fType;
- const SkString fName;
+ const std::string fName;
const std::vector<int> fSizes;
typedef ASTPositionNode INHERITED;
diff --git a/src/sksl/ast/SkSLASTPrecision.h b/src/sksl/ast/SkSLASTPrecision.h
index a2f427c9ce..a7df57948e 100644
--- a/src/sksl/ast/SkSLASTPrecision.h
+++ b/src/sksl/ast/SkSLASTPrecision.h
@@ -22,17 +22,17 @@ struct ASTPrecision : public ASTDeclaration {
: INHERITED(position, kPrecision_Kind)
, fPrecision(precision) {}
- SkString description() const {
+ std::string description() const {
switch (fPrecision) {
- case Modifiers::kLowp_Flag: return SkString("precision lowp float;");
- case Modifiers::kMediump_Flag: return SkString("precision mediump float;");
- case Modifiers::kHighp_Flag: return SkString("precision highp float;");
+ case Modifiers::kLowp_Flag: return "precision lowp float;";
+ case Modifiers::kMediump_Flag: return "precision mediump float;";
+ case Modifiers::kHighp_Flag: return "precision highp float;";
default:
ASSERT(false);
- return SkString("<error>");
+ return "<error>";
}
ASSERT(false);
- return SkString("<error>");
+ return "<error>";
}
const Modifiers::Flag fPrecision;
diff --git a/src/sksl/ast/SkSLASTPrefixExpression.h b/src/sksl/ast/SkSLASTPrefixExpression.h
index e06ec41f9e..0d326e2aab 100644
--- a/src/sksl/ast/SkSLASTPrefixExpression.h
+++ b/src/sksl/ast/SkSLASTPrefixExpression.h
@@ -22,7 +22,7 @@ struct ASTPrefixExpression : public ASTExpression {
, fOperator(op.fKind)
, fOperand(std::move(operand)) {}
- SkString description() const override {
+ std::string description() const override {
return Token::OperatorName(fOperator) + fOperand->description();
}
diff --git a/src/sksl/ast/SkSLASTReturnStatement.h b/src/sksl/ast/SkSLASTReturnStatement.h
index ed24d4a153..3aac783a8c 100644
--- a/src/sksl/ast/SkSLASTReturnStatement.h
+++ b/src/sksl/ast/SkSLASTReturnStatement.h
@@ -21,8 +21,8 @@ struct ASTReturnStatement : public ASTStatement {
: INHERITED(position, kReturn_Kind)
, fExpression(std::move(expression)) {}
- SkString description() const override {
- SkString result("return");
+ std::string description() const override {
+ std::string result("return");
if (fExpression) {
result += " " + fExpression->description();
}
diff --git a/src/sksl/ast/SkSLASTSuffix.h b/src/sksl/ast/SkSLASTSuffix.h
index 64178c7682..18f79f01ea 100644
--- a/src/sksl/ast/SkSLASTSuffix.h
+++ b/src/sksl/ast/SkSLASTSuffix.h
@@ -30,12 +30,12 @@ struct ASTSuffix : public ASTPositionNode {
: INHERITED(position)
, fKind(kind) {}
- SkString description() const override {
+ std::string description() const override {
switch (fKind) {
case kPostIncrement_Kind:
- return SkString("++");
+ return "++";
case kPostDecrement_Kind:
- return SkString("--");
+ return "--";
default:
ABORT("unsupported suffix operator");
}
diff --git a/src/sksl/ast/SkSLASTSuffixExpression.h b/src/sksl/ast/SkSLASTSuffixExpression.h
index 7ee200fd43..c0fda294b9 100644
--- a/src/sksl/ast/SkSLASTSuffixExpression.h
+++ b/src/sksl/ast/SkSLASTSuffixExpression.h
@@ -22,7 +22,7 @@ struct ASTSuffixExpression : public ASTExpression {
, fBase(std::move(base))
, fSuffix(std::move(suffix)) {}
- SkString description() const override {
+ std::string description() const override {
return fBase->description() + fSuffix->description();
}
diff --git a/src/sksl/ast/SkSLASTTernaryExpression.h b/src/sksl/ast/SkSLASTTernaryExpression.h
index ddf8e3d120..20b827a049 100644
--- a/src/sksl/ast/SkSLASTTernaryExpression.h
+++ b/src/sksl/ast/SkSLASTTernaryExpression.h
@@ -24,7 +24,7 @@ struct ASTTernaryExpression : public ASTExpression {
, fIfTrue(std::move(ifTrue))
, fIfFalse(std::move(ifFalse)) {}
- SkString description() const override {
+ std::string description() const override {
return "(" + fTest->description() + " ? " + fIfTrue->description() + " : " +
fIfFalse->description() + ")";
}
diff --git a/src/sksl/ast/SkSLASTType.h b/src/sksl/ast/SkSLASTType.h
index 81594000e5..b8fdedb214 100644
--- a/src/sksl/ast/SkSLASTType.h
+++ b/src/sksl/ast/SkSLASTType.h
@@ -19,16 +19,16 @@ struct ASTType : public ASTPositionNode {
kStruct_Kind
};
- ASTType(Position position, SkString name, Kind kind)
+ ASTType(Position position, std::string name, Kind kind)
: INHERITED(position)
, fName(std::move(name))
, fKind(kind) {}
- SkString description() const override {
+ std::string description() const override {
return fName;
}
- const SkString fName;
+ const std::string fName;
const Kind fKind;
diff --git a/src/sksl/ast/SkSLASTVarDeclaration.h b/src/sksl/ast/SkSLASTVarDeclaration.h
index 9de4cf55b9..066922fb85 100644
--- a/src/sksl/ast/SkSLASTVarDeclaration.h
+++ b/src/sksl/ast/SkSLASTVarDeclaration.h
@@ -22,15 +22,15 @@ namespace SkSL {
* instances.
*/
struct ASTVarDeclaration {
- ASTVarDeclaration(const SkString name,
+ ASTVarDeclaration(const std::string name,
std::vector<std::unique_ptr<ASTExpression>> sizes,
std::unique_ptr<ASTExpression> value)
: fName(name)
, fSizes(std::move(sizes))
, fValue(std::move(value)) {}
- SkString description() const {
- SkString result = fName;
+ std::string description() const {
+ std::string result = fName;
for (const auto& size : fSizes) {
if (size) {
result += "[" + size->description() + "]";
@@ -44,7 +44,7 @@ struct ASTVarDeclaration {
return result;
}
- SkString fName;
+ std::string fName;
// array sizes, if any. e.g. 'foo[3][]' has sizes [3, null]
std::vector<std::unique_ptr<ASTExpression>> fSizes;
@@ -65,9 +65,9 @@ struct ASTVarDeclarations : public ASTDeclaration {
, fType(std::move(type))
, fVars(std::move(vars)) {}
- SkString description() const override {
- SkString result = fModifiers.description() + fType->description() + " ";
- SkString separator;
+ std::string description() const override {
+ std::string result = fModifiers.description() + fType->description() + " ";
+ std::string separator = "";
for (const auto& var : fVars) {
result += separator;
separator = ", ";
diff --git a/src/sksl/ast/SkSLASTVarDeclarationStatement.h b/src/sksl/ast/SkSLASTVarDeclarationStatement.h
index d71639d797..8bae389146 100644
--- a/src/sksl/ast/SkSLASTVarDeclarationStatement.h
+++ b/src/sksl/ast/SkSLASTVarDeclarationStatement.h
@@ -21,7 +21,7 @@ struct ASTVarDeclarationStatement : public ASTStatement {
: INHERITED(decl->fPosition, kVarDeclaration_Kind)
, fDeclarations(std::move(decl)) {}
- SkString description() const override {
+ std::string description() const override {
return fDeclarations->description() + ";";
}
diff --git a/src/sksl/ast/SkSLASTWhileStatement.h b/src/sksl/ast/SkSLASTWhileStatement.h
index 853ac8028d..e29aa23e4a 100644
--- a/src/sksl/ast/SkSLASTWhileStatement.h
+++ b/src/sksl/ast/SkSLASTWhileStatement.h
@@ -22,7 +22,7 @@ struct ASTWhileStatement : public ASTStatement {
, fTest(std::move(test))
, fStatement(std::move(statement)) {}
- SkString description() const override {
+ std::string description() const override {
return "while (" + fTest->description() + ") " + fStatement->description();
}