From 0341f8d36caa00642be40b11069ca8c235a53090 Mon Sep 17 00:00:00 2001 From: Mark Pearce Date: Thu, 2 Nov 2023 14:12:23 -0300 Subject: [PATCH] Removed mistakenly cached brsFile.validationSegments --- benchmarks/package-lock.json | 10 ++++----- src/Program.ts | 6 ++--- src/Scope.spec.ts | 4 +--- src/Scope.ts | 14 ++++++------ src/bscPlugin/validation/ScopeValidator.ts | 2 ++ src/files/BrsFile.ts | 26 +++++++++++----------- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/benchmarks/package-lock.json b/benchmarks/package-lock.json index 2c4427e5b..dd52b46e9 100644 --- a/benchmarks/package-lock.json +++ b/benchmarks/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "benchmark": "^2.1.4", - "brighterscript1": "file:.tmp/brighterscript-0.66.0-alpha.71698931603378.tgz", + "brighterscript1": "file:.tmp/brighterscript-0.66.0-alpha.71698945001324.tgz", "brighterscript2": "npm:brighterscript@^0.65.8", "chalk": "^4.1.2", "fast-glob": "^3.2.12", @@ -608,8 +608,8 @@ "node_modules/brighterscript1": { "name": "brighterscript", "version": "0.66.0-alpha.7", - "resolved": "file:.tmp/brighterscript-0.66.0-alpha.71698931603378.tgz", - "integrity": "sha512-d9O/ULFUIoshjqo+lkV75xI3/JHEjPAVoCaEyDTzETOImdepC5s+/iBbaoAhUuSYzzR98cUp/eFhlMckLeXgOg==", + "resolved": "file:.tmp/brighterscript-0.66.0-alpha.71698945001324.tgz", + "integrity": "sha512-m7voOWy/ZlrVjeH6MrFLRXBw2uF6Qy6/9of+ehjV4W6zY4H/+henar+F60jgxgT+Kn518ogTHvaWoTRZAGUPPw==", "license": "MIT", "dependencies": { "@rokucommunity/bslib": "^0.1.1", @@ -4089,8 +4089,8 @@ } }, "brighterscript1": { - "version": "file:.tmp/brighterscript-0.66.0-alpha.71698931603378.tgz", - "integrity": "sha512-d9O/ULFUIoshjqo+lkV75xI3/JHEjPAVoCaEyDTzETOImdepC5s+/iBbaoAhUuSYzzR98cUp/eFhlMckLeXgOg==", + "version": "file:.tmp/brighterscript-0.66.0-alpha.71698945001324.tgz", + "integrity": "sha512-m7voOWy/ZlrVjeH6MrFLRXBw2uF6Qy6/9of+ehjV4W6zY4H/+henar+F60jgxgT+Kn518ogTHvaWoTRZAGUPPw==", "requires": { "@rokucommunity/bslib": "^0.1.1", "@xml-tools/parser": "^1.0.7", diff --git a/src/Program.ts b/src/Program.ts index adacf4b79..9c9af3a96 100644 --- a/src/Program.ts +++ b/src/Program.ts @@ -817,12 +817,12 @@ export class Program { file: file }; this.plugins.emit('beforeFileValidate', validateFileEvent); - const t0 = performance.now(); + // const t0 = performance.now(); //emit an event to allow plugins to contribute to the file validation process this.plugins.emit('onFileValidate', validateFileEvent); file.isValidated = true; - const t1 = performance.now(); - console.log('validateFileEvent', file.pkgPath, t1 - t0); + // const t1 = performance.now(); + //console.log('validateFileEvent', file.pkgPath, t1 - t0); this.plugins.emit('afterFileValidate', validateFileEvent); } } diff --git a/src/Scope.spec.ts b/src/Scope.spec.ts index 01c0f12c5..c3c9b935c 100644 --- a/src/Scope.spec.ts +++ b/src/Scope.spec.ts @@ -3107,8 +3107,6 @@ describe('Scope', () => { let symbolTables = getSymbolTableList(); - console.log(symbolTables.map(x => `${x.name} ${x['siblings'].size}`)); - symbolTables.forEach(x => expect(x['siblings'].size).to.eql(1, `${x.name} has wrong number of siblings`)); scope.unlinkSymbolTable(); @@ -3129,7 +3127,7 @@ describe('Scope', () => { describe('performance', () => { // eslint-disable-next-line func-names, prefer-arrow-callback - it('namespace linking performance', function () { + it.skip('namespace linking performance', function () { this.timeout(30000); // this test takes a long time! program.options.autoImportComponentScript = true; const constFileContents = ` diff --git a/src/Scope.ts b/src/Scope.ts index b14501c83..2311eaf6d 100644 --- a/src/Scope.ts +++ b/src/Scope.ts @@ -753,21 +753,21 @@ export class Scope { let callableContainerMap = util.getCallableContainersByLowerName(callables); //Since statements from files are shared across multiple scopes, we need to link those statements to the current scope - const t0 = performance.now(); + //const t0 = performance.now(); this.linkSymbolTable(); - const t1 = performance.now(); - console.log('onScopeValidate() - linkSymbolTable', this.name, t1 - t0); + //const t1 = performance.now(); + //console.log('onScopeValidate() - linkSymbolTable', this.name, t1 - t0); const scopeValidateEvent = { program: this.program, scope: this }; this.program.plugins.emit('beforeScopeValidate', scopeValidateEvent); this.program.plugins.emit('onScopeValidate', scopeValidateEvent); - const t2 = performance.now(); - console.log('onScopeValidate() - scopeValidateEvent', this.name, t2 - t1); + //const t2 = performance.now(); + //console.log('onScopeValidate() - scopeValidateEvent', this.name, t2 - t1); this._validate(callableContainerMap); - const t3 = performance.now(); - console.log('onScopeValidate() - _validate', this.name, t3 - t2); + //const t3 = performance.now(); + //console.log('onScopeValidate() - _validate', this.name, t3 - t2); this.program.plugins.emit('afterScopeValidate', scopeValidateEvent); //unlink all symbol tables from this scope (so they don't accidentally stick around) this.unlinkSymbolTable(); diff --git a/src/bscPlugin/validation/ScopeValidator.ts b/src/bscPlugin/validation/ScopeValidator.ts index 538f963d1..8cbe5f5e1 100644 --- a/src/bscPlugin/validation/ScopeValidator.ts +++ b/src/bscPlugin/validation/ScopeValidator.ts @@ -54,6 +54,8 @@ export class ScopeValidator { private walkFiles() { + //function signatures incompatible cross scopes + this.event.scope.enumerateOwnFiles((file) => { if (isBrsFile(file)) { const validationVisitor = createVisitor({ diff --git a/src/files/BrsFile.ts b/src/files/BrsFile.ts index 22e4cceb9..8fc60c3ec 100644 --- a/src/files/BrsFile.ts +++ b/src/files/BrsFile.ts @@ -1335,16 +1335,16 @@ export class BrsFile implements File { } public getValidationSegments() { - return this.cache.getOrAdd(`validationSegments`, () => { - if (BrsFile.reduceReValidation) { - const t0 = performance.now(); - const segments = this.validationSegmenter.getSegments(); - const t1 = performance.now(); - console.log('validationSegmenter.getSegments()', this.pkgPath, t1 - t0); - return segments; - } - return [this.ast]; - }); + // return this.cache.getOrAdd(`validationSegments`, () => { + if (BrsFile.reduceReValidation) { + //const t0 = performance.now(); + const segments = this.validationSegmenter.getSegments(); + //const t1 = performance.now(); + // console.log('validationSegmenter.getSegments()', this.pkgPath, t1 - t0); + return segments; + } + return [this.ast]; + // }); } public markSegmentAsValidated(node: AstNode) { @@ -1353,10 +1353,10 @@ export class BrsFile implements File { public getNamespaceLookupObject() { return this.cache.getOrAdd(`namespaceLookup`, () => { - const t0 = performance.now(); + //const t0 = performance.now(); const nsLookup = this.buildNamespaceLookup(); - const t1 = performance.now(); - console.log('buildNamespaceLookup()', this.pkgPath, t1 - t0); + // const t1 = performance.now(); + //console.log('buildNamespaceLookup()', this.pkgPath, t1 - t0); return nsLookup; }); }