fix tab and create routine for gen exception type

This commit is contained in:
Basile Burg 2018-05-25 23:36:02 +02:00
parent aa7bdf81c6
commit a0010d6a8a
1 changed files with 38 additions and 42 deletions

View File

@ -57,17 +57,20 @@ final class ProperlyDocumentedPublicFunctions : BaseAnalyzer
.functionCallExpression.unaryExpression.primaryExpression .functionCallExpression.unaryExpression.primaryExpression
.identifierOrTemplateInstance; .identifierOrTemplateInstance;
Type newNamedType(N)(N name)
{
Type t = new Type;
t.type2 = new Type2;
t.type2.typeIdentifierPart = new TypeIdentifierPart;
t.type2.typeIdentifierPart.identifierOrTemplateInstance = new IdentifierOrTemplateInstance;
t.type2.typeIdentifierPart.identifierOrTemplateInstance.identifier = name;
return t;
}
// enforce(condition); // enforce(condition);
if (iot && iot.identifier.text == "enforce") if (iot && iot.identifier.text == "enforce")
{ {
Type tt = new Type; thrown ~= newNamedType(Token(tok!"identifier", "Exception", 0, 0, 0));
tt.type2 = new Type2;
tt.type2.typeIdentifierPart = new TypeIdentifierPart;
tt.type2.typeIdentifierPart.identifierOrTemplateInstance =
new IdentifierOrTemplateInstance;
tt.type2.typeIdentifierPart.identifierOrTemplateInstance.identifier =
Token(tok!"identifier", "Exception", 0, 0, 0);
thrown ~= tt;
} }
else if (iot && iot.templateInstance && iot.templateInstance.identifier.text == "enforce") else if (iot && iot.templateInstance && iot.templateInstance.identifier.text == "enforce")
{ {
@ -75,14 +78,7 @@ final class ProperlyDocumentedPublicFunctions : BaseAnalyzer
if (const TemplateSingleArgument tsa = safeAccess(iot.templateInstance) if (const TemplateSingleArgument tsa = safeAccess(iot.templateInstance)
.templateArguments.templateSingleArgument) .templateArguments.templateSingleArgument)
{ {
Type tt = new Type; thrown ~= newNamedType(tsa.token);
tt.type2 = new Type2;
tt.type2.typeIdentifierPart = new TypeIdentifierPart;
tt.type2.typeIdentifierPart.identifierOrTemplateInstance =
new IdentifierOrTemplateInstance;
tt.type2.typeIdentifierPart.identifierOrTemplateInstance.identifier =
tsa.token;
thrown ~= tt;
} }
// enforce!(Type)(condition); // enforce!(Type)(condition);
else if (const TemplateArgumentList tal = safeAccess(iot.templateInstance) else if (const TemplateArgumentList tal = safeAccess(iot.templateInstance)