Skip to content

Commit

Permalink
applied interface syntax changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Feb 4, 2013
1 parent fdc4892 commit 5ed2240
Show file tree
Hide file tree
Showing 56 changed files with 207 additions and 150 deletions.
6 changes: 3 additions & 3 deletions genxml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ let gen_type_decl com pos t =
) in
let fields = List.map (fun (f,att) -> gen_field att f) fields in
let constr = (match c.cl_constructor with None -> [] | Some f -> [gen_field [] f]) in
let impl = List.map (gen_class_path "implements") c.cl_implements in
let impl = List.map (gen_class_path (if c.cl_interface then "extends" else "implements")) c.cl_implements in
let tree = (match c.cl_super with
| None -> impl
| Some x -> gen_class_path "extends" x :: impl
Expand Down Expand Up @@ -394,7 +394,7 @@ let generate_type com t =
| None -> []
| Some (c,pl) -> [" extends " ^ stype (TInst (c,pl))]
) in
let ext = List.fold_left (fun acc (i,pl) -> (" implements " ^ stype (TInst (i,pl))) :: acc) ext c.cl_implements in
let ext = List.fold_left (fun acc (i,pl) -> ((if c.cl_interface then " extends " else " implements ") ^ stype (TInst (i,pl))) :: acc) ext c.cl_implements in
let ext = (match c.cl_dynamic with
| None -> ext
| Some t ->
Expand All @@ -412,7 +412,7 @@ let generate_type com t =
| ["flash";"errors"], "Error" -> [" #if !flash_strict implements Dynamic #end"]
| _ -> ext
) in
p "%s" (String.concat "," (List.rev ext));
p "%s" (String.concat " " (List.rev ext));
p " {\n";
let sort l =
let a = Array.of_list (List.filter (fun f -> f.cf_public && not (List.mem f.cf_name c.cl_overrides)) l) in
Expand Down
11 changes: 9 additions & 2 deletions parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,15 @@ and parse_type_decl s =
d_flags = List.map snd c @ n;
d_data = l
}, punion p1 p2)
| [< d = parse_class meta c true >] ->
d
| [< n , p1 = parse_class_flags; doc = get_doc; name = type_name; tl = parse_constraint_params; hl = plist parse_class_herit; '(BrOpen,_); fl, p2 = parse_class_fields false p1 >] ->
(EClass {
d_name = name;
d_doc = doc;
d_meta = meta;
d_params = tl;
d_flags = List.map fst c @ n @ hl;
d_data = fl;
}, punion p1 p2)
| [< '(Kwd Typedef,p1); doc = get_doc; name = type_name; tl = parse_constraint_params; '(Binop OpAssign,p2); t = parse_complex_type; s >] ->
(match s with parser
| [< '(Semicolon,_) >] -> ()
Expand Down
2 changes: 1 addition & 1 deletion std/cs/NativeArray.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package cs;

extern class NativeArray<T> extends cs.system.Array, implements ArrayAccess<T>
extern class NativeArray<T> extends cs.system.Array implements ArrayAccess<T>
{
public var Length(default, null):Int;

Expand Down
42 changes: 1 addition & 41 deletions std/cs/internal/HxObject.hx
Original file line number Diff line number Diff line change
@@ -1,41 +1 @@
/*
* 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 cs.internal;import cs.system.Type;private typedef StdType = std.Type;@:keep @:native('haxe.lang.HxObject')private class HxObject implements IHxObject{
}@:keep @:native('haxe.lang.IHxObject')private interface IHxObject{
}@:keep @:native('haxe.lang.DynamicObject')private class DynamicObject extends HxObject, implements Dynamic{ @:skipReflection public function toString():String { var ts = Reflect.field(this, "toString"); if (ts != null) return ts();
var ret = new StringBuf(); ret.add("{"); var first = true; for (f in Reflect.fields(this)) { if( first ) first = false; else ret.add(","); ret.add(" "); ret.add(f); ret.add(" : "); ret.add(Reflect.field(this, f)); } if (!first) ret.add(" "); ret.add("}");
return ret.toString(); }}@:keep @:native('haxe.lang.IGenericObject') interface IGenericObject{
}@:native('haxe.lang.Enum')@:keep @:skipCtor
private class Enum{ @:readOnly private var index:Int;
@:readOnly private var params:Array<{}>;

public function new(index:Int, params:Array<{}>) { this.index = index; this.params = params; }
@:final public function getTag():String { var cl:Dynamic = StdType.getClass(this); return cl.constructs[index]; }
public function toString():String { if (params == null) return getTag(); var ret = new StringBuf(); ret.add(getTag()); ret.add("(");
var first = true;
for (p in params) { if (first) first = false; else ret.add(","); ret.add(p); }
ret.add(")"); return ret.toString(); }
public function Equals(obj:Dynamic) { if (obj == this) //we cannot use == as .Equals ! return true;
var obj:Enum = cast obj; var ret = obj != null && Std.is(obj, StdType.getClass(this)) && obj.index == this.index; if (!ret) return false; if (obj.params == this.params) return true; var len = 0; if (obj.params == null || this.params == null || (len = this.params.length) != obj.params.length) return false;
for (i in 0...len) { if (!StdType.enumEq(obj.params[i], this.params[i])) return false; } return true; }

}
/* * 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 cs.internal;import cs.system.Type;private typedef StdType = std.Type;@:keep @:native('haxe.lang.HxObject')private class HxObject implements IHxObject{}@:keep @:native('haxe.lang.IHxObject')private interface IHxObject{}@:keep @:native('haxe.lang.DynamicObject')private class DynamicObject extends HxObject implements Dynamic{ @:skipReflection public function toString():String { var ts = Reflect.field(this, "toString"); if (ts != null) return ts(); var ret = new StringBuf(); ret.add("{"); var first = true; for (f in Reflect.fields(this)) { if( first ) first = false; else ret.add(","); ret.add(" "); ret.add(f); ret.add(" : "); ret.add(Reflect.field(this, f)); } if (!first) ret.add(" "); ret.add("}"); return ret.toString(); }}@:keep @:native('haxe.lang.IGenericObject') interface IGenericObject{}@:native('haxe.lang.Enum')@:keep @:skipCtorprivate class Enum{ @:readOnly private var index:Int; @:readOnly private var params:Array<{}>; public function new(index:Int, params:Array<{}>) { this.index = index; this.params = params; } @:final public function getTag():String { var cl:Dynamic = StdType.getClass(this); return cl.constructs[index]; } public function toString():String { if (params == null) return getTag(); var ret = new StringBuf(); ret.add(getTag()); ret.add("("); var first = true; for (p in params) { if (first) first = false; else ret.add(","); ret.add(p); } ret.add(")"); return ret.toString(); } public function Equals(obj:Dynamic) { if (obj == this) //we cannot use == as .Equals ! return true; var obj:Enum = cast obj; var ret = obj != null && Std.is(obj, StdType.getClass(this)) && obj.index == this.index; if (!ret) return false; if (obj.params == this.params) return true; var len = 0; if (obj.params == null || this.params == null || (len = this.params.length) != obj.params.length) return false; for (i in 0...len) { if (!StdType.enumEq(obj.params[i], this.params[i])) return false; } return true; }}
Expand Down
2 changes: 1 addition & 1 deletion std/cs/system/collections/ICollection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package cs.system.collections;

@:native('System.Collections.ICollection') extern interface ICollection implements IEnumerable
@:native('System.Collections.ICollection') extern interface ICollection extends IEnumerable
{
var Count(default, null):Int;
var IsSynchronized(default, null):Bool;
Expand Down
2 changes: 1 addition & 1 deletion std/cs/system/collections/IDictionary.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package cs.system.collections;

@:native('System.Collections.IDictionary') extern interface IDictionary implements ICollection, implements ArrayAccess<Dynamic>
@:native('System.Collections.IDictionary') extern interface IDictionary extends ICollection extends ArrayAccess<Dynamic>
{
var IsFixedSize(default, null):Bool;
var IsReadOnly(default, null):Bool;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/Boot.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package flash;

#if !as3
@:keep private class RealBoot extends Boot, implements Dynamic {
@:keep private class RealBoot extends Boot implements Dynamic {
#if swc
public function new() {
super();
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/DisplayObject.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

extern class DisplayObject extends flash.events.EventDispatcher, implements IBitmapDrawable {
extern class DisplayObject extends flash.events.EventDispatcher implements IBitmapDrawable {
var accessibilityProperties : flash.accessibility.AccessibilityProperties;
var alpha : Float;
var blendMode : BlendMode;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/GraphicsBitmapFill.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

@:final extern class GraphicsBitmapFill implements IGraphicsData, implements IGraphicsFill {
@:final extern class GraphicsBitmapFill implements IGraphicsData implements IGraphicsFill {
var bitmapData : BitmapData;
var matrix : flash.geom.Matrix;
var repeat : Bool;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/GraphicsEndFill.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package flash.display;

extern class GraphicsEndFill implements IGraphicsData, implements IGraphicsFill {
extern class GraphicsEndFill implements IGraphicsData implements IGraphicsFill {
function new() : Void;
}
2 changes: 1 addition & 1 deletion std/flash/display/GraphicsGradientFill.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

@:final extern class GraphicsGradientFill implements IGraphicsData, implements IGraphicsFill {
@:final extern class GraphicsGradientFill implements IGraphicsData implements IGraphicsFill {
var alphas : Array<Float>;
var colors : Array<UInt>;
var focalPointRatio : Float;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/GraphicsPath.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

@:final extern class GraphicsPath implements IGraphicsData, implements IGraphicsPath {
@:final extern class GraphicsPath implements IGraphicsData implements IGraphicsPath {
var commands : flash.Vector<Int>;
var data : flash.Vector<Float>;
var winding : GraphicsPathWinding;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/GraphicsShaderFill.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

@:final extern class GraphicsShaderFill implements IGraphicsData, implements IGraphicsFill {
@:final extern class GraphicsShaderFill implements IGraphicsData implements IGraphicsFill {
var matrix : flash.geom.Matrix;
var shader : Shader;
function new(?shader : Shader, ?matrix : flash.geom.Matrix) : Void;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/GraphicsSolidFill.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

@:final extern class GraphicsSolidFill implements IGraphicsData, implements IGraphicsFill {
@:final extern class GraphicsSolidFill implements IGraphicsData implements IGraphicsFill {
var alpha : Float;
var color : UInt;
function new(color : UInt = 0, alpha : Float = 1) : Void;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/GraphicsStroke.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

@:final extern class GraphicsStroke implements IGraphicsData, implements IGraphicsStroke {
@:final extern class GraphicsStroke implements IGraphicsData implements IGraphicsStroke {
var caps : CapsStyle;
var fill : IGraphicsFill;
var joints : JointStyle;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/GraphicsTrianglePath.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

@:final extern class GraphicsTrianglePath implements IGraphicsData, implements IGraphicsPath {
@:final extern class GraphicsTrianglePath implements IGraphicsData implements IGraphicsPath {
var culling : TriangleCulling;
var indices : flash.Vector<Int>;
var uvtData : flash.Vector<Float>;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/display/MovieClip.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.display;

extern class MovieClip extends Sprite #if !flash_strict, implements Dynamic #end {
extern class MovieClip extends Sprite #if !flash_strict implements Dynamic #end {
var currentFrame(default,null) : Int;
@:require(flash10) var currentFrameLabel(default,null) : String;
var currentLabel(default,null) : String;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/net/NetStreamPlayOptions.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.net;

extern class NetStreamPlayOptions extends flash.events.EventDispatcher, implements Dynamic {
extern class NetStreamPlayOptions extends flash.events.EventDispatcher implements Dynamic {
var len : Float;
@:require(flash10_1) var offset : Float;
var oldStreamName : String;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/net/Socket.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.net;

extern class Socket extends flash.events.EventDispatcher, implements flash.utils.IDataOutput, implements flash.utils.IDataInput {
extern class Socket extends flash.events.EventDispatcher implements flash.utils.IDataOutput implements flash.utils.IDataInput {
var bytesAvailable(default,null) : UInt;
@:require(flash11) var bytesPending(default,null) : UInt;
var connected(default,null) : Bool;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/net/URLStream.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.net;

extern class URLStream extends flash.events.EventDispatcher, implements flash.utils.IDataInput {
extern class URLStream extends flash.events.EventDispatcher implements flash.utils.IDataInput {
var bytesAvailable(default,null) : UInt;
var connected(default,null) : Bool;
@:require(flash11_4) var diskCacheEnabled(default,null) : Bool;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/text/StyleSheet.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.text;

extern class StyleSheet extends flash.events.EventDispatcher, implements Dynamic {
extern class StyleSheet extends flash.events.EventDispatcher implements Dynamic {
var styleNames(default,null) : Array<Dynamic>;
function new() : Void;
function clear() : Void;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/utils/ByteArray.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.utils;

extern class ByteArray implements IDataOutput2, implements IDataInput2, implements ArrayAccess<Int> {
extern class ByteArray implements IDataOutput2 implements IDataInput2 implements ArrayAccess<Int> {
var bytesAvailable(default,null) : UInt;
var endian : Endian;
var length : UInt;
Expand Down
2 changes: 1 addition & 1 deletion std/flash/utils/IDataInput2.hx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package flash.utils;

extern interface IDataInput2 implements IDataInput {
extern interface IDataInput2 extends IDataInput {
}
2 changes: 1 addition & 1 deletion std/flash/utils/IDataOutput2.hx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package flash.utils;

extern interface IDataOutput2 implements IDataOutput {
extern interface IDataOutput2 extends IDataOutput {
}
2 changes: 1 addition & 1 deletion std/haxe/remoting/AMFConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package haxe.remoting;

class AMFConnection implements AsyncConnection, implements Dynamic<AsyncConnection> {
class AMFConnection implements AsyncConnection implements Dynamic<AsyncConnection> {

var __data : {
error : Dynamic -> Void,
Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/AsyncDebugConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package haxe.remoting;

class AsyncDebugConnection implements AsyncConnection, implements Dynamic<AsyncDebugConnection> {
class AsyncDebugConnection implements AsyncConnection implements Dynamic<AsyncDebugConnection> {

var __path : Array<String>;
var __cnx : AsyncConnection;
Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/DelayedConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package haxe.remoting;

class DelayedConnection implements AsyncConnection, implements Dynamic<AsyncConnection> {
class DelayedConnection implements AsyncConnection implements Dynamic<AsyncConnection> {

public var connection(get,set) : AsyncConnection;

Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/ExternalConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package haxe.remoting;
Synchronous communications between Flash and Javascript.
**/
@:expose
class ExternalConnection implements Connection, implements Dynamic<Connection> {
class ExternalConnection implements Connection implements Dynamic<Connection> {

var __data : { name : String, ctx : Context, #if js flash : String #end };
var __path : Array<String>;
Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/FlashJsConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package haxe.remoting;

class FlashJsConnection #if flash implements AsyncConnection, implements Dynamic<AsyncConnection> #end {
class FlashJsConnection #if flash implements AsyncConnection implements Dynamic<AsyncConnection> #end {

#if flash

Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/HttpAsyncConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package haxe.remoting;

class HttpAsyncConnection implements AsyncConnection, implements Dynamic<AsyncConnection> {
class HttpAsyncConnection implements AsyncConnection implements Dynamic<AsyncConnection> {

var __data : { url : String, error : Dynamic -> Void };
var __path : Array<String>;
Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/HttpConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package haxe.remoting;

class HttpConnection implements Connection, implements Dynamic<Connection> {
class HttpConnection implements Connection implements Dynamic<Connection> {

public static var TIMEOUT = 10;

Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/LocalConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
package haxe.remoting;

class LocalConnection implements AsyncConnection, implements Dynamic<AsyncConnection> {
class LocalConnection implements AsyncConnection implements Dynamic<AsyncConnection> {

static var ID = 0;

Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/SocketConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package haxe.remoting;
import haxe.remoting.SocketProtocol.Socket;

class SocketConnection implements AsyncConnection, implements Dynamic<AsyncConnection> {
class SocketConnection implements AsyncConnection implements Dynamic<AsyncConnection> {

var __path : Array<String>;
var __data : {
Expand Down
2 changes: 1 addition & 1 deletion std/haxe/remoting/SyncSocketConnection.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package haxe.remoting;
import haxe.remoting.SocketProtocol.Socket;

class SyncSocketConnection implements Connection, implements Dynamic<Connection> {
class SyncSocketConnection implements Connection implements Dynamic<Connection> {

var __path : Array<String>;
var __proto : SocketProtocol;
Expand Down
Loading

0 comments on commit 5ed2240

Please sign in to comment.