FIxed null warnings

This commit is contained in:
Brandon Dyck 2023-07-02 13:19:42 -06:00
parent bd135f0203
commit 04689beec3
3 changed files with 5 additions and 4 deletions

View File

@ -3,7 +3,7 @@
// DO NOT EDIT. // // DO NOT EDIT. //
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
using System; #nullable enable
namespace Finn.AST; namespace Finn.AST;

View File

@ -199,7 +199,7 @@ class Parser
if (match(TokenType.At)) if (match(TokenType.At))
{ {
Token literal = consume(TokenType.String, "Expect string literal after '@'."); Token literal = consume(TokenType.String, "Expect string literal after '@'.");
return new((string)(literal.literal ?? ""), true); return new((string)(literal.literal!), true);
} }
return null; return null;
} }
@ -254,7 +254,8 @@ class Parser
{ {
if (match(TokenType.Number, TokenType.String)) if (match(TokenType.Number, TokenType.String))
{ {
return new Literal { Value = previous().literal }; object literal = previous().literal!;
return new Literal { Value = previous().literal! };
} }
var ident = name(); var ident = name();

View File

@ -76,7 +76,7 @@ let renderAST outputDir baseName types =
// DO NOT EDIT. // // DO NOT EDIT. //
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
using System; #nullable enable
namespace Finn.AST; namespace Finn.AST;