Explorar o código

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

Simon Krajewski %!s(int64=10) %!d(string=hai) anos
pai
achega
4c0d5458e4
Modificáronse 2 ficheiros con 7 adicións e 1 borrados
  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
 
+	General improvements and optimizations:
+
+	php : support interpolation in __php__ code
+
 2015-03-15: 3.2.0-RC1
 
 	This release removes support for Flash 8 target
@@ -55,7 +59,7 @@
 	cpp : fixed issue with NativeArray in --no-inline mode
 	php : fixed issue with invalid references for closures in for-loops
 	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 : compilation server now works with C#/Java [experimental support]
 	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) }] ->
 		(*--php-prefix*)
 		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) }] ->
 		gen_value ctx e1;
 		print ctx " instanceof %s" t;