You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2013/11/15 15:56:19 UTC

[5/9] git commit: [flex-asjs] [refs/heads/develop] - Added type coercion example to project

Added type coercion example to project

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/98fda68c
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/98fda68c
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/98fda68c

Branch: refs/heads/develop
Commit: 98fda68c8887aa23d3c3c950595edad4a2111c9b
Parents: 7c857d7
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Fri Nov 15 11:33:44 2013 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Fri Nov 15 11:33:44 2013 +0100

----------------------------------------------------------------------
 examples/LanguageTests/src/LanguageTests.as | 30 ++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/98fda68c/examples/LanguageTests/src/LanguageTests.as
----------------------------------------------------------------------
diff --git a/examples/LanguageTests/src/LanguageTests.as b/examples/LanguageTests/src/LanguageTests.as
index 6e7e42f..e465f49 100644
--- a/examples/LanguageTests/src/LanguageTests.as
+++ b/examples/LanguageTests/src/LanguageTests.as
@@ -10,6 +10,7 @@ import interfaces.IB;
 import interfaces.IC;
 import interfaces.ID;
 import interfaces.IE;
+import interfaces.IF;
 
 public class LanguageTests extends Sprite implements IA, IE
 {
@@ -88,6 +89,35 @@ public class LanguageTests extends Sprite implements IA, IE
 		trace('this as interfaces.ID - [object ...]: ' + testObject.toString());
 		testObject = (this as IE) ? this as IE : 'null';
 		trace('this as interfaces.IE - [object ...]: ' + testObject.toString());
+		trace();
+		try {
+			testObject = Sprite(this);
+			trace('Sprite(this) - [object ...]: ' + testObject.toString());
+		} catch (e:Error) 
+		{
+			trace("This shouldn't show!");
+		}
+		try {
+			testObject = B(this);
+			trace("This shouldn't show!");
+		} catch (e:Error) 
+		{
+			trace('B(this) - exception expected: ' + e.message);
+		}
+		try {
+			testObject = interfaces.IC(b);
+			trace("This shouldn't show!");
+		} catch (e:Error) 
+		{
+			trace('IC(b) - exception expected: ' + e.message);
+		}
+		try {
+			testObject = interfaces.IF(b);
+			trace('IF(b) - [object ...]: ' + testObject.toString());
+		} catch (e:Error) 
+		{
+			trace("This shouldn't show!");
+		}
 	}
 }
 }
\ No newline at end of file