diff --git a/mode/haxe/haxe.js b/mode/haxe/haxe.js
index 548cbe1b47098ea481fbd9ea0670763bc46b3665..2ef55b273eecc6456c8aedc263d25005da56d057 100644
--- a/mode/haxe/haxe.js
+++ b/mode/haxe/haxe.js
@@ -358,7 +358,8 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
     if (value == "in") return cont();
   }
   function functiondef(type, value) {
-    if (type == "variable") {register(value); return cont(functiondef);}
+    //function names starting with upper-case letters are recognised as types, so cludging them together here.
+    if (type == "variable" || type == "type") {register(value); return cont(functiondef);}
     if (value == "new") return cont(functiondef);
     if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, typeuse, statement, popcontext);
   }