bring back the TD208 error with new entire-script-is-a-shim detector

This commit is contained in:
Michal Moskal 2015-08-06 15:46:13 -07:00
Родитель 2f94281e3e
Коммит adc695734e
3 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -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");