Pārlūkot izejas kodu

allow `extern abstract`

Simon Krajewski 9 gadi atpakaļ
vecāks
revīzija
b027f01cc9
3 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 1 0
      ast.ml
  2. 1 1
      parser.ml
  3. 2 0
      typeload.ml

+ 1 - 0
ast.ml

@@ -416,6 +416,7 @@ type abstract_flag =
 	| AFromType of complex_type
 	| AToType of complex_type
 	| AIsType of complex_type
+	| AExtern
 
 type enum_constructor = {
 	ec_name : string;

+ 1 - 1
parser.ml

@@ -623,7 +623,7 @@ and parse_type_decl s =
 				d_data = t;
 			}, punion p1 p2)
 		| [< '(Kwd Abstract,p1); name = type_name; tl = parse_constraint_params; st = parse_abstract_subtype; sl = plist parse_abstract_relations; '(BrOpen,_); fl, p2 = parse_class_fields false p1 >] ->
-			let flags = List.map (fun (_,c) -> match c with EPrivate -> APrivAbstract | EExtern -> error (Custom "extern abstract not allowed") p1) c in
+			let flags = List.map (fun (_,c) -> match c with EPrivate -> APrivAbstract | EExtern -> AExtern) c in
 			let flags = (match st with None -> flags | Some t -> AIsType t :: flags) in
 			(EAbstract {
 				d_name = name;

+ 2 - 0
typeload.ml

@@ -3187,6 +3187,8 @@ let init_module_type ctx context_init do_init (decl,p) =
 				);
 				a.a_this <- at;
 				is_type := true;
+			| AExtern ->
+				(match a.a_impl with Some c -> c.cl_extern <- true | None -> (* Hmmmm.... *) ())
 			| APrivAbstract -> ()
 		) d.d_flags;
 		if not !is_type then begin