@@ -39,6 +39,7 @@
spod_macro now uses wrappers for Bytes (require neko 1.8.2)
php : added --php-prefix for prefixing generated files and class names
all : added type_expr_with_type enum support
+ php/js : fixed adding 'null' to StringBuf
2011-01-30: 2.07
all : fixed completion support with --remap
@@ -43,8 +43,10 @@ class StringBuf {
/**
Adds the representation of any value to the string buffer.
**/
- public inline function add( ?x : Dynamic ) {
- #if (js || cpp)
+ public inline function add( x : Dynamic ) {
+ #if js
+ b[b.length] = x == null ? 'null' : x;
+ #elseif cpp
b[b.length] = x;
#else
b += x;
@@ -31,7 +31,7 @@
b = __make();
}
- public inline function add( ?x : Dynamic ) : Void {
+ public inline function add( x : Dynamic ) : Void {
__add(b,x);
@@ -30,7 +30,8 @@
b = "";
+ untyped if( __call__('is_null',x) ) x = 'null' else if( __call__('is_bool',x) ) x = x?'true':'false';
@@ -299,4 +299,17 @@ class TestMisc extends Test {
eq( e.get(), 7 );
+ function testStringBuf() {
+ var b = new StringBuf();
+ b.add( -45);
+ b.add(1.456);
+ b.add(null);
+ b.add(true);
+ b.add(false);
+ b.add("Hello!");
+ b.addSub("Bla", 1, 2);
+ b.addChar("R".code);
+ eq(b.toString(), "-451.456nulltruefalseHello!laR");
+ }
+