瀏覽代碼

Use Meta.Pos instead of Meta.Custom ":pos" (#6419)

That way, it shows up in --help-metas.
Jens Fischer 8 年之前
父節點
當前提交
30b0681708
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 2 0
      src/context/meta.ml
  2. 1 1
      src/syntax/parser.mly

+ 2 - 0
src/context/meta.ml

@@ -123,6 +123,7 @@ type strict_meta =
 	| PhpClassConst
 	| PhpMagic
 	| PhpNoConstructor
+	| Pos
 	| PrivateAccess
 	| Property
 	| Protected
@@ -320,6 +321,7 @@ let get_info = function
 	| PhpClassConst -> ":phpClassConst",("(php7)  Generate static var of an extern class as a PHP class constant",[Platform Php;UsedOn TClass])
 	| PhpMagic -> ":phpMagic",("(php7) Treat annotated field as special PHP magic field",[Platform Php;UsedOn TClassField])
 	| PhpNoConstructor -> ":phpNoConstructor",("(php7) Special meta for extern classes which does not have native constructor in PHP, but need a constructor in Haxe extern",[Platform Php;UsedOn TClass])
+	| Pos -> ":pos",("Sets the position of a reified expression",[HasParam "Position";UsedOn TExpr])
 	| Public -> ":public",("Marks a class field as being public",[UsedOn TClassField;UsedInternally])
 	| PublicFields -> ":publicFields",("Forces all class fields of inheriting classes to be public",[UsedOn TClass])
 	| QuotedField -> ":quotedField",("Used internally to mark structure fields which are quoted in syntax",[UsedInternally])

+ 1 - 1
src/syntax/parser.mly

@@ -487,7 +487,7 @@ let reify in_macro =
 				expr "EConst" [mk_enum "Constant" "CIdent" [e1] (pos e1)]
 			| Meta.Dollar "p", _ ->
 				(ECall ((EField ((EField ((EField ((EConst (Ident "haxe"),p),"macro"),p),"MacroStringTools"),p),"toFieldExpr"),p),[e]),p)
-			| Meta.Custom ":pos", [pexpr] ->
+			| Meta.Pos, [pexpr] ->
 				let old = !cur_pos in
 				cur_pos := Some pexpr;
 				let e = loop e1 in