← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/84652

Cleaned up unused stuff in debugger_expr
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/84652
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/expression/expr.cpp'
--- src/compiler/expression/expr.cpp	2011-12-01 11:02:25 +0000
+++ src/compiler/expression/expr.cpp	2011-12-06 18:46:26 +0000
@@ -1458,42 +1458,17 @@
 debugger_expr::debugger_expr(
     static_context* sctx,
     const QueryLoc& loc,
-    expr_t aChild,
-    std::list<GlobalBinding> aGlobals,
+    const expr_t& aChild,
     namespace_context* nsCtx,
     bool aIsVarDeclaration)
   :
   namespace_context_base_expr(sctx, loc, debugger_expr_kind, nsCtx),
   theExpr(aChild),
-  theGlobals(aGlobals),
   theIsVarDeclaration(aIsVarDeclaration)
 {
   theScriptingKind = aChild->get_scripting_detail();
 }
 
-void debugger_expr::store_local_variables(checked_vector<var_expr_t>& aScopedVariables)
-{
-  std::set<const store::Item*> lQNames;
-  checked_vector<var_expr_t>::reverse_iterator it;
-  for ( it = aScopedVariables.rbegin(); it != aScopedVariables.rend(); ++it )
-  {
-    if ( lQNames.find((*it)->get_name()) == lQNames.end() )
-    {
-      lQNames.insert( (*it)->get_name() );
-      var_expr_t lValue = (*it);
-      var_expr_t lVariable(new var_expr(theSctx,
-                                        theLoc,
-                                        var_expr::eval_var,
-                                        lValue->get_name() ) );
-      lVariable->set_type( lValue->get_type() );
-      add_var(lVariable, lValue.getp());
-    }
-  }
-}
-
-void debugger_expr::compute_scripting_kind()
-{
-}
 
 void debugger_expr::serialize(::zorba::serialization::Archiver& ar)
 {
@@ -1501,9 +1476,13 @@
   ar & theExpr;
   ar & theVars;
   ar & theArgs;
-  ar & theGlobals;
   ar & theIsVarDeclaration;
 }
+
+
+void debugger_expr::compute_scripting_kind()
+{
+}
 #endif
 
 

=== modified file 'src/compiler/expression/expr.h'
--- src/compiler/expression/expr.h	2011-09-20 14:33:34 +0000
+++ src/compiler/expression/expr.h	2011-12-06 18:46:26 +0000
@@ -1193,6 +1193,19 @@
 #ifdef ZORBA_WITH_DEBUGGER
 /***************************************************************************//**
   debugger expression
+
+  theExpr:
+  --------
+  The wrapped expr
+
+  theVars:
+  --------
+
+  theArgs:
+  --------
+
+  theIsVarDeclaration:
+  --------------------
 ********************************************************************************/
 class debugger_expr : public namespace_context_base_expr
 {
@@ -1203,7 +1216,6 @@
   expr_t                      theExpr;
   checked_vector<var_expr_t>  theVars;
   std::vector<expr_t>         theArgs;
-  std::list<GlobalBinding>    theGlobals;
   bool                        theIsVarDeclaration;
 
 public:
@@ -1215,24 +1227,21 @@
   debugger_expr(
     static_context* sctx,
     const QueryLoc& loc,
-    expr_t aChild,
-    std::list<GlobalBinding> aGlobals,
+    const expr_t& aChild,
     namespace_context* nsCtx,
     bool aIsVarDeclaration);
 
   expr* get_expr() const { return theExpr.getp(); }
 
-  std::list<GlobalBinding> getGlobals() const { return theGlobals; }
-
   bool isVarDeclaration() const { return theIsVarDeclaration; }
 
   void accept(expr_visitor&);
 
   std::ostream& put(std::ostream&) const;
 
-  ulong var_count() const { return (ulong)theVars.size(); }
+  csize var_count() const { return theVars.size(); }
 
-  const var_expr* get_var(ulong i) const { return theVars[i]; }
+  const var_expr* get_var(csize i) const { return theVars[i]; }
 
   void add_var(const var_expr_t& var, const expr_t& arg) 
   {
@@ -1241,9 +1250,6 @@
   }
 
   void compute_scripting_kind();
-
-private:
-  void store_local_variables(checked_vector<var_expr_t>& aScopedVariables);
 };
 #endif
 

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2011-12-01 16:19:52 +0000
+++ src/compiler/translator/translator.cpp	2011-12-06 18:46:26 +0000
@@ -1680,14 +1680,14 @@
     std::auto_ptr<debugger_expr> lExpr(new debugger_expr(theSctx,
                                                          aLoc,
                                                          aExpr,
-                                                         thePrologVars,
                                                          theNSCtx,
                                                          aIsVarDeclaration));
 
     // add the breakable expression in the debugger commons as a possible
     // breakpoint location
     Breakable lBreakable(aLoc);
-    if (aAddBreakable) {
+    if (aAddBreakable) 
+    {
       theCCB->theDebuggerCommons->addBreakable(lBreakable);
     }
 
@@ -1702,23 +1702,24 @@
          lIter != lAllInScopeVars.end();
          ++lIter)
     {
-      store::Item* lVarname = (*lIter)->get_name();
+      var_expr* argVar = *lIter;
+
+      store::Item* lVarname = argVar->get_name();
+
       if (lVarname->getStringValue() == "$$dot")
       {
         continue;
       }
 
-      var_expr_t ve = create_var(lBreakable.getLocation(),
-                                 lVarname,
-                                 var_expr::eval_var,
-                                 NULL).dyn_cast<var_expr>();
-
-      var_expr* lVe = lookup_var(ve->get_name(), QueryLoc::null, err::XPST0008);
-
-      expr_t val = new wrapper_expr(theRootSctx,
-                                    lBreakable.getLocation(),
-                                    rchandle<expr>(lVe));
-      lExpr->add_var(ve, val);
+      var_expr_t evalVar = create_var(lBreakable.getLocation(),
+                                      lVarname,
+                                      var_expr::eval_var,
+                                      NULL);
+
+      expr_t argExpr = new wrapper_expr(theRootSctx,
+                                        lBreakable.getLocation(),
+                                        rchandle<expr>(argVar));
+      lExpr->add_var(evalVar, argExpr);
     }
 
     aExpr = lExpr.release();
@@ -5871,9 +5872,9 @@
   // it's important to insert the debugger before the scope is pushed.
   // Otherwise, the variable in question would already be in scope for
   // the debugger but no value would be bound
-  QueryLoc lExpandedLocation = expandQueryLoc(
-    v.get_name()->get_location(),
-    domainExpr->get_loc());
+  QueryLoc lExpandedLocation = expandQueryLoc(v.get_name()->get_location(),
+                                              domainExpr->get_loc());
+
   wrap_in_debugger_expr(domainExpr, lExpandedLocation);
 
   push_scope();
@@ -5980,9 +5981,9 @@
     // it's important to insert the debugger before the scope is pushed.
     // Otherwise, the variable in question would already be in scope for
     // the debugger but no value would be bound
-    QueryLoc lExpandedLocation = expandQueryLoc(
-      v.get_name()->get_location(),
-      domainExpr->get_loc());
+    QueryLoc lExpandedLocation = expandQueryLoc(v.get_name()->get_location(),
+                                                domainExpr->get_loc());
+
     wrap_in_debugger_expr(domainExpr, lExpandedLocation);
 
     push_scope();


Follow ups