← 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/114336

Avoid (if possible) treat expr for checking that the value of a non-external global variable conforms to the type declaration of the vatiable
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/114336
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-07-11 04:46:41 +0000
+++ ChangeLog	2012-07-11 05:37:40 +0000
@@ -23,6 +23,8 @@
   * Optimized hash function used for nodes (also fixes bug #1010051)
   * No more serialization of compiler expressions.
   * Big rewrite of plan serializer internals, resulting in big performance improvement.
+  * Avoid (if possible) treat expr for checking that the value of a non-external
+    global variable conforms to the type declaration of the vatiable.
 
 Bug Fixes/Other Changes:
   * Fixed bug #1002993 (bug during revalidation after update; improper condition

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2012-07-11 05:28:20 +0000
+++ src/compiler/translator/translator.cpp	2012-07-11 05:37:40 +0000
@@ -1923,12 +1923,21 @@
     varType = GENV_TYPESYSTEM.ITEM_TYPE_ONE;
   }
 
+  if (initExpr != NULL && varType != NULL)
+  {
+    initExpr = new treat_expr(theRootSctx,
+                              loc,
+                              initExpr,
+                              varType,
+                              TreatIterator::TYPE_MATCH);
+  }
+
   expr_t declExpr = new var_decl_expr(theRootSctx, loc, varExpr, initExpr);
 
   stmts.push_back(declExpr);
 
   // check type for vars that are external or have an init expr
-  if (varType != NULL && (b.is_extern() || b.theExpr != NULL))
+  if (varType != NULL && b.is_extern())
   {
     expr_t getExpr = new fo_expr(theRootSctx, loc, varGet, varExpr);
 


Follow ups