diff --git a/src/dparse/parser.d b/src/dparse/parser.d index 890c50b5..26f9272e 100644 --- a/src/dparse/parser.d +++ b/src/dparse/parser.d @@ -1210,6 +1210,7 @@ class Parser * | $(LITERAL 'nothrow') * | $(LITERAL 'pure') * | $(LITERAL 'ref') + * | $(LITERAL 'throw') * ;) */ Attribute parseAttribute() @@ -1267,6 +1268,7 @@ class Parser case tok!"nothrow": case tok!"pure": case tok!"ref": + case tok!"throw": node.attribute = advance(); break; default: @@ -4638,10 +4640,11 @@ class Parser case tok!"nothrow": case tok!"return": case tok!"scope": + case tok!"throw": node.tokenType = advance().type; break; default: - error(`Member funtion attribute expected`); + error(`Member function attribute expected`); } node.tokens = tokens[startIndex .. index]; return node; @@ -6113,6 +6116,7 @@ class Parser * | $(LITERAL 'scope') * | $(LITERAL 'static') * | $(LITERAL 'synchronized') + * | $(LITERAL 'throw') * ;) */ StorageClass parseStorageClass() @@ -6155,6 +6159,7 @@ class Parser case tok!"scope": case tok!"static": case tok!"synchronized": + case tok!"throw": node.token = advance(); break; default: @@ -8255,6 +8260,7 @@ protected: final: case tok!"ref": case tok!"extern": case tok!"align": + case tok!"throw": return true; default: return false; @@ -8274,6 +8280,7 @@ protected: final: case tok!"nothrow": case tok!"return": case tok!"scope": + case tok!"throw": return true; default: return false; diff --git a/test/fail_files/throwattribute.d b/test/fail_files/throwattribute.d new file mode 100644 index 00000000..46b02a88 --- /dev/null +++ b/test/fail_files/throwattribute.d @@ -0,0 +1,3 @@ +void doThings(throw int x) +{ +} diff --git a/test/pass_files/throwattribute.d b/test/pass_files/throwattribute.d new file mode 100644 index 00000000..b29b599c --- /dev/null +++ b/test/pass_files/throwattribute.d @@ -0,0 +1,10 @@ +void doStuff() throw { + throw void doThings() + { + + } + throw new Exception("OH NO!"); +} + +throw: + extern void throwsSomething();