Ver Fonte

minor mark fixes.

Nicolas Cannasse há 19 anos atrás
pai
commit
e7889dcc32
4 ficheiros alterados com 29 adições e 27 exclusões
  1. 10 8
      genswf8.ml
  2. 16 16
      std/Date.hx
  3. 1 1
      std/Reflect.hx
  4. 2 2
      std/StringBuf.hx

+ 10 - 8
genswf8.ml

@@ -1034,21 +1034,21 @@ and gen_expr ctx retval e =
 		if not retval then write ctx APop;
 		if not retval then write ctx APop;
 	end else if retval then stack_error e.epos
 	end else if retval then stack_error e.epos
 
 
-let gen_class_static_field ctx c f =
+let gen_class_static_field ctx c flag f =
 	match f.cf_expr with
 	match f.cf_expr with
 	| None ->
 	| None ->
-		push ctx [VReg 0; VStr (f.cf_name,false); VNull];
+		push ctx [VReg 0; VStr (f.cf_name,flag); VNull];
 		setvar ctx VarObj
 		setvar ctx VarObj
 	| Some e ->
 	| Some e ->
 		let e = Transform.block_vars e in
 		let e = Transform.block_vars e in
 		match e.eexpr with
 		match e.eexpr with
 		| TFunction _ ->
 		| TFunction _ ->
-			push ctx [VReg 0; VStr (f.cf_name,false)];
+			push ctx [VReg 0; VStr (f.cf_name,flag)];
 			ctx.curmethod <- (f.cf_name,false);
 			ctx.curmethod <- (f.cf_name,false);
 			gen_expr ctx true e;
 			gen_expr ctx true e;
 			setvar ctx VarObj
 			setvar ctx VarObj
 		| _ ->
 		| _ ->
-			ctx.statics <- (c,false,f.cf_name,e) :: ctx.statics
+			ctx.statics <- (c,flag,f.cf_name,e) :: ctx.statics
 
 
 let gen_class_static_init ctx (c,flag,name,e) =
 let gen_class_static_init ctx (c,flag,name,e) =
 	ctx.curclass <- c;
 	ctx.curclass <- c;
@@ -1058,8 +1058,8 @@ let gen_class_static_init ctx (c,flag,name,e) =
 	gen_expr ctx true e;
 	gen_expr ctx true e;
 	setvar ctx VarObj
 	setvar ctx VarObj
 
 
-let gen_class_field ctx f =
-	push ctx [VReg 1; VStr (f.cf_name,false)];
+let gen_class_field ctx flag f =
+	push ctx [VReg 1; VStr (f.cf_name,flag)];
 	(match f.cf_expr with
 	(match f.cf_expr with
 	| None ->
 	| None ->
 		push ctx [VNull]
 		push ctx [VNull]
@@ -1231,8 +1231,10 @@ let gen_type_def ctx t =
 		write ctx APop;
 		write ctx APop;
 		push ctx [VReg 1; VStr ("__class__",false); VReg 0];
 		push ctx [VReg 1; VStr ("__class__",false); VReg 0];
 		setvar ctx VarObj;
 		setvar ctx VarObj;
-		List.iter (gen_class_static_field ctx c) c.cl_ordered_statics;
-		PMap.iter (fun _ f -> gen_class_field ctx f) c.cl_fields;
+		(* true if implements mt.Protect *)
+		let flag = is_protected ctx (TInst (c,[])) "" in
+		List.iter (gen_class_static_field ctx c flag) c.cl_ordered_statics;
+		PMap.iter (fun _ f -> gen_class_field ctx flag f) c.cl_fields;
 	| TEnumDecl e when e.e_extern ->
 	| TEnumDecl e when e.e_extern ->
 		()
 		()
 	| TEnumDecl e ->
 	| TEnumDecl e ->

+ 16 - 16
std/Date.hx

@@ -45,32 +45,32 @@ extern class Date
 		Returns the hours value of the date (0-23 range).
 		Returns the hours value of the date (0-23 range).
 	**/
 	**/
 	function getHours() : Int;
 	function getHours() : Int;
-	
+
 	/**
 	/**
 		Returns the minutes value of the date (0-59 range).
 		Returns the minutes value of the date (0-59 range).
-	**/	
+	**/
 	function getMinutes() : Int;
 	function getMinutes() : Int;
-	
+
 	/**
 	/**
 		Returns the seconds of the date (0-59 range).
 		Returns the seconds of the date (0-59 range).
-	**/	
+	**/
 	function getSeconds() : Int;
 	function getSeconds() : Int;
-	
+
 	/**
 	/**
 		Returns the full year of the date.
 		Returns the full year of the date.
-	**/	
+	**/
 	function getFullYear() : Int;
 	function getFullYear() : Int;
-	
+
 	/**
 	/**
 		Returns the month of the date (0-11 range).
 		Returns the month of the date (0-11 range).
-	**/	
+	**/
 	function getMonth() : Int;
 	function getMonth() : Int;
-	
+
 	/**
 	/**
 		Returns the day of the date (1-31 range).
 		Returns the day of the date (1-31 range).
-	**/	
+	**/
 	function getDate() : Int;
 	function getDate() : Int;
-	
+
 	/**
 	/**
 		Returns the week day of the date (0-6 range).
 		Returns the week day of the date (0-6 range).
 	**/
 	**/
@@ -111,7 +111,7 @@ extern class Date
 		};
 		};
 		Date.fromTime = function(t){
 		Date.fromTime = function(t){
 			var d : Date = __new__(Date);
 			var d : Date = __new__(Date);
-			d.setTime( t );
+			d["setTime"]( t );
 			return d;
 			return d;
 		};
 		};
 		Date.fromString = function(s : String) {
 		Date.fromString = function(s : String) {
@@ -119,10 +119,10 @@ extern class Date
 			case 8: // hh:mm:ss
 			case 8: // hh:mm:ss
 				var k = s.split(":");
 				var k = s.split(":");
 				var d : Date = __new__(Date);
 				var d : Date = __new__(Date);
-				d.setTime(0);
-				d.setUTCHours(k[0]);
-				d.setUTCMinutes(k[1]);
-				d.setUTCSeconds(k[2]);
+				d["setTime"](0);
+				d["setUTCHours"](k[0]);
+				d["setUTCMinutes"](k[1]);
+				d["setUTCSeconds"](k[2]);
 				return d;
 				return d;
 			case 10: // YYYY-MM-DD
 			case 10: // YYYY-MM-DD
 				var k = s.split("-");
 				var k = s.split("-");

+ 1 - 1
std/Reflect.hx

@@ -168,7 +168,7 @@ class Reflect {
 			var a : Array<String> = __keys__(o);
 			var a : Array<String> = __keys__(o);
 			var i = 0;
 			var i = 0;
 			while( i < a.length ) {
 			while( i < a.length ) {
-				if( !a.hasOwnProperty["call"](o,a[i]) )
+				if( !a["hasOwnProperty"]["call"](o,a[i]) )
 					a.splice(i,1);
 					a.splice(i,1);
 				else
 				else
 					++i;
 					++i;

+ 2 - 2
std/StringBuf.hx

@@ -78,7 +78,7 @@ class StringBuf {
 		#if neko
 		#if neko
 		__add_char(b,c);
 		__add_char(b,c);
 		#else flash
 		#else flash
-		b += untyped String.fromCharCode(c);
+		b += untyped String["fromCharCode"](c);
 		#else js
 		#else js
 		b += untyped String.fromCharCode(c);
 		b += untyped String.fromCharCode(c);
 		#else error
 		#else error
@@ -110,4 +110,4 @@ class StringBuf {
 	static var __string : Dynamic = neko.Lib.load("std","buffer_string",1);
 	static var __string : Dynamic = neko.Lib.load("std","buffer_string",1);
 #end
 #end
 
 
-}
+}