var calls like "a;" does not create local variable definition in scope 1 ( console ) 53/16453/2
Antoine ELIAS [Wed, 6 May 2015 14:20:10 +0000 (16:20 +0200)]
-->%pi; // %pi level stay 0

function test()
    %pi; //create a local definition of %pi like %pi=%pi;
endfunction

Change-Id: I19a35cd59c0cf026f9b95dadae6434df0ae4f0e5

scilab/modules/ast/includes/ast/runvisitor.hxx

index e232256..ec120e3 100644 (file)
@@ -417,12 +417,12 @@ public :
 
             //check if var is recalled in current scope like
             //function f()
-            //  a;
+            //  a; //<=> a=a;
             //  a(2) = 18;
             //endfunction
             if (e.getParent()->isSeqExp())
             {
-                if (var->empty() == false && var->top()->m_iLevel != ctx->getScopeLevel())
+                if (ctx->getScopeLevel() > 1 && var->empty() == false && var->top()->m_iLevel != ctx->getScopeLevel())
                 {
                     //put var in current scope
                     ctx->put(var, pI);