Created attachment 312326 [details] [diff] [review] BEtter vector support Implement better support for Vectors. Before Vector.<T> was translated into Vector$object, and T was supplied as an argument to the ctor. That argument was used to do runtime checking of values placed in the vector. However this had problems as all vectors were the same concrete type, so code like this passed without error: var v : Vector.<T>; var c : Vector.<R>; v = c; // No error, both are Vector$object The patch included fixes this. This involved implementing more parts of type parameters from ES4. Added a method applyTypeArgs to ScriptObject. This currently throws an error for all types except Vector. When we have real parameterized types, then those types can also use this method. applyTypeArgs takes a list of type parameters, and based on those is responsible for returning the correct instantiated type. Also added a new opcode, OP_applytype which triggers the applyTypeArgs method. Added a new Multiname type to the abc file. It has a base name, and then a list of names that are the type parameters. Added logic to the PoolObject so that it knows how to resolve the new TypeName to Traits ptrs. Basically, it resolves the base name, and then the type parameters, and looks for a cached Traits for that type. If one is not found it creates a new Traits* and stores it in the pool that the base Traits came from. All the instantiated vector Traits* that are generated, have the Vector$object as their base traits. This way they all pick up the vector methods, and the various instantiated classes are all effectively derived from Vector.<*>.
Created attachment 313424 [details] [diff] [review] tests for vector typechecking patch
Attachment #313424 - Flags: review?(tierney)
Attachment #313424 - Attachment description: vector typechecking patch → tests for vector typechecking patch
added patch of tests for typechecking runtime errors. tests are in test/acceptance/es4/vector/typechecking.as
Comment on attachment 312326 [details] [diff] [review] BEtter vector support there's a TODO in Verifier.cpp that might need attention. Otherwise looks good.
Attachment #312326 - Flags: review?(stejohns) → review+
Comment on attachment 313424 [details] [diff] [review] tests for vector typechecking patch I'll check these in with the vector changes.
Attachment #313424 - Flags: review?(tierney) → review+
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
Resolved fixed engineering / work item that has been pushed. Setting status to verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.