Does this function appear inside the rest of your class definition {}
? Sounds like maybe your class { ... }
closes prematurely before this.
Turns out you were declaring a new function within a function, because of one missing closing bracket.
See here: http://www.pastebin.com/iwSXr1Qa the error was at line 55