Browse Source

field lookup gives priority to superclass over interfaces

Nicolas Cannasse 18 years ago
parent
commit
7ea6687ce0
2 changed files with 8 additions and 7 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 7 7
      type.ml

+ 1 - 0
doc/CHANGES.txt

@@ -16,6 +16,7 @@
 	allow leading comma in anonymous types
 	allow leading comma in anonymous types
 	added haxe.Public interface
 	added haxe.Public interface
 	added AS3 code generator
 	added AS3 code generator
+	field lookup gives priority to superclass over interfaces
 
 
 2007-01-28: 1.11
 2007-01-28: 1.11
 	changed StringBuf.add implementation
 	changed StringBuf.add implementation

+ 7 - 7
type.ml

@@ -568,6 +568,13 @@ let rec class_field c i =
 		let f = PMap.find i c.cl_fields in
 		let f = PMap.find i c.cl_fields in
 		field_type f , f
 		field_type f , f
 	with Not_found -> try
 	with Not_found -> try
+		match c.cl_super with
+		| None ->
+			raise Not_found
+		| Some (c,tl) ->
+			let t , f = class_field c i in
+			apply_params c.cl_types tl t , f
+	with Not_found ->
 		let rec loop = function
 		let rec loop = function
 			| [] ->
 			| [] ->
 				raise Not_found
 				raise Not_found
@@ -579,13 +586,6 @@ let rec class_field c i =
 					Not_found -> loop l
 					Not_found -> loop l
 		in
 		in
 		loop c.cl_implements
 		loop c.cl_implements
-	with Not_found ->
-		match c.cl_super with
-		| None ->
-			raise Not_found
-		| Some (c,tl) ->
-			let t , f = class_field c i in
-			apply_params c.cl_types tl t , f
 
 
 let rec unify a b =
 let rec unify a b =
 	if a == b then
 	if a == b then