dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/JScript/Nodes JExpr.tc,1.4,1.5 JNode


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/JScript/Nodes JExpr.tc,1.4,1.5 JNode.tc,1.2,1.3 JStmt.tc,1.1,1.2
Date: Tue, 21 Jan 2003 17:11:51 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/JScript/Nodes
In directory subversions:/tmp/cvs-serv20060/JScript/Nodes

Modified Files:
        JExpr.tc JNode.tc JStmt.tc 
Log Message:


Implement function calls; "for-in" statements; variable declarations;
property enums.


Index: JExpr.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/JScript/Nodes/JExpr.tc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** JExpr.tc    17 Jan 2003 06:34:47 -0000      1.4
--- JExpr.tc    21 Jan 2003 22:11:49 -0000      1.5
***************
*** 109,113 ****
  
  // Prepare for a store into an identifier.
! Prepare(JIdentifier)
  {
        IVariableAccess scope = (engine.ScriptObjectStackTop() as 
IVariableAccess);
--- 109,114 ----
  
  // Prepare for a store into an identifier.
! Prepare(JIdentifier),
! Prepare(JVarDecl)
  {
        IVariableAccess scope = (engine.ScriptObjectStackTop() as 
IVariableAccess);
***************
*** 125,129 ****
  
  // Get and prepare for a store into an identifier.
! GetAndPrepare(JIdentifier)
  {
        IVariableAccess scope = (engine.ScriptObjectStackTop() as 
IVariableAccess);
--- 126,131 ----
  
  // Get and prepare for a store into an identifier.
! GetAndPrepare(JIdentifier),
! GetAndPrepare(JVarDecl)
  {
        IVariableAccess scope = (engine.ScriptObjectStackTop() as 
IVariableAccess);
***************
*** 143,147 ****
  
  // Store into an identifier in the current execution context.
! Store(JIdentifier)
  {
        ((IVariableAccess)data1).SetVariable(name, value);
--- 145,150 ----
  
  // Store into an identifier in the current execution context.
! Store(JIdentifier),
! Store(JVarDecl)
  {
        ((IVariableAccess)data1).SetVariable(name, value);

Index: JNode.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/JScript/Nodes/JNode.tc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** JNode.tc    17 Jan 2003 06:34:47 -0000      1.2
--- JNode.tc    21 Jan 2003 22:11:49 -0000      1.3
***************
*** 330,334 ****
  
        // Add the function to the scope.
!       scope.Put(name, obj);
  
        // Nothing else to do.
--- 330,341 ----
  
        // Add the function to the scope.
!       if(scope is IVariableAccess)
!       {
!               ((IVariableAccess)scope).SetVariable(name, obj);
!       }
!       else
!       {
!               scope.Put(name, obj);
!       }
  
        // Nothing else to do.

Index: JStmt.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/JScript/Nodes/JStmt.tc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** JStmt.tc    13 Jan 2003 10:53:20 -0000      1.1
--- JStmt.tc    21 Jan 2003 22:11:49 -0000      1.2
***************
*** 216,221 ****
  Eval(JForIn)
  {
!       // TODO
!       return Empty.Value;
  }
  
--- 216,281 ----
  Eval(JForIn)
  {
!       // Evaluate variable declarations, to make sure that the
!       // variable is properly declared into the current scope.
!       if(decl is JVarDecl)
!       {
!               decl.Eval(engine);
!       }
! 
!       // Get the collection that we will be enumerating.
!       Object set = expr.Eval(engine);
!       IEnumerator e = ForIn.JScriptGetEnumerator(set);
! 
!       // Loop over the collection.
!       Object result = Empty.Value;
!       Object data1, data2, temp;
!       try
!       {
!               while(e.MoveNext())
!               {
!                       try
!                       {
!                               // Assign e.Current to the loop variable.
!                               data1 = null;
!                               data2 = null;
!                               decl.Prepare(engine, ref data1, ref data2);
!                               decl.Store(engine, data1, data2, e.Current);
! 
!                               // Execute the loop body.
!                               if(body != null)
!                               {
!                                       temp = body.Eval(engine);
!                                       if(temp != Empty.Value)
!                                       {
!                                               result = temp;
!                                       }
!                               }
!                       }
!                       catch(ContinueJumpOut cont)
!                       {
!                               // We received a "continue" from inside the 
"for-in" loop.
!                               if(!Support.LabelMatch(cont.label, labels))
!                               {
!                                       throw;
!                               }
!                       }
!               }
!       }
!       catch(BreakJumpOut brk)
!       {
!               // We received a "break" from inside the "for-in" loop.
!               if(!Support.LabelMatch(brk.label, labels))
!               {
!                       throw;
!               }
!       }
!       finally
!       {
!               if(e is IDisposable)
!               {
!                       ((IDisposable)e).Dispose();
!               }
!       }
!       return result;
  }
  
***************
*** 427,430 ****
--- 487,494 ----
                {
                        varAccess.SetVariable(name, initializer.Eval(engine));
+               }
+               else
+               {
+                       varAccess.DeclareVariable(name);
                }
                return name;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]