Skip to content

Commit e2053ce

Browse files
Seal the classes and fixed a typo
1 parent aea7028 commit e2053ce

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

CritLang/CommandLineArgs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace CritLang
22
{
3-
internal class CommandLineArgs
3+
internal sealed class CommandLineArgs
44
{
55
/// <summary>
66
/// Parse the arguments passed to the program.

CritLang/CritVisitor.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace CritLang;
66

7-
public class CritVisitor: CritBaseVisitor<object?>
7+
public sealed class CritVisitor: CritBaseVisitor<object?>
88
{
99
private Dictionary<string, object?> Variables { get; } = new();
1010

@@ -42,31 +42,31 @@ public CritVisitor(string version)
4242

4343
}
4444

45-
public static object? GetTypeOf(object?[] args)
45+
private static object? GetTypeOf(object?[] args)
4646
{
4747
if (args.Length == 0 || args.Length > 1)
4848
throw new Exception("Type only takes 1 argument.");
4949

5050
return args[0]!.GetType();
5151
}
5252

53-
public static object? Split(object?[] args)
53+
private static object? Split(object?[] args)
5454
{
55-
if (args.Length != 2) throw new Exception("Delay takes 2 arguments.");
55+
if (args.Length != 2) throw new Exception("Split takes 2 arguments.");
5656
object[]? ol = args[0]?.ToString()?.Split(args[1]!.ToString()!.ToCharArray());
5757
return ol?.ToList();
5858
}
5959

60-
public static object? Delay(object?[] args)
60+
private static object? Delay(object?[] args)
6161
{
6262
if (args.Length != 1) throw new Exception("Delay takes 1 argument that is the number of milliseconds to delay.");
6363
Task.Delay((int)args[0]!).Wait();
6464
return null;
6565

6666
}
6767

68-
69-
public static object? Time(object?[] args)
68+
69+
private static object? Time(object?[] args)
7070
{
7171
if (args.Length != 0) throw new Exception("Time takes no arguments");
7272

@@ -75,7 +75,7 @@ public CritVisitor(string version)
7575
return Math.Round(timestamp / 1000, 2);
7676
}
7777

78-
public static object? ReadText(object?[] args)
78+
private static object? ReadText(object?[] args)
7979
{
8080
if (args.Length != 1) throw new Exception("ReadText expects 1 argument");
8181

@@ -90,7 +90,7 @@ public CritVisitor(string version)
9090
}
9191

9292

93-
public static object? ConvertTo(object?[] args)
93+
private static object? ConvertTo(object?[] args)
9494
{
9595
if (args.Length != 2)
9696
throw new Exception("ConvertTo expects 2 arguments, first one the variable to convert to and the second one being the type.");

0 commit comments

Comments
 (0)