refactor(benchpress): remove two mutable exports from largetable/util.ts (#32425)
Mutable exports, i.e. using this pattern ``` export let x = 0; export function f() { x += 1; } ``` is problematic to transpile to CommonJS and Goog.module systems, we are working on banning it google internal codebase. The workaround is adding an explcit getter function. PR Close #32425
This commit is contained in:
parent
641c5c1c1e
commit
f0bdf2a1ae
|
@ -13,8 +13,8 @@ export class TableCell {
|
||||||
}
|
}
|
||||||
|
|
||||||
let tableCreateCount: number;
|
let tableCreateCount: number;
|
||||||
export let maxRow: number;
|
let maxRow: number;
|
||||||
export let maxCol: number;
|
let maxCol: number;
|
||||||
let numberData: TableCell[][];
|
let numberData: TableCell[][];
|
||||||
let charData: TableCell[][];
|
let charData: TableCell[][];
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import {Component, Input, NgModule} from '@angular/core';
|
import {Component, Input, NgModule} from '@angular/core';
|
||||||
import {BrowserModule, DomSanitizer, SafeStyle} from '@angular/platform-browser';
|
import {BrowserModule, DomSanitizer, SafeStyle} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {TreeNode, emptyTree, maxDepth} from '../util';
|
import {TreeNode, emptyTree, getMaxDepth} from '../util';
|
||||||
|
|
||||||
let trustedEmptyColor: SafeStyle;
|
let trustedEmptyColor: SafeStyle;
|
||||||
let trustedGreyColor: SafeStyle;
|
let trustedGreyColor: SafeStyle;
|
||||||
|
@ -40,8 +40,8 @@ export class RootTreeComponent {
|
||||||
|
|
||||||
function createModule(): any {
|
function createModule(): any {
|
||||||
const components: any[] = [RootTreeComponent];
|
const components: any[] = [RootTreeComponent];
|
||||||
for (let i = 0; i <= maxDepth; i++) {
|
for (let i = 0; i <= getMaxDepth(); i++) {
|
||||||
components.push(createTreeComponent(i, i === maxDepth));
|
components.push(createTreeComponent(i, i === getMaxDepth()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({imports: [BrowserModule], bootstrap: [RootTreeComponent], declarations: [components]})
|
@NgModule({imports: [BrowserModule], bootstrap: [RootTreeComponent], declarations: [components]})
|
||||||
|
|
|
@ -25,10 +25,14 @@ export class TreeNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
let treeCreateCount: number;
|
let treeCreateCount: number;
|
||||||
export let maxDepth: number;
|
let maxDepth: number;
|
||||||
let numberData: TreeNode;
|
let numberData: TreeNode;
|
||||||
let charData: TreeNode;
|
let charData: TreeNode;
|
||||||
|
|
||||||
|
export function getMaxDepth() {
|
||||||
|
return maxDepth;
|
||||||
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
@ -77,4 +81,4 @@ export function newArray<T>(size: number, value?: T): T[] {
|
||||||
list.push(value !);
|
list.push(value !);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue