Fix selection of first graphnode to execute in a function

1. Add a property to the graphnopde to determine if its immediate scope
is a function
2. Nested language testcase
Rename variable
Merge pull request #2074 from junmendoza/testcasefix

Fix selection of first graphnode to execute in a function