diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-06-16 10:23:19 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-06-16 22:46:16 +0200 |
commit | 1b10ce6a08edbc2ac7e8fd7e97e3fc691f2081df (patch) | |
tree | 34ab485d1dd9435369709b5e77c11af6dec78c22 /src/qml/parser/qqmljs.g | |
parent | b65eee039092fa664e781cdd98a4bb5e66815218 (diff) |
Port QtDeclarative from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljs.g')
-rw-r--r-- | src/qml/parser/qqmljs.g | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g index 8d79e48287..783ac273c8 100644 --- a/src/qml/parser/qqmljs.g +++ b/src/qml/parser/qqmljs.g @@ -403,10 +403,10 @@ protected: inline Value &sym(int index) { return sym_stack [tos + index - 1]; } - inline QStringRef &stringRef(int index) + inline QStringView &stringRef(int index) { return string_stack [tos + index - 1]; } - inline QStringRef &rawStringRef(int index) + inline QStringView &rawStringRef(int index) { return rawString_stack [tos + index - 1]; } inline SourceLocation &loc(int index) @@ -444,8 +444,8 @@ protected: Value *sym_stack = nullptr; int *state_stack = nullptr; SourceLocation *location_stack = nullptr; - QVector<QStringRef> string_stack; - QVector<QStringRef> rawString_stack; + QList<QStringView> string_stack; + QList<QStringView> rawString_stack; AST::Node *program = nullptr; @@ -456,14 +456,14 @@ protected: int token; double dval; SourceLocation loc; - QStringRef spell; - QStringRef raw; + QStringView spell; + QStringView raw; }; int yytoken = -1; double yylval = 0.; - QStringRef yytokenspell; - QStringRef yytokenraw; + QStringView yytokenspell; + QStringView yytokenraw; SourceLocation yylloc; SourceLocation yyprevlloc; @@ -555,7 +555,7 @@ static inline SourceLocation location(Lexer *lexer) AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) { - QVarLengthArray<QStringRef, 4> nameIds; + QVarLengthArray<QStringView, 4> nameIds; QVarLengthArray<SourceLocation, 4> locations; AST::ExpressionNode *it = expr; @@ -3613,7 +3613,7 @@ ContinueStatement: T_CONTINUE IdentifierReference Semicolon; BreakStatement: T_BREAK Semicolon; /. case $rule_number: { - AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef()); + AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringView()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; @@ -3887,7 +3887,7 @@ FunctionDeclaration_Default: Function T_LPAREN FormalParameters T_RPAREN TypeAnn case $rule_number: { if (!ensureNoFunctionTypeAnnotations(sym(5).TypeAnnotation, sym(3).FormalParameterList)) return false; - AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(QStringRef(), sym(3).FormalParameterList, sym(7).StatementList, + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(QStringView(), sym(3).FormalParameterList, sym(7).StatementList, /*type annotation*/nullptr); node->functionToken = loc(1); node->lparenToken = loc(2); @@ -3921,7 +3921,7 @@ FunctionExpression: T_FUNCTION T_LPAREN FormalParameters T_RPAREN TypeAnnotation case $rule_number: { if (!ensureNoFunctionTypeAnnotations(sym(5).TypeAnnotation, sym(3).FormalParameterList)) return false; - AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(3).FormalParameterList, sym(7).StatementList, + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringView(), sym(3).FormalParameterList, sym(7).StatementList, /*type annotation*/nullptr); node->functionToken = loc(1); node->lparenToken = loc(2); @@ -4011,7 +4011,7 @@ ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead AssignmentExpress ret->returnToken = sym(4).Node->firstSourceLocation(); ret->semicolonToken = sym(4).Node->lastSourceLocation(); AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish(); - AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringRef(), sym(1).FormalParameterList, statements); + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements); f->isArrowFunction = true; f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); f->lbraceToken = sym(4).Node->firstSourceLocation(); @@ -4025,7 +4025,7 @@ ArrowFunction: ArrowParameters T_ARROW ConciseBodyLookahead T_FORCE_BLOCK Functi ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead T_FORCE_BLOCK FunctionLBrace FunctionBody FunctionRBrace; /. case $rule_number: { - AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringRef(), sym(1).FormalParameterList, sym(6).StatementList); + AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, sym(6).StatementList); f->isArrowFunction = true; f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1); f->lbraceToken = loc(6); @@ -4186,7 +4186,7 @@ GeneratorDeclaration_Default: GeneratorDeclaration; GeneratorDeclaration_Default: FunctionStar GeneratorLParen FormalParameters T_RPAREN FunctionLBrace GeneratorBody GeneratorRBrace; /. case $rule_number: { - AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(QStringRef(), sym(3).FormalParameterList, sym(6).StatementList); + AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(QStringView(), sym(3).FormalParameterList, sym(6).StatementList); node->functionToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); @@ -4216,7 +4216,7 @@ GeneratorExpression: T_FUNCTION_STAR BindingIdentifier GeneratorLParen FormalPar GeneratorExpression: T_FUNCTION_STAR GeneratorLParen FormalParameters T_RPAREN FunctionLBrace GeneratorBody GeneratorRBrace; /. case $rule_number: { - AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(3).FormalParameterList, sym(6).StatementList); + AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringView(), sym(3).FormalParameterList, sym(6).StatementList); node->functionToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); @@ -4291,7 +4291,7 @@ ClassExpression: T_CLASS BindingIdentifier ClassHeritageOpt ClassLBrace ClassBod ClassDeclaration_Default: T_CLASS ClassHeritageOpt ClassLBrace ClassBodyOpt ClassRBrace; /. case $rule_number: { - AST::ClassDeclaration *node = new (pool) AST::ClassDeclaration(QStringRef(), sym(2).Expression, sym(4).ClassElementList); + AST::ClassDeclaration *node = new (pool) AST::ClassDeclaration(QStringView(), sym(2).Expression, sym(4).ClassElementList); node->classToken = loc(1); node->lbraceToken = loc(3); node->rbraceToken = loc(5); @@ -4302,7 +4302,7 @@ ClassDeclaration_Default: T_CLASS ClassHeritageOpt ClassLBrace ClassBodyOpt Clas ClassExpression: T_CLASS ClassHeritageOpt ClassLBrace ClassBodyOpt ClassRBrace; /. case $rule_number: { - AST::ClassExpression *node = new (pool) AST::ClassExpression(QStringRef(), sym(2).Expression, sym(4).ClassElementList); + AST::ClassExpression *node = new (pool) AST::ClassExpression(QStringView(), sym(2).Expression, sym(4).ClassElementList); node->classToken = loc(1); node->lbraceToken = loc(3); node->rbraceToken = loc(5); |