avm2: Implement error types for avm2

This commit is contained in:
golfinq 2022-09-23 17:34:57 -04:00 committed by relrelb
parent 192215634d
commit ceb877c55f
17 changed files with 433 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/DefinitionError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package
{
public dynamic class DefinitionError extends Error
{
prototype.name = "DefinitionError";
public function DefinitionError(message:String = "", id:int = 0)
{
super(message, id);
this.name = prototype.name;
}
}
}

View File

@ -0,0 +1,20 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/EvalError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package
{
public dynamic class EvalError extends Error
{
prototype.name = "EvalError";
public function EvalError(message:String = "", id:int = 0)
{
super(message, id);
this.name = prototype.name;
}
}
}

View File

@ -0,0 +1,21 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/SecurityError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package
{
public dynamic class SecurityError extends Error
{
prototype.name = "SecurityError";
public function SecurityError(message:String = "", id:int = 0)
{
super(message, id);
this.name = prototype.name;
}
}
}

View File

@ -0,0 +1,21 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/SyntaxError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package
{
public dynamic class SyntaxError extends Error
{
prototype.name = "SyntaxError";
public function SyntaxError(message:String = "", id:int = 0)
{
super(message, id);
this.name = prototype.name;
}
}
}

View File

@ -0,0 +1,21 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/URIError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package
{
public dynamic class URIError extends Error
{
prototype.name = "URIError";
public function URIError(message:String = "", id:int = 0)
{
super(message, id);
this.name = prototype.name;
}
}
}

View File

@ -0,0 +1,18 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/VerifyError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package
{
public dynamic class VerifyError extends Error
{
prototype.name = "VerifyError";
public function VerifyError(message:String = "", id:int = 0)
{
super(message, id);
this.name = prototype.name;
}
}
}

View File

@ -0,0 +1,20 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/errors/EOFError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package flash.errors
{
public dynamic class EOFError extends IOError
{
prototype.name = "EOFError";
public function EOFError(message:String = "", id:int = 0)
{
super(message, id);
}
}
}

View File

@ -0,0 +1,20 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/errors/IOError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package flash.errors
{
public dynamic class IOError extends Error
{
prototype.name = "IOError";
public function IOError(message:String = "", id:int = 0)
{
super(message, id);
}
}
}

View File

@ -0,0 +1,20 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/errors/InvalidSWFError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package flash.errors
{
public dynamic class InvalidSWFError extends Error
{
prototype.name = "InvalidSWFError";
public function InvalidSWFError(message:String = "", id:int = 0)
{
super(message, id);
}
}
}

View File

@ -0,0 +1,20 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/errors/MemoryError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package flash.errors
{
public dynamic class MemoryError extends Error
{
prototype.name = "MemoryError";
public function MemoryError(message:String = "", id:int = 0)
{
super(message, id);
}
}
}

View File

@ -0,0 +1,20 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/errors/ScriptTimeoutError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package flash.errors
{
public dynamic class ScriptTimeoutError extends Error
{
prototype.name = "ScriptTimeoutError";
public function ScriptTimeoutError(message:String = "", id:int = 0)
{
super(message, id);
}
}
}

View File

@ -0,0 +1,20 @@
// The initial version of this file was autogenerated from the official AS3 reference at
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/errors/StackOverflowError.html
// by https://github.com/golfinq/ActionScript_Event_Builder
// It won't be regenerated in the future, so feel free to edit and/or fix
package flash.errors
{
public dynamic class StackOverflowError extends Error
{
prototype.name = "StackOverflowError";
public function StackOverflowError(message:String = "", id:int = 0)
{
super(message, id);
}
}
}

View File

@ -4,10 +4,16 @@
include "Error.as" include "Error.as"
include "ArgumentError.as" include "ArgumentError.as"
include "DefinitionError.as"
include "EvalError.as"
include "TypeError.as" include "TypeError.as"
include "Math.as" include "Math.as"
include "RangeError.as" include "RangeError.as"
include "ReferenceError.as" include "ReferenceError.as"
include "SecurityError.as"
include "SyntaxError.as"
include "URIError.as"
include "VerifyError.as"
include "flash/accessibility/AccessibilityProperties.as" include "flash/accessibility/AccessibilityProperties.as"
include "flash/crypto.as" include "flash/crypto.as"
@ -107,7 +113,13 @@ include "flash/events/TimerEvent.as"
include "flash/events/UncaughtErrorEvent.as" include "flash/events/UncaughtErrorEvent.as"
include "flash/events/VideoEvent.as" include "flash/events/VideoEvent.as"
include "flash/events/VideoTextureEvent.as" include "flash/events/VideoTextureEvent.as"
include "flash/errors/IOError.as"
include "flash/errors/EOFError.as"
include "flash/errors/IllegalOperationError.as" include "flash/errors/IllegalOperationError.as"
include "flash/errors/InvalidSWFError.as"
include "flash/errors/MemoryError.as"
include "flash/errors/ScriptTimeoutError.as"
include "flash/errors/StackOverflowError.as"
include "flash/filters/BitmapFilter.as" include "flash/filters/BitmapFilter.as"
include "flash/filters/BitmapFilterQuality.as" include "flash/filters/BitmapFilterQuality.as"

View File

@ -291,6 +291,7 @@ swf_tests! {
(as3_equals, "avm2/equals", 1), (as3_equals, "avm2/equals", 1),
(as3_error_stack_trace, "avm2/error_stack_trace", 1), (as3_error_stack_trace, "avm2/error_stack_trace", 1),
(as3_error_tostring, "avm2/error_tostring", 1), (as3_error_tostring, "avm2/error_tostring", 1),
(as3_error_tostring_more, "avm2/error_tostring_more", 1),
(as3_es3_inheritance, "avm2/es3_inheritance", 1), (as3_es3_inheritance, "avm2/es3_inheritance", 1),
(as3_es4_inheritance, "avm2/es4_inheritance", 1), (as3_es4_inheritance, "avm2/es4_inheritance", 1),
(as3_es4_interfaces, "avm2/es4_interfaces", 1), (as3_es4_interfaces, "avm2/es4_interfaces", 1),

View File

@ -0,0 +1,102 @@
package {
import flash.display.Sprite;
public class Test extends Sprite {}
}
import flash.errors.IOError;
import flash.errors.EOFError;
import flash.errors.InvalidSWFError;
import flash.errors.MemoryError;
import flash.errors.ScriptTimeoutError;
import flash.errors.StackOverflowError;
trace("Class: " + DefinitionError);
trace("cls.prototype.name = " + DefinitionError.prototype.name);
var newErrorDefinitionError: DefinitionError = new DefinitionError("My Error", 42);
trace(newErrorDefinitionError.toString());
trace(newErrorDefinitionError.name);
trace(newErrorDefinitionError.errorID);
trace();
trace();
trace();
trace("Class: " + EOFError);
trace("cls.prototype.name = " + EOFError.prototype.name);
var newErrorEOFError: EOFError = new EOFError("My Error", 42);
trace(newErrorEOFError.toString());
trace(newErrorEOFError.name);
trace(newErrorEOFError.errorID);
trace();
trace();
trace();
trace("Class: " + EvalError);
trace("cls.prototype.name = " + EvalError.prototype.name);
var newErrorEvalError: EvalError = new EvalError("My Error", 42);
trace(newErrorEvalError.toString());
trace(newErrorEvalError.name);
trace(newErrorEvalError.errorID);
trace();
trace();
trace();
trace("Class: " + IOError);
trace("cls.prototype.name = " + IOError.prototype.name);
var newErrorIOError: IOError = new IOError("My Error", 42);
trace(newErrorIOError.toString());
trace(newErrorIOError.name);
trace(newErrorIOError.errorID);
trace();
trace();
trace();
trace("Class: " + InvalidSWFError);
trace("cls.prototype.name = " + InvalidSWFError.prototype.name);
var newErrorInvalidSWFError: InvalidSWFError = new InvalidSWFError("My Error", 42);
trace(newErrorInvalidSWFError.toString());
trace(newErrorInvalidSWFError.name);
trace(newErrorInvalidSWFError.errorID);
trace();
trace();
trace();
trace("Class: " + MemoryError);
trace("cls.prototype.name = " + MemoryError.prototype.name);
var newErrorMemoryError: MemoryError = new MemoryError("My Error", 42);
trace(newErrorMemoryError.toString());
trace(newErrorMemoryError.name);
trace(newErrorMemoryError.errorID);
trace();
trace();
trace();
trace("Class: " + ScriptTimeoutError);
trace("cls.prototype.name = " + ScriptTimeoutError.prototype.name);
var newErrorScriptTimeoutError: ScriptTimeoutError = new ScriptTimeoutError("My Error", 42);
trace(newErrorScriptTimeoutError.toString());
trace(newErrorScriptTimeoutError.name);
trace(newErrorScriptTimeoutError.errorID);
trace();
trace();
trace();
trace("Class: " + StackOverflowError);
trace("cls.prototype.name = " + StackOverflowError.prototype.name);
var newErrorStackOverflowError: StackOverflowError = new StackOverflowError("My Error", 42);
trace(newErrorStackOverflowError.toString());
trace(newErrorStackOverflowError.name);
trace(newErrorStackOverflowError.errorID);
trace();
trace();
trace();
trace("Class: " + URIError);
trace("cls.prototype.name = " + URIError.prototype.name);
var newErrorURIError: URIError = new URIError("My Error", 42);
trace(newErrorURIError.toString());
trace(newErrorURIError.name);
trace(newErrorURIError.errorID);
trace();
trace();
trace();
trace("Class: " + VerifyError);
trace("cls.prototype.name = " + VerifyError.prototype.name);
var newErrorVerifyError: VerifyError = new VerifyError("My Error", 42);
trace(newErrorVerifyError.toString());
trace(newErrorVerifyError.name);
trace(newErrorVerifyError.errorID);

View File

@ -0,0 +1,77 @@
Class: [class DefinitionError]
cls.prototype.name = DefinitionError
DefinitionError: My Error
DefinitionError
42
Class: [class EOFError]
cls.prototype.name = EOFError
Error: My Error
Error
42
Class: [class EvalError]
cls.prototype.name = EvalError
EvalError: My Error
EvalError
42
Class: [class IOError]
cls.prototype.name = IOError
Error: My Error
Error
42
Class: [class InvalidSWFError]
cls.prototype.name = InvalidSWFError
Error: My Error
Error
42
Class: [class MemoryError]
cls.prototype.name = MemoryError
Error: My Error
Error
42
Class: [class ScriptTimeoutError]
cls.prototype.name = ScriptTimeoutError
Error: My Error
Error
42
Class: [class StackOverflowError]
cls.prototype.name = StackOverflowError
Error: My Error
Error
42
Class: [class URIError]
cls.prototype.name = URIError
URIError: My Error
URIError
42
Class: [class VerifyError]
cls.prototype.name = VerifyError
VerifyError: My Error
VerifyError
42

Binary file not shown.