From 90fe5f65effb61d507fad3f89290370377510fca Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sat, 3 Jan 2015 20:46:38 -0800 Subject: [PATCH] Allow 'immutable' to count towards the property check --- src/analysis/function_attributes.d | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/analysis/function_attributes.d b/src/analysis/function_attributes.d index 27a9a0a..c3b7786 100644 --- a/src/analysis/function_attributes.d +++ b/src/analysis/function_attributes.d @@ -62,18 +62,20 @@ class FunctionAttributeCheck : BaseAnalyzer bool foundConst = false; bool foundProperty = false; foreach (attribute; dec.attributes) - foundConst = foundConst || attribute.attribute.type == tok!"const"; + foundConst = foundConst || attribute.attribute.type == tok!"const" + || attribute.attribute.type == tok!"immutable"; foreach (attribute; dec.memberFunctionAttributes) { foundProperty = foundProperty || (attribute.atAttribute !is null && attribute.atAttribute.identifier.text == "property"); - foundConst = foundConst || (attribute.tokenType == tok!"const"); + foundConst = foundConst || attribute.tokenType == tok!"const" + || attribute.tokenType == tok!"immutable"; } if (foundProperty && !foundConst) { addErrorMessage(dec.name.line, dec.name.column, KEY, "Zero-parameter '@property' function should be" - ~ " marked 'const'. "); + ~ " marked 'const'."); } } dec.accept(this);