aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ast
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-03-31 16:04:34 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-31 16:04:41 +0000
commit9bd301d640ff63c280b202c7dd00bc00a3315ff4 (patch)
tree176fcfe46fb17a8c50c145196705f4ef42a950fa /src/sksl/ast
parent92d7ccafdf896cf19764e025873d13315a76842d (diff)
Revert "skslc can now be compiled with no Skia dependencies, in preparation for its eventual"
This reverts commit f3333c89bf05fc602d9bf8e1e24547668c660383. Reason for revert: breaking the bots Original change's description: > skslc can now be compiled with no Skia dependencies, in preparation for its eventual > role in Skia's build process. > > This reverts commit bcf35f86d50b784b165de703b404998dd4299f6a. > > BUG=skia: > > Change-Id: Id0a12dfc4d804d69a3c6bf60fed37e89ee130f02 > Reviewed-on: https://skia-review.googlesource.com/10802 > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Ben Wagner <benjaminwagner@google.com> > TBR=benjaminwagner@google.com,ethannicholas@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: Ic7b50d391d25b3870acffa9764cbafc7f5c3be89 Reviewed-on: https://skia-review.googlesource.com/10962 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/ast')
-rw-r--r--src/sksl/ast/SkSLASTBinaryExpression.h4
-rw-r--r--src/sksl/ast/SkSLASTBlock.h10
-rw-r--r--src/sksl/ast/SkSLASTBoolLiteral.h8
-rw-r--r--src/sksl/ast/SkSLASTBreakStatement.h8
-rw-r--r--src/sksl/ast/SkSLASTCallSuffix.h12
-rw-r--r--src/sksl/ast/SkSLASTContinueStatement.h8
-rw-r--r--src/sksl/ast/SkSLASTDeclaration.h4
-rw-r--r--src/sksl/ast/SkSLASTDiscardStatement.h8
-rw-r--r--src/sksl/ast/SkSLASTDoStatement.h6
-rw-r--r--src/sksl/ast/SkSLASTExpression.h4
-rw-r--r--src/sksl/ast/SkSLASTExpressionStatement.h6
-rw-r--r--src/sksl/ast/SkSLASTExtension.h12
-rw-r--r--src/sksl/ast/SkSLASTFieldSuffix.h8
-rw-r--r--src/sksl/ast/SkSLASTFloatLiteral.h6
-rw-r--r--src/sksl/ast/SkSLASTForStatement.h10
-rw-r--r--src/sksl/ast/SkSLASTFunction.h16
-rw-r--r--src/sksl/ast/SkSLASTIdentifier.h10
-rw-r--r--src/sksl/ast/SkSLASTIfStatement.h12
-rw-r--r--src/sksl/ast/SkSLASTIndexSuffix.h10
-rw-r--r--src/sksl/ast/SkSLASTIntLiteral.h4
-rw-r--r--src/sksl/ast/SkSLASTInterfaceBlock.h12
-rw-r--r--src/sksl/ast/SkSLASTModifiersDeclaration.h2
-rw-r--r--src/sksl/ast/SkSLASTNode.h8
-rw-r--r--src/sksl/ast/SkSLASTParameter.h8
-rw-r--r--src/sksl/ast/SkSLASTPositionNode.h2
-rw-r--r--src/sksl/ast/SkSLASTPrecision.h18
-rw-r--r--src/sksl/ast/SkSLASTPrefixExpression.h4
-rw-r--r--src/sksl/ast/SkSLASTReturnStatement.h8
-rw-r--r--src/sksl/ast/SkSLASTStatement.h2
-rw-r--r--src/sksl/ast/SkSLASTSuffix.h10
-rw-r--r--src/sksl/ast/SkSLASTSuffixExpression.h4
-rw-r--r--src/sksl/ast/SkSLASTSwitchCase.h4
-rw-r--r--src/sksl/ast/SkSLASTSwitchStatement.h4
-rw-r--r--src/sksl/ast/SkSLASTTernaryExpression.h6
-rw-r--r--src/sksl/ast/SkSLASTType.h8
-rw-r--r--src/sksl/ast/SkSLASTVarDeclaration.h14
-rw-r--r--src/sksl/ast/SkSLASTVarDeclarationStatement.h4
-rw-r--r--src/sksl/ast/SkSLASTWhileStatement.h6
38 files changed, 145 insertions, 145 deletions
diff --git a/src/sksl/ast/SkSLASTBinaryExpression.h b/src/sksl/ast/SkSLASTBinaryExpression.h
index 9a24970262..c4b6e3a45b 100644
--- a/src/sksl/ast/SkSLASTBinaryExpression.h
+++ b/src/sksl/ast/SkSLASTBinaryExpression.h
@@ -14,7 +14,7 @@
namespace SkSL {
/**
- * Represents a binary operation, with the operator represented by the token's type.
+ * Represents a binary operation, with the operator represented by the token's type.
*/
struct ASTBinaryExpression : public ASTExpression {
ASTBinaryExpression(std::unique_ptr<ASTExpression> left, Token op,
@@ -24,7 +24,7 @@ struct ASTBinaryExpression : public ASTExpression {
, fOperator(op.fKind)
, fRight(std::move(right)) {}
- String description() const override {
+ SkString 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 37c0e81a95..6b1e9c5551 100644
--- a/src/sksl/ast/SkSLASTBlock.h
+++ b/src/sksl/ast/SkSLASTBlock.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTBLOCK
#define SKSL_ASTBLOCK
@@ -13,21 +13,21 @@
namespace SkSL {
/**
- * Represents a curly-braced block of statements.
+ * Represents a curly-braced block of statements.
*/
struct ASTBlock : public ASTStatement {
ASTBlock(Position position, std::vector<std::unique_ptr<ASTStatement>> statements)
: INHERITED(position, kBlock_Kind)
, fStatements(std::move(statements)) {}
- String description() const override {
- String result("{");
+ SkString description() const override {
+ SkString result("{");
for (size_t i = 0; i < fStatements.size(); i++) {
result += "\n";
result += fStatements[i]->description();
}
result += "\n}\n";
- return result;
+ return result;
}
const std::vector<std::unique_ptr<ASTStatement>> fStatements;
diff --git a/src/sksl/ast/SkSLASTBoolLiteral.h b/src/sksl/ast/SkSLASTBoolLiteral.h
index 48e916eed5..02f4bac0da 100644
--- a/src/sksl/ast/SkSLASTBoolLiteral.h
+++ b/src/sksl/ast/SkSLASTBoolLiteral.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTBOOLLITERAL
#define SKSL_ASTBOOLLITERAL
@@ -13,15 +13,15 @@
namespace SkSL {
/**
- * Represents "true" or "false".
+ * Represents "true" or "false".
*/
struct ASTBoolLiteral : public ASTExpression {
ASTBoolLiteral(Position position, bool value)
: INHERITED(position, kBool_Kind)
, fValue(value) {}
- String description() const override {
- return String(fValue ? "true" : "false");
+ SkString description() const override {
+ return SkString(fValue ? "true" : "false");
}
const bool fValue;
diff --git a/src/sksl/ast/SkSLASTBreakStatement.h b/src/sksl/ast/SkSLASTBreakStatement.h
index 079ee76d20..dad2a85c0a 100644
--- a/src/sksl/ast/SkSLASTBreakStatement.h
+++ b/src/sksl/ast/SkSLASTBreakStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTBREAKSTATEMENT
#define SKSL_ASTBREAKSTATEMENT
@@ -13,14 +13,14 @@
namespace SkSL {
/**
- * A 'break' statement.
+ * A 'break' statement.
*/
struct ASTBreakStatement : public ASTStatement {
ASTBreakStatement(Position position)
: INHERITED(position, kBreak_Kind) {}
- String description() const override {
- return String("break;");
+ SkString description() const override {
+ return SkString("break;");
}
typedef ASTStatement INHERITED;
diff --git a/src/sksl/ast/SkSLASTCallSuffix.h b/src/sksl/ast/SkSLASTCallSuffix.h
index 3ba3f0e60f..356ac850f9 100644
--- a/src/sksl/ast/SkSLASTCallSuffix.h
+++ b/src/sksl/ast/SkSLASTCallSuffix.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTCALLSUFFIX
#define SKSL_ASTCALLSUFFIX
@@ -14,16 +14,16 @@
namespace SkSL {
/**
- * A parenthesized list of arguments following an expression, indicating a function call.
+ * A parenthesized list of arguments following an expression, indicating a function call.
*/
struct ASTCallSuffix : public ASTSuffix {
- ASTCallSuffix(Position position, std::vector<std::unique_ptr<ASTExpression>> arguments)
+ ASTCallSuffix(Position position, std::vector<std::unique_ptr<ASTExpression>> arguments)
: INHERITED(position, ASTSuffix::kCall_Kind)
, fArguments(std::move(arguments)) {}
- String description() const override {
- String result("(");
- String separator;
+ SkString description() const override {
+ SkString result("(");
+ SkString 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 fdfce8598d..4cded3b16b 100644
--- a/src/sksl/ast/SkSLASTContinueStatement.h
+++ b/src/sksl/ast/SkSLASTContinueStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTCONTINUESTATEMENT
#define SKSL_ASTCONTINUESTATEMENT
@@ -13,14 +13,14 @@
namespace SkSL {
/**
- * A 'continue' statement.
+ * A 'continue' statement.
*/
struct ASTContinueStatement : public ASTStatement {
ASTContinueStatement(Position position)
: INHERITED(position, kContinue_Kind) {}
- String description() const override {
- return String("continue;");
+ SkString description() const override {
+ return SkString("continue;");
}
typedef ASTStatement INHERITED;
diff --git a/src/sksl/ast/SkSLASTDeclaration.h b/src/sksl/ast/SkSLASTDeclaration.h
index 0395ef91b4..70f0ebc72d 100644
--- a/src/sksl/ast/SkSLASTDeclaration.h
+++ b/src/sksl/ast/SkSLASTDeclaration.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTDECLARATION
#define SKSL_ASTDECLARATION
@@ -13,7 +13,7 @@
namespace SkSL {
/**
- * Abstract supertype of declarations such as variables and functions.
+ * Abstract supertype of declarations such as variables and functions.
*/
struct ASTDeclaration : public ASTPositionNode {
enum Kind {
diff --git a/src/sksl/ast/SkSLASTDiscardStatement.h b/src/sksl/ast/SkSLASTDiscardStatement.h
index dcf6b15e64..754bf95efe 100644
--- a/src/sksl/ast/SkSLASTDiscardStatement.h
+++ b/src/sksl/ast/SkSLASTDiscardStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTDISCARDSTATEMENT
#define SKSL_ASTDISCARDSTATEMENT
@@ -13,14 +13,14 @@
namespace SkSL {
/**
- * A 'discard' statement.
+ * A 'discard' statement.
*/
struct ASTDiscardStatement : public ASTStatement {
ASTDiscardStatement(Position position)
: INHERITED(position, kDiscard_Kind) {}
- String description() const override {
- return String("discard;");
+ SkString description() const override {
+ return SkString("discard;");
}
typedef ASTStatement INHERITED;
diff --git a/src/sksl/ast/SkSLASTDoStatement.h b/src/sksl/ast/SkSLASTDoStatement.h
index fc97d9e142..9a0caced1c 100644
--- a/src/sksl/ast/SkSLASTDoStatement.h
+++ b/src/sksl/ast/SkSLASTDoStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTDOSTATEMENT
#define SKSL_ASTDOSTATEMENT
@@ -13,7 +13,7 @@
namespace SkSL {
/**
- * A 'do' loop.
+ * A 'do' loop.
*/
struct ASTDoStatement : public ASTStatement {
ASTDoStatement(Position position, std::unique_ptr<ASTStatement> statement,
@@ -22,7 +22,7 @@ struct ASTDoStatement : public ASTStatement {
, fStatement(std::move(statement))
, fTest(std::move(test)) {}
- String description() const override {
+ SkString description() const override {
return "do " + fStatement->description() + " while (" + fTest->description() + ");";
}
diff --git a/src/sksl/ast/SkSLASTExpression.h b/src/sksl/ast/SkSLASTExpression.h
index 11815aef84..8a48271042 100644
--- a/src/sksl/ast/SkSLASTExpression.h
+++ b/src/sksl/ast/SkSLASTExpression.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTEXPRESSION
#define SKSL_ASTEXPRESSION
@@ -13,7 +13,7 @@
namespace SkSL {
/**
- * Abstract supertype of all expressions.
+ * Abstract supertype of all expressions.
*/
struct ASTExpression : public ASTPositionNode {
enum Kind {
diff --git a/src/sksl/ast/SkSLASTExpressionStatement.h b/src/sksl/ast/SkSLASTExpressionStatement.h
index 398a16a23a..2dbd20940d 100644
--- a/src/sksl/ast/SkSLASTExpressionStatement.h
+++ b/src/sksl/ast/SkSLASTExpressionStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTEXPRESSIONSTATEMENT
#define SKSL_ASTEXPRESSIONSTATEMENT
@@ -13,14 +13,14 @@
namespace SkSL {
/**
- * A lone expression being used as a statement.
+ * A lone expression being used as a statement.
*/
struct ASTExpressionStatement : public ASTStatement {
ASTExpressionStatement(std::unique_ptr<ASTExpression> expression)
: INHERITED(expression->fPosition, kExpression_Kind)
, fExpression(std::move(expression)) {}
- String description() const override {
+ SkString description() const override {
return fExpression->description() + ";";
}
diff --git a/src/sksl/ast/SkSLASTExtension.h b/src/sksl/ast/SkSLASTExtension.h
index a6fde0694c..b9df3c52e9 100644
--- a/src/sksl/ast/SkSLASTExtension.h
+++ b/src/sksl/ast/SkSLASTExtension.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTEXTENSION
#define SKSL_ASTEXTENSION
@@ -12,19 +12,19 @@
namespace SkSL {
-/**
- * An extension declaration.
+/**
+ * An extension declaration.
*/
struct ASTExtension : public ASTDeclaration {
- ASTExtension(Position position, String name)
+ ASTExtension(Position position, SkString name)
: INHERITED(position, kExtension_Kind)
, fName(std::move(name)) {}
- String description() const override {
+ SkString description() const override {
return "#extension " + fName + " : enable";
}
- const String fName;
+ const SkString fName;
typedef ASTDeclaration INHERITED;
};
diff --git a/src/sksl/ast/SkSLASTFieldSuffix.h b/src/sksl/ast/SkSLASTFieldSuffix.h
index bde1e4aec5..9ee8531bf1 100644
--- a/src/sksl/ast/SkSLASTFieldSuffix.h
+++ b/src/sksl/ast/SkSLASTFieldSuffix.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTFIELDSUFFIX
#define SKSL_ASTFIELDSUFFIX
@@ -17,15 +17,15 @@ namespace SkSL {
* actually vector swizzle (which looks the same to the parser).
*/
struct ASTFieldSuffix : public ASTSuffix {
- ASTFieldSuffix(Position position, String field)
+ ASTFieldSuffix(Position position, SkString field)
: INHERITED(position, ASTSuffix::kField_Kind)
, fField(std::move(field)) {}
- String description() const override {
+ SkString description() const override {
return "." + fField;
}
- String fField;
+ SkString fField;
typedef ASTSuffix INHERITED;
};
diff --git a/src/sksl/ast/SkSLASTFloatLiteral.h b/src/sksl/ast/SkSLASTFloatLiteral.h
index 15fe836049..ea0f595abc 100644
--- a/src/sksl/ast/SkSLASTFloatLiteral.h
+++ b/src/sksl/ast/SkSLASTFloatLiteral.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTFLOATLITERAL
#define SKSL_ASTFLOATLITERAL
@@ -13,14 +13,14 @@
namespace SkSL {
/**
- * A literal floating point number.
+ * A literal floating point number.
*/
struct ASTFloatLiteral : public ASTExpression {
ASTFloatLiteral(Position position, double value)
: INHERITED(position, kFloat_Kind)
, fValue(value) {}
- String description() const override {
+ SkString description() const override {
return to_string(fValue);
}
diff --git a/src/sksl/ast/SkSLASTForStatement.h b/src/sksl/ast/SkSLASTForStatement.h
index 326713eb62..2706a39954 100644
--- a/src/sksl/ast/SkSLASTForStatement.h
+++ b/src/sksl/ast/SkSLASTForStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTFORSTATEMENT
#define SKSL_ASTFORSTATEMENT
@@ -13,10 +13,10 @@
namespace SkSL {
/**
- * A 'for' loop.
+ * A 'for' loop.
*/
struct ASTForStatement : public ASTStatement {
- ASTForStatement(Position position, std::unique_ptr<ASTStatement> initializer,
+ ASTForStatement(Position position, std::unique_ptr<ASTStatement> initializer,
std::unique_ptr<ASTExpression> test, std::unique_ptr<ASTExpression> next,
std::unique_ptr<ASTStatement> statement)
: INHERITED(position, kFor_Kind)
@@ -25,8 +25,8 @@ struct ASTForStatement : public ASTStatement {
, fNext(std::move(next))
, fStatement(std::move(statement)) {}
- String description() const override {
- String result("for (");
+ SkString description() const override {
+ SkString result("for (");
if (fInitializer) {
result.append(fInitializer->description());
}
diff --git a/src/sksl/ast/SkSLASTFunction.h b/src/sksl/ast/SkSLASTFunction.h
index d9f3067baa..32f4da71f2 100644
--- a/src/sksl/ast/SkSLASTFunction.h
+++ b/src/sksl/ast/SkSLASTFunction.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTFUNCTION
#define SKSL_ASTFUNCTION
@@ -16,11 +16,11 @@
namespace SkSL {
/**
- * A function declaration or definition. The fBody field will be null for declarations.
+ * 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, String name,
- std::vector<std::unique_ptr<ASTParameter>> parameters,
+ ASTFunction(Position position, std::unique_ptr<ASTType> returnType, SkString name,
+ std::vector<std::unique_ptr<ASTParameter>> parameters,
std::unique_ptr<ASTBlock> body)
: INHERITED(position, kFunction_Kind)
, fReturnType(std::move(returnType))
@@ -28,8 +28,8 @@ struct ASTFunction : public ASTDeclaration {
, fParameters(std::move(parameters))
, fBody(std::move(body)) {}
- String description() const override {
- String result = fReturnType->description() + " " + fName + "(";
+ SkString description() const override {
+ SkString result = fReturnType->description() + " " + fName + "(";
for (size_t i = 0; i < fParameters.size(); i++) {
if (i > 0) {
result += ", ";
@@ -41,11 +41,11 @@ struct ASTFunction : public ASTDeclaration {
} else {
result += ");";
}
- return result;
+ return result;
}
const std::unique_ptr<ASTType> fReturnType;
- const String fName;
+ const SkString 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 016123cf8c..aa0179a18f 100644
--- a/src/sksl/ast/SkSLASTIdentifier.h
+++ b/src/sksl/ast/SkSLASTIdentifier.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTIDENTIFIER
#define SKSL_ASTIDENTIFIER
@@ -13,18 +13,18 @@
namespace SkSL {
/**
- * An identifier in an expression context.
+ * An identifier in an expression context.
*/
struct ASTIdentifier : public ASTExpression {
- ASTIdentifier(Position position, String text)
+ ASTIdentifier(Position position, SkString text)
: INHERITED(position, kIdentifier_Kind)
, fText(std::move(text)) {}
- String description() const override {
+ SkString description() const override {
return fText;
}
- const String fText;
+ const SkString fText;
typedef ASTExpression INHERITED;
};
diff --git a/src/sksl/ast/SkSLASTIfStatement.h b/src/sksl/ast/SkSLASTIfStatement.h
index 684bea00d9..d169702710 100644
--- a/src/sksl/ast/SkSLASTIfStatement.h
+++ b/src/sksl/ast/SkSLASTIfStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTIFSTATEMENT
#define SKSL_ASTIFSTATEMENT
@@ -13,18 +13,18 @@
namespace SkSL {
/**
- * An 'if' statement.
+ * An 'if' statement.
*/
struct ASTIfStatement : public ASTStatement {
- ASTIfStatement(Position position, std::unique_ptr<ASTExpression> test,
+ ASTIfStatement(Position position, std::unique_ptr<ASTExpression> test,
std::unique_ptr<ASTStatement> ifTrue, std::unique_ptr<ASTStatement> ifFalse)
: INHERITED(position, kIf_Kind)
, fTest(std::move(test))
, fIfTrue(std::move(ifTrue))
, fIfFalse(std::move(ifFalse)) {}
- String description() const override {
- String result("if (");
+ SkString description() const override {
+ SkString result("if (");
result += fTest->description();
result += ") ";
result += fIfTrue->description();
@@ -32,7 +32,7 @@ struct ASTIfStatement : public ASTStatement {
result += " else ";
result += fIfFalse->description();
}
- return result;
+ return result;
}
const std::unique_ptr<ASTExpression> fTest;
diff --git a/src/sksl/ast/SkSLASTIndexSuffix.h b/src/sksl/ast/SkSLASTIndexSuffix.h
index 31142e3685..2b7cd48417 100644
--- a/src/sksl/ast/SkSLASTIndexSuffix.h
+++ b/src/sksl/ast/SkSLASTIndexSuffix.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTINDEXSUFFIX
#define SKSL_ASTINDEXSUFFIX
@@ -18,19 +18,19 @@ namespace SkSL {
* 'float[](5, 6)' are represented with a null fExpression.
*/
struct ASTIndexSuffix : public ASTSuffix {
- ASTIndexSuffix(Position position)
+ ASTIndexSuffix(Position position)
: INHERITED(position, ASTSuffix::kIndex_Kind)
, fExpression(nullptr) {}
- ASTIndexSuffix(std::unique_ptr<ASTExpression> expression)
+ ASTIndexSuffix(std::unique_ptr<ASTExpression> expression)
: INHERITED(expression ? expression->fPosition : Position(), ASTSuffix::kIndex_Kind)
, fExpression(std::move(expression)) {}
- String description() const override {
+ SkString description() const override {
if (fExpression) {
return "[" + fExpression->description() + "]";
} else {
- return String("[]");
+ return SkString("[]");
}
}
diff --git a/src/sksl/ast/SkSLASTIntLiteral.h b/src/sksl/ast/SkSLASTIntLiteral.h
index fe04347fd8..f524bc04ad 100644
--- a/src/sksl/ast/SkSLASTIntLiteral.h
+++ b/src/sksl/ast/SkSLASTIntLiteral.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTINTLITERAL
#define SKSL_ASTINTLITERAL
@@ -21,7 +21,7 @@ struct ASTIntLiteral : public ASTExpression {
: INHERITED(position, kInt_Kind)
, fValue(value) {}
- String description() const override {
+ SkString description() const override {
return to_string(fValue);
}
diff --git a/src/sksl/ast/SkSLASTInterfaceBlock.h b/src/sksl/ast/SkSLASTInterfaceBlock.h
index e727ae9aad..7647fb5c00 100644
--- a/src/sksl/ast/SkSLASTInterfaceBlock.h
+++ b/src/sksl/ast/SkSLASTInterfaceBlock.h
@@ -25,9 +25,9 @@ struct ASTInterfaceBlock : public ASTDeclaration {
// valueName is empty when it was not present in the source
ASTInterfaceBlock(Position position,
Modifiers modifiers,
- String typeName,
+ SkString typeName,
std::vector<std::unique_ptr<ASTVarDeclarations>> declarations,
- String instanceName,
+ SkString instanceName,
std::vector<std::unique_ptr<ASTExpression>> sizes)
: INHERITED(position, kInterfaceBlock_Kind)
, fModifiers(modifiers)
@@ -36,8 +36,8 @@ struct ASTInterfaceBlock : public ASTDeclaration {
, fInstanceName(std::move(instanceName))
, fSizes(std::move(sizes)) {}
- String description() const override {
- String result = fModifiers.description() + fTypeName + " {\n";
+ SkString description() const override {
+ SkString result = fModifiers.description() + fTypeName + " {\n";
for (size_t i = 0; i < fDeclarations.size(); i++) {
result += fDeclarations[i]->description() + "\n";
}
@@ -56,9 +56,9 @@ struct ASTInterfaceBlock : public ASTDeclaration {
}
const Modifiers fModifiers;
- const String fTypeName;
+ const SkString fTypeName;
const std::vector<std::unique_ptr<ASTVarDeclarations>> fDeclarations;
- const String fInstanceName;
+ const SkString fInstanceName;
const std::vector<std::unique_ptr<ASTExpression>> fSizes;
typedef ASTDeclaration INHERITED;
diff --git a/src/sksl/ast/SkSLASTModifiersDeclaration.h b/src/sksl/ast/SkSLASTModifiersDeclaration.h
index ba07f168b2..7950f6dd5d 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) {}
- String description() const {
+ SkString description() const {
return fModifiers.description() + ";";
}
diff --git a/src/sksl/ast/SkSLASTNode.h b/src/sksl/ast/SkSLASTNode.h
index b08bc2a932..af065955f8 100644
--- a/src/sksl/ast/SkSLASTNode.h
+++ b/src/sksl/ast/SkSLASTNode.h
@@ -4,11 +4,11 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTNODE
#define SKSL_ASTNODE
-#include "SkSLString.h"
+#include "SkString.h"
namespace SkSL {
@@ -18,8 +18,8 @@ namespace SkSL {
*/
struct ASTNode {
virtual ~ASTNode() {}
-
- virtual String description() const = 0;
+
+ virtual SkString description() const = 0;
};
} // namespace
diff --git a/src/sksl/ast/SkSLASTParameter.h b/src/sksl/ast/SkSLASTParameter.h
index 01227c637e..6bb13acf49 100644
--- a/src/sksl/ast/SkSLASTParameter.h
+++ b/src/sksl/ast/SkSLASTParameter.h
@@ -21,15 +21,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, Modifiers modifiers, std::unique_ptr<ASTType> type,
- String name, std::vector<int> sizes)
+ SkString name, std::vector<int> sizes)
: INHERITED(position)
, fModifiers(modifiers)
, fType(std::move(type))
, fName(std::move(name))
, fSizes(std::move(sizes)) {}
- String description() const override {
- String result = fModifiers.description() + fType->description() + " " + fName;
+ SkString description() const override {
+ SkString result = fModifiers.description() + fType->description() + " " + fName;
for (int size : fSizes) {
result += "[" + to_string(size) + "]";
}
@@ -38,7 +38,7 @@ struct ASTParameter : public ASTPositionNode {
const Modifiers fModifiers;
const std::unique_ptr<ASTType> fType;
- const String fName;
+ const SkString fName;
const std::vector<int> fSizes;
typedef ASTPositionNode INHERITED;
diff --git a/src/sksl/ast/SkSLASTPositionNode.h b/src/sksl/ast/SkSLASTPositionNode.h
index cc435c486c..226b4ae4b0 100644
--- a/src/sksl/ast/SkSLASTPositionNode.h
+++ b/src/sksl/ast/SkSLASTPositionNode.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTPOSITIONNODE
#define SKSL_ASTPOSITIONNODE
diff --git a/src/sksl/ast/SkSLASTPrecision.h b/src/sksl/ast/SkSLASTPrecision.h
index 4b50ed3979..a2f427c9ce 100644
--- a/src/sksl/ast/SkSLASTPrecision.h
+++ b/src/sksl/ast/SkSLASTPrecision.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTPRECISION
#define SKSL_ASTPRECISION
@@ -22,17 +22,17 @@ struct ASTPrecision : public ASTDeclaration {
: INHERITED(position, kPrecision_Kind)
, fPrecision(precision) {}
- String description() const {
+ SkString description() const {
switch (fPrecision) {
- case Modifiers::kLowp_Flag: return String("precision lowp float;");
- case Modifiers::kMediump_Flag: return String("precision mediump float;");
- case Modifiers::kHighp_Flag: return String("precision highp float;");
- default:
- ASSERT(false);
- return String("<error>");
+ 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;");
+ default:
+ ASSERT(false);
+ return SkString("<error>");
}
ASSERT(false);
- return String("<error>");
+ return SkString("<error>");
}
const Modifiers::Flag fPrecision;
diff --git a/src/sksl/ast/SkSLASTPrefixExpression.h b/src/sksl/ast/SkSLASTPrefixExpression.h
index 08e50f7bf1..e06ec41f9e 100644
--- a/src/sksl/ast/SkSLASTPrefixExpression.h
+++ b/src/sksl/ast/SkSLASTPrefixExpression.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTPREFIXEXPRESSION
#define SKSL_ASTPREFIXEXPRESSION
@@ -22,7 +22,7 @@ struct ASTPrefixExpression : public ASTExpression {
, fOperator(op.fKind)
, fOperand(std::move(operand)) {}
- String description() const override {
+ SkString description() const override {
return Token::OperatorName(fOperator) + fOperand->description();
}
diff --git a/src/sksl/ast/SkSLASTReturnStatement.h b/src/sksl/ast/SkSLASTReturnStatement.h
index 6762eb3f90..ed24d4a153 100644
--- a/src/sksl/ast/SkSLASTReturnStatement.h
+++ b/src/sksl/ast/SkSLASTReturnStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTRETURNSTATEMENT
#define SKSL_ASTRETURNSTATEMENT
@@ -21,12 +21,12 @@ struct ASTReturnStatement : public ASTStatement {
: INHERITED(position, kReturn_Kind)
, fExpression(std::move(expression)) {}
- String description() const override {
- String result("return");
+ SkString description() const override {
+ SkString result("return");
if (fExpression) {
result += " " + fExpression->description();
}
- return result + ";";
+ return result + ";";
}
const std::unique_ptr<ASTExpression> fExpression;
diff --git a/src/sksl/ast/SkSLASTStatement.h b/src/sksl/ast/SkSLASTStatement.h
index 1989a1fce6..6ce320e343 100644
--- a/src/sksl/ast/SkSLASTStatement.h
+++ b/src/sksl/ast/SkSLASTStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTSTATEMENT
#define SKSL_ASTSTATEMENT
diff --git a/src/sksl/ast/SkSLASTSuffix.h b/src/sksl/ast/SkSLASTSuffix.h
index f06c6fd362..64178c7682 100644
--- a/src/sksl/ast/SkSLASTSuffix.h
+++ b/src/sksl/ast/SkSLASTSuffix.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTSUFFIX
#define SKSL_ASTSUFFIX
@@ -30,15 +30,15 @@ struct ASTSuffix : public ASTPositionNode {
: INHERITED(position)
, fKind(kind) {}
- String description() const override {
+ SkString description() const override {
switch (fKind) {
case kPostIncrement_Kind:
- return String("++");
+ return SkString("++");
case kPostDecrement_Kind:
- return String("--");
+ return SkString("--");
default:
ABORT("unsupported suffix operator");
- }
+ }
}
Kind fKind;
diff --git a/src/sksl/ast/SkSLASTSuffixExpression.h b/src/sksl/ast/SkSLASTSuffixExpression.h
index 2cff9a865f..7ee200fd43 100644
--- a/src/sksl/ast/SkSLASTSuffixExpression.h
+++ b/src/sksl/ast/SkSLASTSuffixExpression.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTSUFFIXEXPRESSION
#define SKSL_ASTSUFFIXEXPRESSION
@@ -22,7 +22,7 @@ struct ASTSuffixExpression : public ASTExpression {
, fBase(std::move(base))
, fSuffix(std::move(suffix)) {}
- String description() const override {
+ SkString description() const override {
return fBase->description() + fSuffix->description();
}
diff --git a/src/sksl/ast/SkSLASTSwitchCase.h b/src/sksl/ast/SkSLASTSwitchCase.h
index 405013a6a7..2c0a01c7fa 100644
--- a/src/sksl/ast/SkSLASTSwitchCase.h
+++ b/src/sksl/ast/SkSLASTSwitchCase.h
@@ -23,8 +23,8 @@ struct ASTSwitchCase : public ASTStatement {
, fValue(std::move(value))
, fStatements(std::move(statements)) {}
- String description() const override {
- String result;
+ SkString description() const override {
+ SkString result;
if (fValue) {
result.appendf("case %s:\n", fValue->description().c_str());
} else {
diff --git a/src/sksl/ast/SkSLASTSwitchStatement.h b/src/sksl/ast/SkSLASTSwitchStatement.h
index 4a963ebc7a..3031a7d2b1 100644
--- a/src/sksl/ast/SkSLASTSwitchStatement.h
+++ b/src/sksl/ast/SkSLASTSwitchStatement.h
@@ -23,8 +23,8 @@ struct ASTSwitchStatement : public ASTStatement {
, fValue(std::move(value))
, fCases(std::move(cases)) {}
- String description() const override {
- String result = String::printf("switch (%s) {\n", + fValue->description().c_str());
+ SkString description() const override {
+ SkString result = SkStringPrintf("switch (%s) {\n", + fValue->description().c_str());
for (const auto& c : fCases) {
result += c->description();
}
diff --git a/src/sksl/ast/SkSLASTTernaryExpression.h b/src/sksl/ast/SkSLASTTernaryExpression.h
index 07c92975e0..ddf8e3d120 100644
--- a/src/sksl/ast/SkSLASTTernaryExpression.h
+++ b/src/sksl/ast/SkSLASTTernaryExpression.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTTERNARYEXPRESSION
#define SKSL_ASTTERNARYEXPRESSION
@@ -24,9 +24,9 @@ struct ASTTernaryExpression : public ASTExpression {
, fIfTrue(std::move(ifTrue))
, fIfFalse(std::move(ifFalse)) {}
- String description() const override {
+ SkString description() const override {
return "(" + fTest->description() + " ? " + fIfTrue->description() + " : " +
- fIfFalse->description() + ")";
+ fIfFalse->description() + ")";
}
const std::unique_ptr<ASTExpression> fTest;
diff --git a/src/sksl/ast/SkSLASTType.h b/src/sksl/ast/SkSLASTType.h
index 57a8025b7b..b95c3d7a0b 100644
--- a/src/sksl/ast/SkSLASTType.h
+++ b/src/sksl/ast/SkSLASTType.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTTYPE
#define SKSL_ASTTYPE
@@ -21,17 +21,17 @@ struct ASTType : public ASTPositionNode {
kStruct_Kind
};
- ASTType(Position position, String name, Kind kind, std::vector<int> sizes)
+ ASTType(Position position, SkString name, Kind kind, std::vector<int> sizes)
: INHERITED(position)
, fName(std::move(name))
, fKind(kind)
, fSizes(std::move(sizes)) {}
- String description() const override {
+ SkString description() const override {
return fName;
}
- const String fName;
+ const SkString fName;
const Kind fKind;
diff --git a/src/sksl/ast/SkSLASTVarDeclaration.h b/src/sksl/ast/SkSLASTVarDeclaration.h
index 2dcb9787ea..7d50a06a50 100644
--- a/src/sksl/ast/SkSLASTVarDeclaration.h
+++ b/src/sksl/ast/SkSLASTVarDeclaration.h
@@ -22,15 +22,15 @@ namespace SkSL {
* instances.
*/
struct ASTVarDeclaration {
- ASTVarDeclaration(const String name,
+ ASTVarDeclaration(const SkString name,
std::vector<std::unique_ptr<ASTExpression>> sizes,
std::unique_ptr<ASTExpression> value)
: fName(name)
, fSizes(std::move(sizes))
, fValue(std::move(value)) {}
- String description() const {
- String result = fName;
+ SkString description() const {
+ SkString result = fName;
for (const auto& size : fSizes) {
if (size) {
result += "[" + size->description() + "]";
@@ -44,7 +44,7 @@ struct ASTVarDeclaration {
return result;
}
- String fName;
+ SkString 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)) {}
- String description() const override {
- String result = fModifiers.description() + fType->description() + " ";
- String separator;
+ SkString description() const override {
+ SkString result = fModifiers.description() + fType->description() + " ";
+ SkString separator;
for (const auto& var : fVars) {
result += separator;
separator = ", ";
diff --git a/src/sksl/ast/SkSLASTVarDeclarationStatement.h b/src/sksl/ast/SkSLASTVarDeclarationStatement.h
index c3a4069ba0..d71639d797 100644
--- a/src/sksl/ast/SkSLASTVarDeclarationStatement.h
+++ b/src/sksl/ast/SkSLASTVarDeclarationStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTVARDECLARATIONSTATEMENT
#define SKSL_ASTVARDECLARATIONSTATEMENT
@@ -21,7 +21,7 @@ struct ASTVarDeclarationStatement : public ASTStatement {
: INHERITED(decl->fPosition, kVarDeclaration_Kind)
, fDeclarations(std::move(decl)) {}
- String description() const override {
+ SkString description() const override {
return fDeclarations->description() + ";";
}
diff --git a/src/sksl/ast/SkSLASTWhileStatement.h b/src/sksl/ast/SkSLASTWhileStatement.h
index e63c50293a..853ac8028d 100644
--- a/src/sksl/ast/SkSLASTWhileStatement.h
+++ b/src/sksl/ast/SkSLASTWhileStatement.h
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#ifndef SKSL_ASTWHILESTATEMENT
#define SKSL_ASTWHILESTATEMENT
@@ -16,13 +16,13 @@ namespace SkSL {
* A 'while' statement.
*/
struct ASTWhileStatement : public ASTStatement {
- ASTWhileStatement(Position position, std::unique_ptr<ASTExpression> test,
+ ASTWhileStatement(Position position, std::unique_ptr<ASTExpression> test,
std::unique_ptr<ASTStatement> statement)
: INHERITED(position, kWhile_Kind)
, fTest(std::move(test))
, fStatement(std::move(statement)) {}
- String description() const override {
+ SkString description() const override {
return "while (" + fTest->description() + ") " + fStatement->description();
}