Cache dynamic function node only once and retrieve it if it exists

1. Cache dynamic function node once
2. Re-use existing AST uid when re-creating ASTs