Skip to content

Commit

Permalink
make getTokensForParser return non-const
Browse files Browse the repository at this point in the history
since data is allocated with an appender that is not cleared, GC owns
the memory and may be modified by the user if they wish to.

Can still be used in all places where const was used before.
  • Loading branch information
WebFreak001 committed Oct 29, 2023
1 parent d3767e0 commit 8588b70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dparse/lexer.d
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public bool isLiteral(IdType type) pure nothrow @safe @nogc
* `leadingTrivia` until there is the EOF, where it will be attached as
* `trailingTrivia` again.
*/
const(Token)[] getTokensForParser(R)(R sourceCode, LexerConfig config, StringCache* cache)
Token[] getTokensForParser(R)(R sourceCode, LexerConfig config, StringCache* cache)
if (is(Unqual!(ElementEncodingType!R) : ubyte) && isDynamicArray!R)
{
config.whitespaceBehavior = WhitespaceBehavior.include;
Expand Down

0 comments on commit 8588b70

Please sign in to comment.