Bladeren bron

[python] minor canSeek cleanup

Dan Korostelev 9 jaren geleden
bovenliggende
commit
7663b1d89e
2 gewijzigde bestanden met toevoegingen van 5 en 13 verwijderingen
  1. 3 7
      std/python/io/NativeInput.hx
  2. 2 6
      std/python/io/NativeOutput.hx

+ 3 - 7
std/python/io/NativeInput.hx

@@ -27,7 +27,7 @@ import python.Bytearray;
 import python.lib.io.IOBase;
 import python.lib.io.RawIOBase;
 
-class NativeInput<T:IOBase> extends Input{
+class NativeInput<T:IOBase> extends Input {
 
 	var stream:T;
 	var wasEof:Bool;
@@ -39,12 +39,8 @@ class NativeInput<T:IOBase> extends Input{
 		if (!stream.readable()) throw "Write-only stream";
 	}
 
-	public var canSeek(get_canSeek, null):Bool;
-
-	private function get_canSeek():Bool
-	{
-		return stream.seekable();
-	}
+	public var canSeek(get,never):Bool;
+	inline function get_canSeek():Bool return stream.seekable();
 
 	override public function close():Void
 	{

+ 2 - 6
std/python/io/NativeOutput.hx

@@ -30,7 +30,8 @@ class NativeOutput<T:IOBase> extends Output {
 
 	var stream:T;
 
-	public var canSeek(get_canSeek, null):Bool;
+	public var canSeek(get,never):Bool;
+	inline function get_canSeek():Bool return stream.seekable();
 
 	public function new (stream:T) {
 		this.bigEndian = false;
@@ -43,11 +44,6 @@ class NativeOutput<T:IOBase> extends Output {
 		stream.close();
 	}
 
-	private function get_canSeek():Bool
-	{
-		return stream.seekable();
-	}
-
 	override public function prepare(nbytes:Int):Void
 	{
 		stream.truncate(nbytes);