Snapshot refactorings, which mainly wraps Android extends within inner functions so that they are evaluated at runtime, when needed. Also some refactoring preventing circular requires.

This commit is contained in:
atanasovg
2016-01-19 17:52:33 +02:00
parent 935939bb51
commit fbc612610f
31 changed files with 943 additions and 721 deletions

View File

@ -3,8 +3,13 @@ import { knownFolders } from "file-system"
export var debug = true;
// TODO: Get this from the runtimes...
var applicationRootPath = knownFolders.currentApp().path;
applicationRootPath = applicationRootPath.substr(0, applicationRootPath.length - "app/".length);
var applicationRootPath;
function ensureAppRootPath() {
if (!applicationRootPath) {
applicationRootPath = knownFolders.currentApp().path;
applicationRootPath = applicationRootPath.substr(0, applicationRootPath.length - "app/".length);
}
}
export class Source {
private _uri: string;
@ -14,7 +19,9 @@ export class Source {
private static _source: symbol = Symbol("source");
private static _appRoot: string;
constructor(uri: string, line: number, column: number) {
constructor(uri: string, line: number, column: number) {
ensureAppRootPath();
if (uri.length > applicationRootPath.length && uri.substr(0, applicationRootPath.length) === applicationRootPath) {
this._uri = "file://" + uri.substr(applicationRootPath.length);
} else {