Browse Source

[python] fix String.length handling in Boot.field

frabbit 8 years ago
parent
commit
1500b893cd
1 changed files with 4 additions and 6 deletions
  1. 4 6
      std/python/Boot.hx

+ 4 - 6
std/python/Boot.hx

@@ -294,6 +294,8 @@ class Boot {
 		if (field == null) return null;
 		if (field == null) return null;
 
 
 		return switch (field) {
 		return switch (field) {
+			case "length" if (isString(o)):
+				StringImpl.get_length(o);
 			case "toLowerCase" if (isString(o)):
 			case "toLowerCase" if (isString(o)):
 				createClosure(o, StringImpl.toLowerCase);
 				createClosure(o, StringImpl.toLowerCase);
 			case "toUpperCase" if (isString(o)):
 			case "toUpperCase" if (isString(o)):
@@ -355,12 +357,8 @@ class Boot {
 			case "splice" if (isArray(o)):
 			case "splice" if (isArray(o)):
 				createClosure(o, ArrayImpl.splice);
 				createClosure(o, ArrayImpl.splice);
 			default:
 			default:
-				if(isString(o)) {
-					(o:String).length;
-				} else {
-					var field = handleKeywords(field);
-					if (UBuiltins.hasattr(o, field)) UBuiltins.getattr(o, field) else null;
-				}
+				var field = handleKeywords(field);
+				if (UBuiltins.hasattr(o, field)) UBuiltins.getattr(o, field) else null;
 		}
 		}
 	}
 	}