handle partially qualified functions and types

For classes like mozilla::layers::Layer, currently the full type works and Layer works, but layers::Layer does not. This patch fixes that