Add declaration attributes to the relevant FunctionAttributes object

This commit is contained in:
Liran Zvibel 2014-05-26 21:35:39 +03:00
parent 885d0d2ff5
commit e99bf1f616
2 changed files with 6 additions and 3 deletions

View File

@ -1531,6 +1531,7 @@ public:
/** */ FunctionBody functionBody;
/** */ MemberFunctionAttribute[] memberFunctionAttributes;
/** */ string comment;
/** */ Attribute[] attributes;
mixin OpEquals;
}

View File

@ -1790,7 +1790,7 @@ class ClassFive(A, B) : Super if (someTest()) {}}c;
if (peekIs(tok!"="))
node.variableDeclaration = parseVariableDeclaration(null, true);
else if (peekIs(tok!"("))
node.functionDeclaration = parseFunctionDeclaration(null, true);
node.functionDeclaration = parseFunctionDeclaration(null, true, node.attributes);
else
goto type;
}
@ -1811,7 +1811,7 @@ class ClassFive(A, B) : Super if (someTest()) {}}c;
return null;
}
if (peekIs(tok!"("))
node.functionDeclaration = parseFunctionDeclaration(type);
node.functionDeclaration = parseFunctionDeclaration(type, false, node.attributes);
else
node.variableDeclaration = parseVariableDeclaration(type);
break;
@ -2540,7 +2540,7 @@ body {} // six
* ($(RULE storageClass) | $(RULE _type)) $(LITERAL Identifier) $(RULE templateParameters) $(RULE parameters) $(RULE memberFunctionAttribute)* $(RULE constraint)? ($(RULE functionBody) | $(LITERAL ';'))
* ;)
*/
FunctionDeclaration parseFunctionDeclaration(Type type = null, bool isAuto = false)
FunctionDeclaration parseFunctionDeclaration(Type type = null, bool isAuto = false, Attribute[] attributes = null)
{
mixin(traceEnterAndExit!(__FUNCTION__));
auto node = allocate!FunctionDeclaration;
@ -2548,6 +2548,8 @@ body {} // six
comment = null;
MemberFunctionAttribute[] memberFunctionAttributes;
node.attributes = attributes;
if (isAuto)
goto functionName;