소스 검색

[display] respect @:noCompletion on types

Jens Fischer 7 년 전
부모
커밋
ddbbec2cab
2개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 6 6
      src/context/display/displayToplevel.ml
  2. 1 1
      src/core/meta.ml

+ 6 - 6
src/context/display/displayToplevel.ml

@@ -160,15 +160,15 @@ let collect ctx tk with_type =
 	let process_decls pack name decls =
 		let run () = List.iter (fun (d,p) ->
 			begin try
-				let tname,is_private = match d with
-					| EClass d -> fst d.d_name,List.mem HPrivate d.d_flags
-					| EEnum d -> fst d.d_name,List.mem EPrivate d.d_flags
-					| ETypedef d -> fst d.d_name,List.mem EPrivate d.d_flags
-					| EAbstract d -> fst d.d_name,List.mem AbPrivate d.d_flags
+				let tname,is_private,meta = match d with
+					| EClass d -> fst d.d_name,List.mem HPrivate d.d_flags,d.d_meta
+					| EEnum d -> fst d.d_name,List.mem EPrivate d.d_flags,d.d_meta
+					| ETypedef d -> fst d.d_name,List.mem EPrivate d.d_flags,d.d_meta
+					| EAbstract d -> fst d.d_name,List.mem AbPrivate d.d_flags,d.d_meta
 					| _ -> raise Exit
 				in
 				let path = Path.full_dot_path pack name tname in
-				if not (path_exists cctx path) && not is_private then begin
+				if not (path_exists cctx path) && not is_private && not (Meta.has Meta.NoCompletion meta) then begin
 					add_path cctx path;
 					(* If we share a package, the module's main type shadows everything with the same name. *)
 					let shadowing_name = if pack_similarity curpack pack > 0 && tname = name then (Some name) else None in

+ 1 - 1
src/core/meta.ml

@@ -301,7 +301,7 @@ let get_info = function
 	| NativeGeneric -> ":nativeGeneric",("Used internally to annotate native generic classes",[Platform Cs; UsedOnEither[TClass;TEnum]; UsedInternally])
 	| NativeProperty -> ":nativeProperty",("Use native properties which will execute even with dynamic usage",[Platform Cpp])
 	| NativeStaticExtension -> ":nativeStaticExtension",("Converts static function syntax into member call",[Platform Cpp])
-	| NoCompletion -> ":noCompletion",("Prevents the compiler from suggesting completion on this field",[UsedOn TClassField])
+	| NoCompletion -> ":noCompletion",("Prevents the compiler from suggesting completion on this field or type",[UsedOn TClassField])
 	| NoDebug -> ":noDebug",("Does not generate debug information into the Swf even if -debug is set",[UsedOnEither [TClass;TClassField];Platform Flash])
 	| NoDoc -> ":noDoc",("Prevents a type from being included in documentation generation",[])
 	| NoExpr -> ":noExpr",("Internally used to mark abstract fields which have no expression by design",[UsedInternally])