Explorar o código

[display] use tclass in SKField

Simon Krajewski %!s(int64=2) %!d(string=hai) anos
pai
achega
b5dc16fe24

+ 1 - 1
src/context/display/displayEmitter.ml

@@ -109,7 +109,7 @@ let display_field ctx origin scope cf p = match ctx.com.display.dms_kind with
 				(* For constructors, we care about the class name so we don't end up looking for "new". *)
 				snd c.cl_path,SKConstructor cf
 			| _,(Self (TClassDecl c) | Parent(TClassDecl c)) ->
-				cf.cf_name,SKField (cf,Some c.cl_path)
+				cf.cf_name,SKField (cf,Some c)
 			| _ ->
 				cf.cf_name,SKField (cf,None)
 		in

+ 4 - 4
src/context/display/findReferences.ml

@@ -32,12 +32,12 @@ let find_references tctx com with_definition pos_filters =
 let collect_reference_positions com =
 	let name,pos,kind = Display.ReferencePosition.get () in
 	match kind, com.display.dms_kind with
-	| SKField (cf,Some cl_path), DMUsage (_,find_descendants,find_base) when (find_descendants || find_base) && not (has_class_field_flag cf CfStatic) ->
+	| SKField (cf,Some c), DMUsage (_,find_descendants,find_base) when (find_descendants || find_base) && not (has_class_field_flag cf CfStatic) ->
 		let collect() =
 			let c =
 				let rec loop = function
 					| [] -> raise Exit
-					| TClassDecl c :: _ when c.cl_path = cl_path -> c
+					| TClassDecl c' :: _ when c.cl_path = c'.cl_path -> c'
 					| _ :: types -> loop types
 				in
 				loop com.types
@@ -79,14 +79,14 @@ let collect_reference_positions com =
 					| TClassDecl child_cls when List.exists (extends child_cls) field_class_pairs ->
 						(try
 							let cf = PMap.find cf.cf_name child_cls.cl_fields in
-							(name,full_pos cf.cf_name_pos,SKField (cf,Some child_cls.cl_path)) :: acc
+							(name,full_pos cf.cf_name_pos,SKField (cf,Some child_cls)) :: acc
 						with Not_found -> acc
 						)
 					| _ ->
 						acc
 				) [] com.types
 			else
-				List.map (fun (cf,c) -> name,full_pos cf.cf_name_pos,SKField (cf,Some c.cl_path)) field_class_pairs;
+				List.map (fun (cf,c) -> name,full_pos cf.cf_name_pos,SKField (cf,Some c)) field_class_pairs;
 		in
 		(try collect()
 		with Exit -> [name,pos,kind])

+ 1 - 1
src/context/display/statistics.ml

@@ -234,7 +234,7 @@ let collect_statistics ctx pos_filters with_expressions =
 			if (has_class_flag c CInterface) then
 				collect_implementations c;
 			let field cf =
-				if cf.cf_pos.pmin > c.cl_name_pos.pmin then declare (SKField (cf,Some c.cl_path)) cf.cf_name_pos;
+				if cf.cf_pos.pmin > c.cl_name_pos.pmin then declare (SKField (cf,Some c)) cf.cf_name_pos;
 				if with_expressions then begin
 					let _ = follow cf.cf_type in
 					match cf.cf_expr with None -> () | Some e -> collect_references c e

+ 1 - 1
src/core/displayTypes.ml

@@ -264,7 +264,7 @@ type symbol =
 	| SKEnum of tenum
 	| SKTypedef of tdef
 	| SKAbstract of tabstract
-	| SKField of tclass_field * path option (* path - class path *)
+	| SKField of tclass_field * tclass option
 	| SKConstructor of tclass_field
 	| SKEnumField of tenum_field
 	| SKVariable of tvar

+ 2 - 2
src/typing/typerDisplay.ml

@@ -377,7 +377,7 @@ and display_expr ctx e_ast e dk mode with_type p =
 		| TField(_,(FAnon cf | FClosure (None,cf))) ->
 			Display.ReferencePosition.set (cf.cf_name,cf.cf_name_pos,SKField (cf,None));
 		| TField(_,(FInstance (c,_,cf) | FStatic (c,cf) | FClosure (Some (c,_),cf))) ->
-			Display.ReferencePosition.set (cf.cf_name,cf.cf_name_pos,SKField (cf,Some c.cl_path));
+			Display.ReferencePosition.set (cf.cf_name,cf.cf_name_pos,SKField (cf,Some c));
 		| TLocal v | TVar(v,_) ->
 			Display.ReferencePosition.set (v.v_name,v.v_pos,SKVariable v);
 		| TTypeExpr mt ->
@@ -394,7 +394,7 @@ and display_expr ctx e_ast e dk mode with_type p =
 		| TCall({eexpr = TConst TSuper},_) ->
 			begin try
 				let cf,c = get_super_constructor() in
-				Display.ReferencePosition.set (cf.cf_name,cf.cf_name_pos,SKField (cf,Some c.cl_path));
+				Display.ReferencePosition.set (cf.cf_name,cf.cf_name_pos,SKField (cf,Some c));
 			with Not_found ->
 				()
 			end

+ 2 - 1
tests/server/.vscode/settings.json

@@ -8,5 +8,6 @@
 		"test-adapter",
 		"-cmd",
 		"node test.js"
-	]
+	],
+	"haxe.enableCompilationServer": false
 }