Browse Source

haxe.Public -> @:publicFields

Simon Krajewski 12 years ago
parent
commit
ca61a8de7f
5 changed files with 11 additions and 33 deletions
  1. 3 1
      ast.ml
  2. 0 29
      std/haxe/Public.hx
  3. 2 1
      std/haxe/unit/TestCase.hx
  4. 5 1
      tests/unit/Test.hx
  5. 1 1
      typeload.ml

+ 3 - 1
ast.ml

@@ -101,9 +101,10 @@ module Meta = struct
 		| Op
 		| Optional
 		| Overload
-		| Public
 		| PrivateAccess
 		| Protected
+		| Public
+		| PublicFields
 		| ReadOnly
 		| RealPath
 		| Remove
@@ -209,6 +210,7 @@ module Meta = struct
 		| Optional -> ":optional"
 		| Overload -> ":overload"
 		| Public -> ":public"
+		| PublicFields -> ":publicFields"
 		| PrivateAccess -> ":privateAccess"
 		| Protected -> ":protected"
 		| ReadOnly -> ":readOnly"

+ 0 - 29
std/haxe/Public.hx

@@ -1,29 +0,0 @@
-/*
- * Copyright (C)2005-2012 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package haxe;
-
-/**
-	When implementing this interface, all default fields access for the class and
-	subclasses becomes [public] instead of [private].
-**/
-interface Public {
-}

+ 2 - 1
std/haxe/unit/TestCase.hx

@@ -23,7 +23,8 @@ package haxe.unit;
 import haxe.PosInfos;
 
 @:keepSub
-class TestCase #if mt_build implements mt.Protect, #end implements haxe.Public  {
+@:publicFields
+class TestCase #if mt_build implements mt.Protect #end {
 	public var currentTest : TestStatus;
 
 	public function new( ) {

+ 5 - 1
tests/unit/Test.hx

@@ -1,7 +1,11 @@
 package unit;
 
 @:expose
-@:keepSub class Test #if swf_mark implements mt.Protect #end #if as3 implements haxe.Public #end {
+@:keepSub
+#if as3
+@:publicFields
+#end
+class Test #if swf_mark implements mt.Protect #end {
 
 	public function new() {
 	}

+ 1 - 1
typeload.ml

@@ -1111,7 +1111,7 @@ let init_class ctx c p context_init herits fields =
 	end else fields, herits in
 	if core_api && not ctx.com.display then delay ctx PForce (fun() -> init_core_api ctx c);
 	let rec extends_public c =
-		List.exists (fun (c,_) -> c.cl_path = (["haxe"],"Public") || extends_public c) c.cl_implements ||
+		Meta.has Meta.PublicFields c.cl_meta ||
 		match c.cl_super with
 		| None -> false
 		| Some (c,_) -> extends_public c