[phc-internals] [phc commit] r1174 - trunk/src/codegen

codesite-noreply at google.com codesite-noreply at google.com
Tue Apr 15 10:36:44 IST 2008


Author: paul.biggar
Date: Tue Apr 15 02:34:55 2008
New Revision: 1174

Modified:
   trunk/src/codegen/Generate_C.cpp

Log:
Refactor Generate_C to avoid duplicate code.


Modified: trunk/src/codegen/Generate_C.cpp
==============================================================================
--- trunk/src/codegen/Generate_C.cpp	(original)
+++ trunk/src/codegen/Generate_C.cpp	Tue Apr 15 02:34:55 2008
@@ -299,17 +299,14 @@
 }

 /* wrappers */
-void index_lhs (Scope scope, string zvp, Expr* expr)
-{
-	Variable* var = dynamic_cast<Variable*> (expr);
-	assert (var);
-	index_lhs (scope, zvp, var);
-}
 void index_lhs (Scope scope, string zvp, VARIABLE_NAME* var_name)
 {
 	index_lhs (scope, zvp, new Variable (var_name));
 }
-
+void index_lhs (Scope scope, string zvp, Expr* expr)
+{
+	index_lhs (scope, zvp, get_var_name (expr));
+}

 /* Generate code to read the variable named in VAR to the zval* ZVP */
 void read (Scope scope, string zvp, Variable* var)
@@ -401,17 +398,15 @@
 }

 /* wrappers */
-void read (Scope scope, string zvp, Expr* expr)
-{
-	Variable* var = dynamic_cast<Variable*> (expr);
-	assert (var);
-	read (scope, zvp, var);
-}
-
 void read (Scope scope, string zvp, VARIABLE_NAME* var_name)
 {
 	read (scope, zvp, new Variable (var_name));
 }
+void read (Scope scope, string zvp, Expr* expr)
+{
+	read (scope, zvp, get_var_name (expr));
+}
+





More information about the phc-internals mailing list