bring back the TD208 error with new entire-script-is-a-shim detector
This commit is contained in:
Родитель
2f94281e3e
Коммит
adc695734e
|
@ -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;
|
||||
|
|
|
@ -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()))
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Загрузка…
Ссылка в новой задаче