Add sanity check
This commit is contained in:
parent
57704f5ee5
commit
2cdc8ca7fc
1 changed files with 5 additions and 13 deletions
|
@ -94,22 +94,14 @@ namespace AspectedRouting.Language
|
||||||
|
|
||||||
// TODO FIX THIS so that it works
|
// TODO FIX THIS so that it works
|
||||||
// An argument 'optimizes' it's types from 'string -> bool' to 'string -> string'
|
// An argument 'optimizes' it's types from 'string -> bool' to 'string -> string'
|
||||||
try
|
var eOpt = eSmallest.Optimize();
|
||||||
|
if (eOpt == null || eOpt.Types.Count() == 0)
|
||||||
{
|
{
|
||||||
var eOpt = eSmallest.Optimize(); if (eOpt == null || eOpt.Types.Count() == 0)
|
throw new Exception("Could not optimize " + eSmallest);
|
||||||
{
|
|
||||||
throw new Exception("Could not optimize " + eSmallest);
|
|
||||||
}
|
|
||||||
eOpt.SanityCheck();
|
|
||||||
return eOpt;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Console.WriteLine("Optimalization failed for "+eSmallest);
|
|
||||||
return eSmallest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eOpt.SanityCheck();
|
||||||
|
return eOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IExpression SpecializeToSmallestType(this IExpression e)
|
public static IExpression SpecializeToSmallestType(this IExpression e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue