From 04689beec3211fbe352ceec6222b066bfad02c85 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Sun, 2 Jul 2023 13:19:42 -0600 Subject: [PATCH] FIxed null warnings --- Expr.g.cs | 2 +- Parser.cs | 5 +++-- ast_classes.fsx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Expr.g.cs b/Expr.g.cs index 3414526..b2c5169 100644 --- a/Expr.g.cs +++ b/Expr.g.cs @@ -3,7 +3,7 @@ // DO NOT EDIT. // //////////////////////////////////////////////////////////// -using System; +#nullable enable namespace Finn.AST; diff --git a/Parser.cs b/Parser.cs index 2a2dd86..a63ce43 100644 --- a/Parser.cs +++ b/Parser.cs @@ -199,7 +199,7 @@ class Parser if (match(TokenType.At)) { Token literal = consume(TokenType.String, "Expect string literal after '@'."); - return new((string)(literal.literal ?? ""), true); + return new((string)(literal.literal!), true); } return null; } @@ -254,7 +254,8 @@ class Parser { 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(); diff --git a/ast_classes.fsx b/ast_classes.fsx index 0b689f6..abe7d3d 100644 --- a/ast_classes.fsx +++ b/ast_classes.fsx @@ -76,7 +76,7 @@ let renderAST outputDir baseName types = // DO NOT EDIT. // //////////////////////////////////////////////////////////// -using System; +#nullable enable namespace Finn.AST;