Skip to content

Clarify testing prerequisites in readme and fix tests #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ npm-debug.log

# Tests
/tests/simple/js-generated
/tests/compound/js-generated
/tests/simple/ts-generated
/tests/compound/js-generated
/tests/compound/ts-generated
/tests/compound/as3-tmp
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Make sure you have [Node v6+](https://nodejs.org/) installed.

You should have `as3-to-ts` now globaly available in your commandline.

If you want to run the test suite using `npm test`, run `npm link @as3web/as3-to-ts` in the as3-to-ts folder.

## Usage

```
Expand Down
53 changes: 0 additions & 53 deletions npm-debug.log.1304647979

This file was deleted.

Empty file removed npm-debug.log.1955635711
Empty file.
5 changes: 3 additions & 2 deletions src/emit/classlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ export default class ClassList {
}

public static getLastPathToRoot():string{
if (ClassList.isScanning) return;
//let classRecord: ClassRecord = ClassList.classList[ClassList.classList.length - 1];
let classRecord: ClassRecord = ClassList.currentClassRecord;
if(!classRecord) {
classRecord = ClassList.classList[ClassList.classList.length - 1];
}

let packageLevel: number = 0;
if (classRecord && classRecord.packageName && classRecord.packageName != "") {
Expand Down
21 changes: 14 additions & 7 deletions src/emit/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ function emitForEach(emitter:Emitter, node:Node):void {
emitter.catchup(blockNode.start + 1);

let def = emitter.findDefInScope(nameNode.text);
if (def.type && castStr == "" ){
if (def && def.type && castStr == "" ){
castStr = `<${def.type.toString()}>`;
}
let declarationWord:string = "";
Expand Down Expand Up @@ -1191,7 +1191,10 @@ function emitClass(emitter:Emitter, node:Node):void {
let mods = node.findChild(NodeKind.MOD_LIST);
if (mods && mods.children.length) {
emitter.catchup(mods.start);
emitter.insert("\n@classBound\n");

// insert @classBound with equal indentation for the next line
emitter.output = emitter.output.replace(/([^\S\n]*)$/, "$1@classBound\n$1");

let insertExport = false;
mods.children.forEach(node => {
if (node.text !== 'private') {
Expand Down Expand Up @@ -1441,16 +1444,20 @@ function emitMethod(emitter:Emitter, node:Node):void {
if (node.kind !== NodeKind.FUNCTION || name.text !== emitter.currentClassName) {
let pathToRoot = ClassList.getLastPathToRoot();
emitter.ensureImportIdentifier("bound", `${pathToRoot}bound`);

let mods = node.findChild(NodeKind.MOD_LIST);
if (mods)
if (mods) {
emitter.catchup(mods.start);
else
} else {
emitter.catchup(name.start);
emitter.insert("@bound\n");
}

// insert @bound with equal indentation for the next line
emitter.output = emitter.output.replace(/([^\S\n]*)$/, "$1@bound\n$1");

emitClassField(emitter, node);
emitter.consume('function', name.start);

emitter.catchup(name.end);
//emitter.insert(" = ");

} else {
let mods = node.findChild(NodeKind.MOD_LIST);
Expand Down
2 changes: 1 addition & 1 deletion tests/compound/CompoundTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ filesAS.forEach(file => {
}
}
else {
console.log(colors.red(' ✗ ERROR: unable to find reference file to compare to.'));
//console.log(colors.red(' ✗ ERROR: unable to find reference file to compare to.'));
}
});

Expand Down
82 changes: 0 additions & 82 deletions tests/compound/as3-tmp/Main.as

This file was deleted.

6 changes: 0 additions & 6 deletions tests/compound/as3-tmp/Snippet.snp

This file was deleted.

10 changes: 0 additions & 10 deletions tests/compound/as3-tmp/vehicles/Boat.as

This file was deleted.

21 changes: 0 additions & 21 deletions tests/compound/as3-tmp/vehicles/Car.as

This file was deleted.

18 changes: 0 additions & 18 deletions tests/compound/as3-tmp/vehicles/Vehicle.as

This file was deleted.

8 changes: 0 additions & 8 deletions tests/compound/as3-tmp/vehicles/components/Base/IDoer.as

This file was deleted.

8 changes: 0 additions & 8 deletions tests/compound/as3-tmp/vehicles/components/Base/Orphan.as

This file was deleted.

28 changes: 0 additions & 28 deletions tests/compound/as3-tmp/vehicles/components/Base/Thing.as

This file was deleted.

34 changes: 0 additions & 34 deletions tests/compound/as3-tmp/vehicles/components/Engine.as

This file was deleted.

12 changes: 0 additions & 12 deletions tests/compound/as3-tmp/vehicles/components/Wheel.as

This file was deleted.

Loading