diff --git a/ast/ast.ts b/ast/ast.ts index 3b14f740..e38ecf3c 100644 --- a/ast/ast.ts +++ b/ast/ast.ts @@ -2384,6 +2384,7 @@ module TDev.AST { public notifyVersionMarker:any = new Object(); public libNamespaceCache = new LibNamespaceCache(this); public blockExternalLinks:boolean = undefined; + public entireShim = false; public recompiler:Compiler; public recompiledScript:CompiledScript; diff --git a/ast/typeChecker.ts b/ast/typeChecker.ts index 3c1d167c..77d8a31f 100644 --- a/ast/typeChecker.ts +++ b/ast/typeChecker.ts @@ -858,7 +858,7 @@ module TDev.AST node.clearError(); this.actionSection = ActionSection.Normal; this.inAtomic = node.isAtomic; - this.inShim = /{shim:.*}/.test(node.getDescription()) + this.inShim = this.topApp.entireShim || /{shim:.*}/.test(node.getDescription()) this.scope(() => { // TODO in - read-only? @@ -1116,6 +1116,11 @@ module TDev.AST public visitApp(node:App) { this.typecheckLibraries(node); + if (Cloud.isRestricted()) + node.entireShim = + /#entireshim/i.test(node.comment) || + node.actions().some(a => a.isPage()) || + node.libraries().some(l => l.resolved && l.resolved.entireShim) node.things.forEach((n:Decl) => { var wt = n._wasTypechecked; n._wasTypechecked = true; @@ -1366,7 +1371,7 @@ module TDev.AST } if (!this.inShim && this.invisibleLocals.indexOf(l) >= 0) { - // this.markError(t, lf("TD208: inline functions cannot access locals from outside, like '{0}'", l.getName())) + this.markError(t, lf("TD208: inline functions cannot access locals from outside, like '{0}'", l.getName())) } diff --git a/editor/scriptList.ts b/editor/scriptList.ts index 804691e3..4b5dc0f1 100644 --- a/editor/scriptList.ts +++ b/editor/scriptList.ts @@ -27,7 +27,7 @@ if (siteHeader) { var menuItems = [ { id: "createcode", name: lf("Create Code"), tick: Ticks.siteMenuCreateCode, handler: () => { - if (Cloud.isOffline() || Cloud.isFota()) + if (Cloud.isOffline() || Cloud.isFota() || /http:\/\/localhost/i.test(document.URL)) TheHub.createScript(); else Util.navigateInWindow("/create-code");