Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Unified Diff: src/sksl/SkSLParser.cpp

Issue 2442063002: Reduced skslc memory consumption (Closed)
Patch Set: added a few more functions Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/sksl/SkSLIRGenerator.cpp ('k') | src/sksl/SkSLToken.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/SkSLParser.cpp
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index 7eac0ce5679d5de60909e29afd8257c6dc910d27..324bd41c86c972f39e9ad3714ef4069c90d8c6dd 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -157,9 +157,18 @@ Token Parser::nextToken() {
return result;
}
int token = sksllex(fScanner);
- return Token(Position(skslget_lineno(fScanner), -1), (Token::Kind) token,
- token == Token::END_OF_FILE ? "<end of file>" :
- std::string(skslget_text(fScanner)));
+ std::string text;
+ switch ((Token::Kind) token) {
+ case Token::IDENTIFIER: // fall through
+ case Token::INT_LITERAL: // fall through
+ case Token::FLOAT_LITERAL: // fall through
+ case Token::DIRECTIVE:
+ text = std::string(skslget_text(fScanner));
+ break;
+ default:
+ break;
+ }
+ return Token(Position(skslget_lineno(fScanner), -1), (Token::Kind) token, text);
}
void Parser::pushback(Token t) {
« no previous file with comments | « src/sksl/SkSLIRGenerator.cpp ('k') | src/sksl/SkSLToken.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698