Browse Source

[php] support interpolation in `__php__` code (see #4060)

Simon Krajewski 10 years ago
parent
commit
4c0d5458e4
2 changed files with 7 additions and 1 deletions
  1. 5 1
      extra/CHANGES.txt
  2. 2 0
      genphp.ml

+ 5 - 1
extra/CHANGES.txt

@@ -4,6 +4,10 @@
 
 
 	js : added variable number of arguments support in js.html.* classes
 	js : added variable number of arguments support in js.html.* classes
 
 
+	General improvements and optimizations:
+
+	php : support interpolation in __php__ code
+
 2015-03-15: 3.2.0-RC1
 2015-03-15: 3.2.0-RC1
 
 
 	This release removes support for Flash 8 target
 	This release removes support for Flash 8 target
@@ -55,7 +59,7 @@
 	cpp : fixed issue with NativeArray in --no-inline mode
 	cpp : fixed issue with NativeArray in --no-inline mode
 	php : fixed issue with invalid references for closures in for-loops
 	php : fixed issue with invalid references for closures in for-loops
 	php : fixed Reflect.compare and string comparison for numeric strings
 	php : fixed Reflect.compare and string comparison for numeric strings
-	cs/java : fixed various issues with -java-lib and -net-lib. 
+	cs/java : fixed various issues with -java-lib and -net-lib.
 	cs/java : added @:libType to skip checking on -java-lib / -net-lib types
 	cs/java : added @:libType to skip checking on -java-lib / -net-lib types
 	cs/java : compilation server now works with C#/Java [experimental support]
 	cs/java : compilation server now works with C#/Java [experimental support]
 	cs : fixed Type.enumIndex / switch on C# native enums
 	cs : fixed Type.enumIndex / switch on C# native enums

+ 2 - 0
genphp.ml

@@ -589,6 +589,8 @@ and gen_call ctx e el =
 	| TLocal { v_name = "__php__" }, [{ eexpr = TConst (TString code) }] ->
 	| TLocal { v_name = "__php__" }, [{ eexpr = TConst (TString code) }] ->
 		(*--php-prefix*)
 		(*--php-prefix*)
 		spr ctx (prefix_init_replace ctx.com code)
 		spr ctx (prefix_init_replace ctx.com code)
+	| TLocal { v_name = "__php__" }, { eexpr = TConst (TString code); epos = p } :: tl ->
+		Codegen.interpolate_code ctx.com code tl (spr ctx) (gen_expr ctx) p
 	| TLocal { v_name = "__instanceof__" },  [e1;{ eexpr = TConst (TString t) }] ->
 	| TLocal { v_name = "__instanceof__" },  [e1;{ eexpr = TConst (TString t) }] ->
 		gen_value ctx e1;
 		gen_value ctx e1;
 		print ctx " instanceof %s" t;
 		print ctx " instanceof %s" t;