BadScript 2
Loading...
Searching...
No Matches
BadEmptySwitchStatementValidator.cs
Go to the documentation of this file.
3
8{
10 protected override void Validate(BadExpressionValidatorContext context, BadSwitchExpression expr)
11 {
12 if (expr.Cases.Count == 0 || expr.Cases.All(x => x.Value.Length == 0))
13 {
14 context.AddError(
15 "Switch statement has no cases",
16 expr,
17 expr,
18 this
19 );
20 }
21 }
22}
Implements the Switch Statement Expression.
IDictionary< BadExpression, BadExpression[]> Cases
The Cases.
override void Validate(BadExpressionValidatorContext context, BadSwitchExpression expr)
Contains the Block Expressions for the BadScript2 Language.
Contains the Expression Validators for the BadScript2 Language.
void AddError(string message, BadExpression parentExpression, BadExpression expression, BadExpressionValidator validator)
Adds an error message to the context.