1.1 --- a/jitcraft/Scopes.cpp Mon Jun 25 02:57:28 2012 -0700
1.2 +++ b/jitcraft/Scopes.cpp Mon Jun 25 21:20:01 2012 -0700
1.3 @@ -16,6 +16,7 @@
1.4 * JITCraft. If not, see http://www.gnu.org/licenses/.
1.5 */
1.6 #include "Scopes.h"
1.7 +#include "Types.h"
1.8
1.9 using namespace jc;
1.10
1.11 @@ -170,3 +171,15 @@
1.12 tree->scope()->allocateGlobals();
1.13 return true;
1.14 }
1.15 +
1.16 +Variable *
1.17 +Scope::firstUnsafeArray()
1.18 +{
1.19 + for (size_t i = 0; i < names_.size(); i++) {
1.20 + if (names_[i]->kind() != BoundName::VARIABLE)
1.21 + continue;
1.22 + if (names_[i]->toVariable()->type()->isUnsafeArray())
1.23 + return names_[i]->toVariable();
1.24 + }
1.25 + return NULL;
1.26 +}