Commit 47b70610 authored by Jesse McGrew's avatar Jesse McGrew
Browse files

Changed ZIL0123 message to say which type the compiler is complaining about.

parent 18f35ec54169
......@@ -71,7 +71,10 @@ namespace Zilf.Compiler
break;
default:
Context.HandleError(new CompilerError(expr.SourceLine ?? src, CompilerMessages.Expressions_Of_This_Type_Cannot_Be_Compiled));
Context.HandleError(new CompilerError(
expr.SourceLine ?? src,
CompilerMessages.Expressions_Of_Type_0_Cannot_Be_Compiled,
type));
return;
}
......@@ -455,7 +458,9 @@ namespace Zilf.Compiler
break;
case ZilList _:
throw new CompilerError(stmt, CompilerMessages.Expressions_Of_This_Type_Cannot_Be_Compiled)
throw new CompilerError(stmt,
CompilerMessages.Expressions_Of_Type_0_Cannot_Be_Compiled,
stmt.GetTypeAtom(Context))
.Combine(new CompilerError(CompilerMessages.Misplaced_Bracket_In_COND_Or_Loop));
default:
......@@ -466,8 +471,10 @@ namespace Zilf.Compiler
if (result == null)
{
// TODO: show "expressions of this type cannot be compiled" warning even if wantResult is false?
throw new CompilerError(stmt,
CompilerMessages.Expressions_Of_This_Type_Cannot_Be_Compiled);
throw new CompilerError(
stmt,
CompilerMessages.Expressions_Of_Type_0_Cannot_Be_Compiled,
stmt.GetTypeAtom(Context));
}
}
break;
......
......@@ -246,7 +246,8 @@ namespace Zilf.Compiler
default:
Context.HandleError(new CompilerError(
expr.SourceLine ?? src,
CompilerMessages.Expressions_Of_This_Type_Cannot_Be_Compiled));
CompilerMessages.Expressions_Of_Type_0_Cannot_Be_Compiled,
expr.GetTypeAtom(Context)));
return Game.Zero;
}
}
......@@ -413,7 +414,10 @@ namespace Zilf.Compiler
var constValue = CompileConstant(expr);
if (constValue == null)
{
Context.HandleError(new CompilerError(expr, CompilerMessages.Expressions_Of_This_Type_Cannot_Be_Compiled));
Context.HandleError(new CompilerError(
expr,
CompilerMessages.Expressions_Of_Type_0_Cannot_Be_Compiled,
expr.GetTypeAtom(Context)));
return Game.Zero;
}
else
......
......@@ -267,7 +267,10 @@ namespace Zilf.Compiler
break;
case ZilList _:
throw new CompilerError(stmt, CompilerMessages.Expressions_Of_This_Type_Cannot_Be_Compiled)
throw new CompilerError(
stmt,
CompilerMessages.Expressions_Of_Type_0_Cannot_Be_Compiled,
stmt.GetTypeAtom(Context))
.Combine(new CompilerError(CompilerMessages.Misplaced_Bracket_In_COND_Or_Loop));
default:
......@@ -278,7 +281,10 @@ namespace Zilf.Compiler
if (value == null)
{
// TODO: show "expressions of this type cannot be compiled" warning even if wantResult is false?
throw new CompilerError(stmt, CompilerMessages.Expressions_Of_This_Type_Cannot_Be_Compiled);
throw new CompilerError(
stmt,
CompilerMessages.Expressions_Of_Type_0_Cannot_Be_Compiled,
stmt.GetTypeAtom(Context));
}
rb.Return(value);
......
......@@ -92,8 +92,8 @@ namespace Zilf.Diagnostics
public const int Elements_Of_Binding_List_Must_Be_Atoms_Or_Lists = 121;
[Message("unrecognized {0}: {1}")]
public const int Unrecognized_0_1 = 122;
[Message("expressions of this type cannot be compiled")]
public const int Expressions_Of_This_Type_Cannot_Be_Compiled = 123;
[Message("expressions of type '{0}' cannot be compiled")]
public const int Expressions_Of_Type_0_Cannot_Be_Compiled = 123;
[Message("misplaced bracket in COND or loop?", Severity = Severity.Info)]
public const int Misplaced_Bracket_In_COND_Or_Loop = 124;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment