]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Fix a bug that caused global variables in Dynamic Pascal
authorRhys Weatherley <rweather@southern-storm.com.au>
Tue, 11 May 2004 06:13:17 +0000 (06:13 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Tue, 11 May 2004 06:13:17 +0000 (06:13 +0000)
to be incorrectly allocated as locals.

ChangeLog
dpas/dpas-parser.y
dpas/dpas-scope.c
dpas/dpas-scope.h

index d7f0308d9fdd267651846ae003da2f1e2a9a6dce..00e3c0d71b8dcd5890139899289d9e397762e60b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@
        * jit/jit-rules-interp.c, jit/jit-rules-interp.h: implement
        the exception-handling opcodes for the interpreter.
 
+       * dpas/dpas-parser.y, dpas/dpas-scope.c, dpas/dpas-scope.h:
+       fix a bug that caused global variables in Dynamic Pascal
+       to be incorrectly allocated as locals.
+
 2004-05-10  Rhys Weatherley  <rweather@southern-storm.com.au>
 
        * jit/jit-reg-alloc.c, jit/jit-reg-alloc.h, jit/jit-rules-interp.c:
index a05c3e0f6a88547823d7c67821b61fd6b7516d21..05dc8ada55a805090f96d4ef19fd5957ff0d6180 100644 (file)
@@ -1125,7 +1125,7 @@ VariableDeclaration
                                        }
                                        else
                                        {
-                                               if(dpas_current_function())
+                                               if(!dpas_scope_is_module())
                                                {
                                                        jit_value_t value;
                                                        value = jit_value_create
index 50065f36a4e90ec008fa536345b6c896151052fc..951b034dec43bca64afae1a1209ab12b7029dc0a 100644 (file)
@@ -360,3 +360,8 @@ void dpas_scope_pop(void)
                dpas_scope_destroy(scope);
        }
 }
+
+int dpas_scope_is_module(void)
+{
+       return (dpas_scope_current()->parent == dpas_scope_global());
+}
index b0f3770286520e1b4d576a25b5ea094ead201197..6f41ce37b05b8cabcf83b3f804403e68e13eb502 100644 (file)
@@ -149,6 +149,11 @@ dpas_scope_t dpas_scope_push(void);
  */
 void dpas_scope_pop(void);
 
+/*
+ * Determine if the current scope is the module-global scope.
+ */
+int dpas_scope_is_module(void);
+
 #ifdef __cplusplus
 };
 #endif