diff --git a/source/base.ts b/source/base.ts index c4d2ea8..7ccff40 100644 --- a/source/base.ts +++ b/source/base.ts @@ -4,76 +4,3 @@ */ type char = string; - -/** - * @author fenris - */ -declare var require : (path : string)=>any; - - -/** - * @author fenris - */ -declare var process : any; - - -/** - * @author fenris - */ -declare class Buffer - { - public toString() : string; - } - - -/** - * @author fenris - */ -declare class Promise - { - - /** - * @author fenris - */ - public constructor - ( - executor : (resolve : (result ?: type_result)=>void, reject ?: (reason ?: type_reason)=>void)=>void - ) - ; - - - /** - * @author fenris - */ - public then - ( - onFulfilled : (result : type_result)=>any, - onRejected ?: (reason : type_reason)=>any - ) - : Promise - ; - - - /** - * @author fenris - */ - public catch - ( - onRejected : (reason : type_reason)=>any - ) - : Promise - ; - - - /** - * @author fenris - */ - public static resolve - ( - result : type_result - ) - : Promise - ; - - } - diff --git a/source/type2.ts b/source/type2.ts index e2ff6ef..c0e336c 100644 --- a/source/type2.ts +++ b/source/type2.ts @@ -1,5 +1,7 @@ -/// +/// +/// +/// /** @@ -11,11 +13,11 @@ type type_myreader = lib_lang.class_readerPromise = - path => Promise.resolve(path) +var generate_reader : (path : string)=>lib_call.type_promise = + path => lib_call.promise_resolve(path) .then ( - path => new Promise + path => lib_call.promise_make ( (resolve, reject) => { @@ -45,7 +47,7 @@ var generate_reader : (path : string)=>Promise = ) .then ( - buffer => new Promise + buffer => lib_call.promise_make ( (resolve, reject) => { @@ -55,7 +57,7 @@ var generate_reader : (path : string)=>Promise = ) .then ( - data => new Promise + data => lib_call.promise_make ( (resolve, reject) => { @@ -69,11 +71,11 @@ var generate_reader : (path : string)=>Promise = /** * @author fenris */ -var transform_arguments : (args : Array)=>Promise<{path ?: string; input ?: Array;}, Error> = - args => Promise.resolve<{path ?: string; input ?: Array;}, Error>({}) - .then<{path ?: string; input ?: Array;}, Error> +var transform_arguments : (args : Array)=>lib_call.type_promise<{path ?: string; input ?: Array;}, Error> = + args => lib_call.promise_resolve<{path ?: string; input ?: Array;}, Error>({}) + .then<{path ?: string; input ?: Array;}/*, Error*/> ( - parameters => new Promise<{path ?: string; input ?: Array;}, Error> + parameters => lib_call.promise_make<{path ?: string; input ?: Array;}, Error> ( (resolve, reject) => { @@ -90,9 +92,9 @@ var transform_arguments : (args : Array)=>Promise<{path ?: string; input } ) ) - .then<{path ?: string; input ?: Array;}, Error> + .then<{path ?: string; input ?: Array;}/*, Error*/> ( - parameters => new Promise<{path ?: string; input ?: Array;}, Error> + parameters => lib_call.promise_make<{path ?: string; input ?: Array;}, Error> ( (resolve, reject) => { @@ -116,18 +118,18 @@ var transform_arguments : (args : Array)=>Promise<{path ?: string; input /** * @author fenris */ -var main : (args : Array)=>Promise = - args => Promise.resolve(undefined) - .then<{path ?: string; input ?: Array;}, Error> +var main : (args : Array)=>lib_call.type_promise = + args => lib_call.promise_resolve(undefined) + .then<{path ?: string; input ?: Array;}/*, Error*/> ( _ => transform_arguments(args) ) - .then<{parameters : {path ?: string; input ?: Array;}; reader : type_myreader;}, Error> + .then<{parameters : {path ?: string; input ?: Array;}; reader : type_myreader;}/*, Error*/> ( parameters => generate_reader(parameters.path) .then<{parameters : {path ?: string; input ?: Array;}; reader : type_myreader;}, Error> ( - reader => new Promise<{parameters : {path ?: string; input ?: Array;}; reader : type_myreader;}, Error> + reader => lib_call.promise_make<{parameters : {path ?: string; input ?: Array;}; reader : type_myreader;}, Error> ( (resolve_, reject_) => { @@ -136,9 +138,9 @@ var main : (args : Array)=>Promise = ) ) ) - .then, Error> + .then/*, Error*/> ( - vars => new Promise, Error> + vars => lib_call.promise_make, Error> ( (resolve, reject) => { @@ -156,9 +158,9 @@ var main : (args : Array)=>Promise = } ) ) - .then + .then ( - result => new Promise + result => lib_call.promise_make ( (resolve, reject) => { diff --git a/project.json b/type2.prj.json similarity index 67% rename from project.json rename to type2.prj.json index 25ffe92..2ffa4f8 100644 --- a/project.json +++ b/type2.prj.json @@ -2,26 +2,30 @@ "name": "type2", "version": "0.0.1", "dependencies": [ - "../plankton/lang/project.json" + "../plankton/lang/lang.prj.json" ], "roottask": { "name": "link", - "type": "schwamm-apply", + "type": "schwamm", "parameters": { - "path": "build/schwamm.json", - "outputs": { - "logic-impl": "build/type2.js" + "includes": [ + "build/type2.swm.json" + ], + "output": { + "dump": { + "logic-impl": "build/type2.js" + } } }, "sub": [ { "name": "build", - "type": "schwamm-create", + "type": "schwamm", "parameters": { "includes": [ - "../plankton/lang/build/schwamm.json" + "../plankton/lang/build/lang.swm.json" ], - "adhoc": { + "inputs": { "logic-decl": [ "temp/unlinked-logic-decl.d.ts" ], @@ -29,13 +33,16 @@ "temp/unlinked-logic-impl.js" ] }, - "output": "build/schwamm.json" + "output": { + "save": "build/type2.swm.json" + } }, "sub": [ { "name": "logic", "type": "typescript", "parameters": { + "target": "ES6", "allowUnreachableCode": true, "inputs": [ "source/base.ts",