diff --git a/editor/microbit/emitter.ts b/editor/microbit/emitter.ts index 5cf894a5..fa56e8f9 100644 --- a/editor/microbit/emitter.ts +++ b/editor/microbit/emitter.ts @@ -74,3 +74,5 @@ module TDev { } } } + +// vim: set ts=2 sw=2 sts=2: diff --git a/editor/microbit/helpers.ts b/editor/microbit/helpers.ts index 9fe62c00..273d4039 100644 --- a/editor/microbit/helpers.ts +++ b/editor/microbit/helpers.ts @@ -71,3 +71,5 @@ module TDev { } } } + +// vim: set ts=2 sw=2 sts=2: diff --git a/editor/microbit/lambda_lifter.ts b/editor/microbit/lambda_lifter.ts index ecabd999..c6bfd36b 100644 --- a/editor/microbit/lambda_lifter.ts +++ b/editor/microbit/lambda_lifter.ts @@ -23,8 +23,26 @@ module TDev { return as; } + // [InlineActions] are just at the level of statements. + public visitExpr(env, e: J.JNode) { + return []; + } + + public visitExprStmt(env, expr) { + return []; + } + public visitInlineActions(env, e: J.JExpr, actions: J.JInlineAction[]) { - return this.visitMany(e, actions).concat(actions); + // No need to visit [e], as expressions do not contain [JInlineActions]. + return this.visitMany(env, actions).concat(actions); + } + + public visitInlineAction(env, r, i, o, body: J.JStmt[]) { + return this.visitMany(env, body); + } + + public visitWhile(env, cond, body: J.JStmt[]) { + return this.visitMany(env, body); } public visitAction( @@ -37,6 +55,10 @@ module TDev { return this.visitMany(env, body); } + public visitLibrary(env, name) { + return []; + } + public visitApp(e, decls: J.JDecl[]) { return this.visitMany(e, decls); } @@ -68,3 +90,5 @@ module TDev { } } } + +// vim: set ts=2 sw=2 sts=2: diff --git a/editor/microbit/main.ts b/editor/microbit/main.ts index e52ad212..530466e9 100644 --- a/editor/microbit/main.ts +++ b/editor/microbit/main.ts @@ -1,12 +1,14 @@ /// module TDev { - import J = AST.Json + import J = AST.Json - export module Microbit { - export function compile(a: J.JApp): string { - lift(a); - return (new Emitter()).visit(emptyEnv, a); - } + export module Microbit { + export function compile(a: J.JApp): string { + lift(a); + return (new Emitter()).visit(emptyEnv, a); } + } } + +// vim: set ts=2 sw=2 sts=2: diff --git a/editor/microbit/visitor.ts b/editor/microbit/visitor.ts index 5ec5ce36..9b7f0b3c 100644 --- a/editor/microbit/visitor.ts +++ b/editor/microbit/visitor.ts @@ -55,7 +55,10 @@ module TDev { return this.visitAction(env, n7.name, n7.inParameters, n7.outParameters, n7.body); case "app": return this.visitApp(env, ( n).decls); + case "library": + return this.visitLibrary(env, ( n).scriptName); } + throw "Unsupported node: "+n.nodeType; } public visitNumberLiteral(env: T, v: number): U { throw "Not implemented"; } @@ -101,7 +104,10 @@ module TDev { outParams: J.JLocalDef[], body: J.JStmt[]): U { throw "Not implemented"; } public visitApp(env: T, decls: J.JDecl[]): U { throw "Not implemented"; } + public visitLibrary(env: T, name: string): U { throw "Not implemented"; } } } } + +// vim: set ts=2 sw=2 sts=2: diff --git a/editor/refs.ts b/editor/refs.ts index 6333dbf9..51e91786 100644 --- a/editor/refs.ts +++ b/editor/refs.ts @@ -52,8 +52,8 @@ /// /// /// +/// /// /// /// -/// ///