Adding regression test
This commit is contained in:
parent
615210f133
commit
65891766e5
4 changed files with 1074 additions and 0 deletions
120
tests/baselines/reference/controlFlowCaching.js
Normal file
120
tests/baselines/reference/controlFlowCaching.js
Normal file
|
@ -0,0 +1,120 @@
|
|||
//// [controlFlowCaching.ts]
|
||||
|
||||
// Repro for #8401
|
||||
|
||||
function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {
|
||||
var isRtl = this._isRtl(); // chart mirroring
|
||||
// prepare variable
|
||||
var o = this.opt, ta = this.chart.theme.axis, position = o.position,
|
||||
leftBottom = position !== "rightOrTop", rotation = o.rotation % 360,
|
||||
start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign,
|
||||
labelGap = this.chart.theme.axis.tick.labelGap,
|
||||
taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
|
||||
taTitleFont = o.titleFont || (ta.title && ta.title.font),
|
||||
taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black",
|
||||
taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black",
|
||||
taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15,
|
||||
taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis",
|
||||
taMajorTick = this.chart.theme.getTick("major", o),
|
||||
taMinorTick = this.chart.theme.getTick("minor", o),
|
||||
taMicroTick = this.chart.theme.getTick("micro", o),
|
||||
|
||||
taStroke = "stroke" in o ? o.stroke : ta.stroke,
|
||||
size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
|
||||
cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
|
||||
sinr = Math.abs(Math.sin(rotation * Math.PI / 180)),
|
||||
tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
|
||||
if (rotation < 0) {
|
||||
rotation += 360;
|
||||
}
|
||||
var cachedLabelW = this._getMaxLabelSize();
|
||||
cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;
|
||||
titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0,
|
||||
taMinorTick.length > 0 ? taMinorTick.length : 0) +
|
||||
tsize + taTitleGap;
|
||||
axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring
|
||||
switch (rotation) {
|
||||
default:
|
||||
if (rotation < (90 - centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
} else if (rotation < (90 + centerAnchorLimit)) {
|
||||
labelOffset.x = -size * 0.4;
|
||||
} else if (rotation < 180) {
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
} else if (rotation < (270 - centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
} else if (rotation < (270 + centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? size * 0.4 : 0;
|
||||
} else {
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
}
|
||||
}
|
||||
|
||||
titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
|
||||
titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
|
||||
switch (labelAlign) {
|
||||
case "start":
|
||||
labelAlign = "end";
|
||||
break;
|
||||
case "end":
|
||||
labelAlign = "start";
|
||||
break;
|
||||
case "middle":
|
||||
labelOffset.y -= size;
|
||||
break;
|
||||
}
|
||||
|
||||
let _ = rotation;
|
||||
}
|
||||
|
||||
|
||||
//// [controlFlowCaching.js]
|
||||
// Repro for #8401
|
||||
function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {
|
||||
var isRtl = this._isRtl(); // chart mirroring
|
||||
// prepare variable
|
||||
var o = this.opt, ta = this.chart.theme.axis, position = o.position, leftBottom = position !== "rightOrTop", rotation = o.rotation % 360, start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign, labelGap = this.chart.theme.axis.tick.labelGap, taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font), taTitleFont = o.titleFont || (ta.title && ta.title.font), taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black", taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black", taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15, taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis", taMajorTick = this.chart.theme.getTick("major", o), taMinorTick = this.chart.theme.getTick("minor", o), taMicroTick = this.chart.theme.getTick("micro", o), taStroke = "stroke" in o ? o.stroke : ta.stroke, size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0, cosr = Math.abs(Math.cos(rotation * Math.PI / 180)), sinr = Math.abs(Math.sin(rotation * Math.PI / 180)), tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
|
||||
if (rotation < 0) {
|
||||
rotation += 360;
|
||||
}
|
||||
var cachedLabelW = this._getMaxLabelSize();
|
||||
cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;
|
||||
titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) +
|
||||
tsize + taTitleGap;
|
||||
axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring
|
||||
switch (rotation) {
|
||||
default:
|
||||
if (rotation < (90 - centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
}
|
||||
else if (rotation < (90 + centerAnchorLimit)) {
|
||||
labelOffset.x = -size * 0.4;
|
||||
}
|
||||
else if (rotation < 180) {
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
}
|
||||
else if (rotation < (270 - centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
}
|
||||
else if (rotation < (270 + centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? size * 0.4 : 0;
|
||||
}
|
||||
else {
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
}
|
||||
}
|
||||
titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
|
||||
titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
|
||||
switch (labelAlign) {
|
||||
case "start":
|
||||
labelAlign = "end";
|
||||
break;
|
||||
case "end":
|
||||
labelAlign = "start";
|
||||
break;
|
||||
case "middle":
|
||||
labelOffset.y -= size;
|
||||
break;
|
||||
}
|
||||
var _ = rotation;
|
||||
}
|
279
tests/baselines/reference/controlFlowCaching.symbols
Normal file
279
tests/baselines/reference/controlFlowCaching.symbols
Normal file
|
@ -0,0 +1,279 @@
|
|||
=== tests/cases/compiler/controlFlowCaching.ts ===
|
||||
|
||||
// Repro for #8401
|
||||
|
||||
function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {
|
||||
>f : Symbol(f, Decl(controlFlowCaching.ts, 0, 0))
|
||||
>dim : Symbol(dim, Decl(controlFlowCaching.ts, 3, 11))
|
||||
>offsets : Symbol(offsets, Decl(controlFlowCaching.ts, 3, 15))
|
||||
>arr : Symbol(arr, Decl(controlFlowCaching.ts, 3, 24))
|
||||
>acommon : Symbol(acommon, Decl(controlFlowCaching.ts, 3, 29))
|
||||
>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38))
|
||||
>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57))
|
||||
>has : Symbol(has, Decl(controlFlowCaching.ts, 3, 60))
|
||||
>lin : Symbol(lin, Decl(controlFlowCaching.ts, 3, 65))
|
||||
|
||||
var isRtl = this._isRtl(); // chart mirroring
|
||||
>isRtl : Symbol(isRtl, Decl(controlFlowCaching.ts, 4, 7))
|
||||
|
||||
// prepare variable
|
||||
var o = this.opt, ta = this.chart.theme.axis, position = o.position,
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>position : Symbol(position, Decl(controlFlowCaching.ts, 6, 49))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
|
||||
leftBottom = position !== "rightOrTop", rotation = o.rotation % 360,
|
||||
>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72))
|
||||
>position : Symbol(position, Decl(controlFlowCaching.ts, 6, 49))
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
|
||||
start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign,
|
||||
>start : Symbol(start, Decl(controlFlowCaching.ts, 7, 76))
|
||||
>stop : Symbol(stop, Decl(controlFlowCaching.ts, 8, 14))
|
||||
>titlePos : Symbol(titlePos, Decl(controlFlowCaching.ts, 8, 20))
|
||||
>titleRotation : Symbol(titleRotation, Decl(controlFlowCaching.ts, 8, 30))
|
||||
>titleOffset : Symbol(titleOffset, Decl(controlFlowCaching.ts, 8, 49))
|
||||
>axisVector : Symbol(axisVector, Decl(controlFlowCaching.ts, 8, 62))
|
||||
>tickVector : Symbol(tickVector, Decl(controlFlowCaching.ts, 8, 74))
|
||||
>anchorOffset : Symbol(anchorOffset, Decl(controlFlowCaching.ts, 8, 86))
|
||||
>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100))
|
||||
>labelAlign : Symbol(labelAlign, Decl(controlFlowCaching.ts, 8, 113))
|
||||
|
||||
labelGap = this.chart.theme.axis.tick.labelGap,
|
||||
>labelGap : Symbol(labelGap, Decl(controlFlowCaching.ts, 8, 125))
|
||||
|
||||
taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
|
||||
>taFont : Symbol(taFont, Decl(controlFlowCaching.ts, 9, 55))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
|
||||
taTitleFont = o.titleFont || (ta.title && ta.title.font),
|
||||
>taTitleFont : Symbol(taTitleFont, Decl(controlFlowCaching.ts, 10, 92))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
|
||||
taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black",
|
||||
>taFontColor : Symbol(taFontColor, Decl(controlFlowCaching.ts, 11, 65))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
|
||||
taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black",
|
||||
>taTitleFontColor : Symbol(taTitleFontColor, Decl(controlFlowCaching.ts, 12, 123))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
|
||||
taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15,
|
||||
>taTitleGap : Symbol(taTitleGap, Decl(controlFlowCaching.ts, 13, 91))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
|
||||
taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis",
|
||||
>taTitleOrientation : Symbol(taTitleOrientation, Decl(controlFlowCaching.ts, 14, 92))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
|
||||
taMajorTick = this.chart.theme.getTick("major", o),
|
||||
>taMajorTick : Symbol(taMajorTick, Decl(controlFlowCaching.ts, 15, 96))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
|
||||
taMinorTick = this.chart.theme.getTick("minor", o),
|
||||
>taMinorTick : Symbol(taMinorTick, Decl(controlFlowCaching.ts, 16, 59))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
|
||||
taMicroTick = this.chart.theme.getTick("micro", o),
|
||||
>taMicroTick : Symbol(taMicroTick, Decl(controlFlowCaching.ts, 17, 59))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
|
||||
taStroke = "stroke" in o ? o.stroke : ta.stroke,
|
||||
>taStroke : Symbol(taStroke, Decl(controlFlowCaching.ts, 18, 59))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>o : Symbol(o, Decl(controlFlowCaching.ts, 6, 7))
|
||||
>ta : Symbol(ta, Decl(controlFlowCaching.ts, 6, 21))
|
||||
|
||||
size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
>taFont : Symbol(taFont, Decl(controlFlowCaching.ts, 9, 55))
|
||||
>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57))
|
||||
>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57))
|
||||
>taFont : Symbol(taFont, Decl(controlFlowCaching.ts, 9, 55))
|
||||
|
||||
cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
|
||||
>cosr : Symbol(cosr, Decl(controlFlowCaching.ts, 21, 79))
|
||||
>Math.abs : Symbol(Math.abs, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>abs : Symbol(Math.abs, Decl(lib.d.ts, --, --))
|
||||
>Math.cos : Symbol(Math.cos, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>cos : Symbol(Math.cos, Decl(lib.d.ts, --, --))
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
>Math.PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
|
||||
|
||||
sinr = Math.abs(Math.sin(rotation * Math.PI / 180)),
|
||||
>sinr : Symbol(sinr, Decl(controlFlowCaching.ts, 22, 60))
|
||||
>Math.abs : Symbol(Math.abs, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>abs : Symbol(Math.abs, Decl(lib.d.ts, --, --))
|
||||
>Math.sin : Symbol(Math.sin, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>sin : Symbol(Math.sin, Decl(lib.d.ts, --, --))
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
>Math.PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
|
||||
|
||||
tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
|
||||
>tsize : Symbol(tsize, Decl(controlFlowCaching.ts, 23, 60))
|
||||
>taTitleFont : Symbol(taTitleFont, Decl(controlFlowCaching.ts, 10, 92))
|
||||
>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57))
|
||||
>g : Symbol(g, Decl(controlFlowCaching.ts, 3, 57))
|
||||
>taTitleFont : Symbol(taTitleFont, Decl(controlFlowCaching.ts, 10, 92))
|
||||
|
||||
if (rotation < 0) {
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
|
||||
rotation += 360;
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
}
|
||||
var cachedLabelW = this._getMaxLabelSize();
|
||||
>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7))
|
||||
|
||||
cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;
|
||||
>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7))
|
||||
>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7))
|
||||
>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7))
|
||||
|
||||
titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0,
|
||||
>titleOffset : Symbol(titleOffset, Decl(controlFlowCaching.ts, 8, 49))
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
>cosr : Symbol(cosr, Decl(controlFlowCaching.ts, 21, 79))
|
||||
>cachedLabelW : Symbol(cachedLabelW, Decl(controlFlowCaching.ts, 28, 7))
|
||||
>sinr : Symbol(sinr, Decl(controlFlowCaching.ts, 22, 60))
|
||||
>labelGap : Symbol(labelGap, Decl(controlFlowCaching.ts, 8, 125))
|
||||
>Math.max : Symbol(Math.max, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>max : Symbol(Math.max, Decl(lib.d.ts, --, --))
|
||||
>taMajorTick : Symbol(taMajorTick, Decl(controlFlowCaching.ts, 15, 96))
|
||||
>taMajorTick : Symbol(taMajorTick, Decl(controlFlowCaching.ts, 15, 96))
|
||||
|
||||
taMinorTick.length > 0 ? taMinorTick.length : 0) +
|
||||
>taMinorTick : Symbol(taMinorTick, Decl(controlFlowCaching.ts, 16, 59))
|
||||
>taMinorTick : Symbol(taMinorTick, Decl(controlFlowCaching.ts, 16, 59))
|
||||
|
||||
tsize + taTitleGap;
|
||||
>tsize : Symbol(tsize, Decl(controlFlowCaching.ts, 23, 60))
|
||||
>taTitleGap : Symbol(taTitleGap, Decl(controlFlowCaching.ts, 13, 91))
|
||||
|
||||
axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring
|
||||
>axisVector : Symbol(axisVector, Decl(controlFlowCaching.ts, 8, 62))
|
||||
>x : Symbol(x, Decl(controlFlowCaching.ts, 33, 18))
|
||||
>isRtl : Symbol(isRtl, Decl(controlFlowCaching.ts, 4, 7))
|
||||
>y : Symbol(y, Decl(controlFlowCaching.ts, 33, 37))
|
||||
|
||||
switch (rotation) {
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
|
||||
default:
|
||||
if (rotation < (90 - centerAnchorLimit)) {
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38))
|
||||
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100))
|
||||
>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72))
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
|
||||
} else if (rotation < (90 + centerAnchorLimit)) {
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38))
|
||||
|
||||
labelOffset.x = -size * 0.4;
|
||||
>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100))
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
|
||||
} else if (rotation < 180) {
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100))
|
||||
>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72))
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
|
||||
} else if (rotation < (270 - centerAnchorLimit)) {
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38))
|
||||
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100))
|
||||
>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72))
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
|
||||
} else if (rotation < (270 + centerAnchorLimit)) {
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
>centerAnchorLimit : Symbol(centerAnchorLimit, Decl(controlFlowCaching.ts, 3, 38))
|
||||
|
||||
labelOffset.y = leftBottom ? size * 0.4 : 0;
|
||||
>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100))
|
||||
>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72))
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
|
||||
} else {
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100))
|
||||
>leftBottom : Symbol(leftBottom, Decl(controlFlowCaching.ts, 6, 72))
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
}
|
||||
}
|
||||
|
||||
titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
|
||||
>titleRotation : Symbol(titleRotation, Decl(controlFlowCaching.ts, 8, 30))
|
||||
>taTitleOrientation : Symbol(taTitleOrientation, Decl(controlFlowCaching.ts, 14, 92))
|
||||
>taTitleOrientation : Symbol(taTitleOrientation, Decl(controlFlowCaching.ts, 14, 92))
|
||||
|
||||
titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
|
||||
>titlePos : Symbol(titlePos, Decl(controlFlowCaching.ts, 8, 20))
|
||||
>offsets : Symbol(offsets, Decl(controlFlowCaching.ts, 3, 15))
|
||||
>titleOffset : Symbol(titleOffset, Decl(controlFlowCaching.ts, 8, 49))
|
||||
>titleRotation : Symbol(titleRotation, Decl(controlFlowCaching.ts, 8, 30))
|
||||
>tsize : Symbol(tsize, Decl(controlFlowCaching.ts, 23, 60))
|
||||
|
||||
switch (labelAlign) {
|
||||
>labelAlign : Symbol(labelAlign, Decl(controlFlowCaching.ts, 8, 113))
|
||||
|
||||
case "start":
|
||||
labelAlign = "end";
|
||||
>labelAlign : Symbol(labelAlign, Decl(controlFlowCaching.ts, 8, 113))
|
||||
|
||||
break;
|
||||
case "end":
|
||||
labelAlign = "start";
|
||||
>labelAlign : Symbol(labelAlign, Decl(controlFlowCaching.ts, 8, 113))
|
||||
|
||||
break;
|
||||
case "middle":
|
||||
labelOffset.y -= size;
|
||||
>labelOffset : Symbol(labelOffset, Decl(controlFlowCaching.ts, 8, 100))
|
||||
>size : Symbol(size, Decl(controlFlowCaching.ts, 20, 56))
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
let _ = rotation;
|
||||
>_ : Symbol(_, Decl(controlFlowCaching.ts, 65, 7))
|
||||
>rotation : Symbol(rotation, Decl(controlFlowCaching.ts, 7, 47))
|
||||
}
|
||||
|
607
tests/baselines/reference/controlFlowCaching.types
Normal file
607
tests/baselines/reference/controlFlowCaching.types
Normal file
|
@ -0,0 +1,607 @@
|
|||
=== tests/cases/compiler/controlFlowCaching.ts ===
|
||||
|
||||
// Repro for #8401
|
||||
|
||||
function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {
|
||||
>f : (dim: any, offsets: any, arr: any, acommon: any, centerAnchorLimit: any, g: any, has: any, lin: any) => void
|
||||
>dim : any
|
||||
>offsets : any
|
||||
>arr : any
|
||||
>acommon : any
|
||||
>centerAnchorLimit : any
|
||||
>g : any
|
||||
>has : any
|
||||
>lin : any
|
||||
|
||||
var isRtl = this._isRtl(); // chart mirroring
|
||||
>isRtl : any
|
||||
>this._isRtl() : any
|
||||
>this._isRtl : any
|
||||
>this : any
|
||||
>_isRtl : any
|
||||
|
||||
// prepare variable
|
||||
var o = this.opt, ta = this.chart.theme.axis, position = o.position,
|
||||
>o : any
|
||||
>this.opt : any
|
||||
>this : any
|
||||
>opt : any
|
||||
>ta : any
|
||||
>this.chart.theme.axis : any
|
||||
>this.chart.theme : any
|
||||
>this.chart : any
|
||||
>this : any
|
||||
>chart : any
|
||||
>theme : any
|
||||
>axis : any
|
||||
>position : any
|
||||
>o.position : any
|
||||
>o : any
|
||||
>position : any
|
||||
|
||||
leftBottom = position !== "rightOrTop", rotation = o.rotation % 360,
|
||||
>leftBottom : boolean
|
||||
>position !== "rightOrTop" : boolean
|
||||
>position : any
|
||||
>"rightOrTop" : string
|
||||
>rotation : number
|
||||
>o.rotation % 360 : number
|
||||
>o.rotation : any
|
||||
>o : any
|
||||
>rotation : any
|
||||
>360 : number
|
||||
|
||||
start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign,
|
||||
>start : any
|
||||
>stop : any
|
||||
>titlePos : any
|
||||
>titleRotation : number
|
||||
>0 : number
|
||||
>titleOffset : any
|
||||
>axisVector : any
|
||||
>tickVector : any
|
||||
>anchorOffset : any
|
||||
>labelOffset : any
|
||||
>labelAlign : any
|
||||
|
||||
labelGap = this.chart.theme.axis.tick.labelGap,
|
||||
>labelGap : any
|
||||
>this.chart.theme.axis.tick.labelGap : any
|
||||
>this.chart.theme.axis.tick : any
|
||||
>this.chart.theme.axis : any
|
||||
>this.chart.theme : any
|
||||
>this.chart : any
|
||||
>this : any
|
||||
>chart : any
|
||||
>theme : any
|
||||
>axis : any
|
||||
>tick : any
|
||||
>labelGap : any
|
||||
|
||||
taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
|
||||
>taFont : any
|
||||
>o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font) : any
|
||||
>o.font || (ta.majorTick && ta.majorTick.font) : any
|
||||
>o.font : any
|
||||
>o : any
|
||||
>font : any
|
||||
>(ta.majorTick && ta.majorTick.font) : any
|
||||
>ta.majorTick && ta.majorTick.font : any
|
||||
>ta.majorTick : any
|
||||
>ta : any
|
||||
>majorTick : any
|
||||
>ta.majorTick.font : any
|
||||
>ta.majorTick : any
|
||||
>ta : any
|
||||
>majorTick : any
|
||||
>font : any
|
||||
>(ta.tick && ta.tick.font) : any
|
||||
>ta.tick && ta.tick.font : any
|
||||
>ta.tick : any
|
||||
>ta : any
|
||||
>tick : any
|
||||
>ta.tick.font : any
|
||||
>ta.tick : any
|
||||
>ta : any
|
||||
>tick : any
|
||||
>font : any
|
||||
|
||||
taTitleFont = o.titleFont || (ta.title && ta.title.font),
|
||||
>taTitleFont : any
|
||||
>o.titleFont || (ta.title && ta.title.font) : any
|
||||
>o.titleFont : any
|
||||
>o : any
|
||||
>titleFont : any
|
||||
>(ta.title && ta.title.font) : any
|
||||
>ta.title && ta.title.font : any
|
||||
>ta.title : any
|
||||
>ta : any
|
||||
>title : any
|
||||
>ta.title.font : any
|
||||
>ta.title : any
|
||||
>ta : any
|
||||
>title : any
|
||||
>font : any
|
||||
|
||||
taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black",
|
||||
>taFontColor : any
|
||||
>o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black" : any
|
||||
>o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) : any
|
||||
>o.fontColor || (ta.majorTick && ta.majorTick.fontColor) : any
|
||||
>o.fontColor : any
|
||||
>o : any
|
||||
>fontColor : any
|
||||
>(ta.majorTick && ta.majorTick.fontColor) : any
|
||||
>ta.majorTick && ta.majorTick.fontColor : any
|
||||
>ta.majorTick : any
|
||||
>ta : any
|
||||
>majorTick : any
|
||||
>ta.majorTick.fontColor : any
|
||||
>ta.majorTick : any
|
||||
>ta : any
|
||||
>majorTick : any
|
||||
>fontColor : any
|
||||
>(ta.tick && ta.tick.fontColor) : any
|
||||
>ta.tick && ta.tick.fontColor : any
|
||||
>ta.tick : any
|
||||
>ta : any
|
||||
>tick : any
|
||||
>ta.tick.fontColor : any
|
||||
>ta.tick : any
|
||||
>ta : any
|
||||
>tick : any
|
||||
>fontColor : any
|
||||
>"black" : string
|
||||
|
||||
taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black",
|
||||
>taTitleFontColor : any
|
||||
>o.titleFontColor || (ta.title && ta.title.fontColor) || "black" : any
|
||||
>o.titleFontColor || (ta.title && ta.title.fontColor) : any
|
||||
>o.titleFontColor : any
|
||||
>o : any
|
||||
>titleFontColor : any
|
||||
>(ta.title && ta.title.fontColor) : any
|
||||
>ta.title && ta.title.fontColor : any
|
||||
>ta.title : any
|
||||
>ta : any
|
||||
>title : any
|
||||
>ta.title.fontColor : any
|
||||
>ta.title : any
|
||||
>ta : any
|
||||
>title : any
|
||||
>fontColor : any
|
||||
>"black" : string
|
||||
|
||||
taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15,
|
||||
>taTitleGap : any
|
||||
>(o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15 : any
|
||||
>(o.titleGap == 0) : boolean
|
||||
>o.titleGap == 0 : boolean
|
||||
>o.titleGap : any
|
||||
>o : any
|
||||
>titleGap : any
|
||||
>0 : number
|
||||
>0 : number
|
||||
>o.titleGap || (ta.title && ta.title.gap) || 15 : any
|
||||
>o.titleGap || (ta.title && ta.title.gap) : any
|
||||
>o.titleGap : any
|
||||
>o : any
|
||||
>titleGap : any
|
||||
>(ta.title && ta.title.gap) : any
|
||||
>ta.title && ta.title.gap : any
|
||||
>ta.title : any
|
||||
>ta : any
|
||||
>title : any
|
||||
>ta.title.gap : any
|
||||
>ta.title : any
|
||||
>ta : any
|
||||
>title : any
|
||||
>gap : any
|
||||
>15 : number
|
||||
|
||||
taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis",
|
||||
>taTitleOrientation : any
|
||||
>o.titleOrientation || (ta.title && ta.title.orientation) || "axis" : any
|
||||
>o.titleOrientation || (ta.title && ta.title.orientation) : any
|
||||
>o.titleOrientation : any
|
||||
>o : any
|
||||
>titleOrientation : any
|
||||
>(ta.title && ta.title.orientation) : any
|
||||
>ta.title && ta.title.orientation : any
|
||||
>ta.title : any
|
||||
>ta : any
|
||||
>title : any
|
||||
>ta.title.orientation : any
|
||||
>ta.title : any
|
||||
>ta : any
|
||||
>title : any
|
||||
>orientation : any
|
||||
>"axis" : string
|
||||
|
||||
taMajorTick = this.chart.theme.getTick("major", o),
|
||||
>taMajorTick : any
|
||||
>this.chart.theme.getTick("major", o) : any
|
||||
>this.chart.theme.getTick : any
|
||||
>this.chart.theme : any
|
||||
>this.chart : any
|
||||
>this : any
|
||||
>chart : any
|
||||
>theme : any
|
||||
>getTick : any
|
||||
>"major" : string
|
||||
>o : any
|
||||
|
||||
taMinorTick = this.chart.theme.getTick("minor", o),
|
||||
>taMinorTick : any
|
||||
>this.chart.theme.getTick("minor", o) : any
|
||||
>this.chart.theme.getTick : any
|
||||
>this.chart.theme : any
|
||||
>this.chart : any
|
||||
>this : any
|
||||
>chart : any
|
||||
>theme : any
|
||||
>getTick : any
|
||||
>"minor" : string
|
||||
>o : any
|
||||
|
||||
taMicroTick = this.chart.theme.getTick("micro", o),
|
||||
>taMicroTick : any
|
||||
>this.chart.theme.getTick("micro", o) : any
|
||||
>this.chart.theme.getTick : any
|
||||
>this.chart.theme : any
|
||||
>this.chart : any
|
||||
>this : any
|
||||
>chart : any
|
||||
>theme : any
|
||||
>getTick : any
|
||||
>"micro" : string
|
||||
>o : any
|
||||
|
||||
taStroke = "stroke" in o ? o.stroke : ta.stroke,
|
||||
>taStroke : any
|
||||
>"stroke" in o ? o.stroke : ta.stroke : any
|
||||
>"stroke" in o : boolean
|
||||
>"stroke" : string
|
||||
>o : any
|
||||
>o.stroke : any
|
||||
>o : any
|
||||
>stroke : any
|
||||
>ta.stroke : any
|
||||
>ta : any
|
||||
>stroke : any
|
||||
|
||||
size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
|
||||
>size : any
|
||||
>taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0 : any
|
||||
>taFont : any
|
||||
>g.normalizedLength(g.splitFontString(taFont).size) : any
|
||||
>g.normalizedLength : any
|
||||
>g : any
|
||||
>normalizedLength : any
|
||||
>g.splitFontString(taFont).size : any
|
||||
>g.splitFontString(taFont) : any
|
||||
>g.splitFontString : any
|
||||
>g : any
|
||||
>splitFontString : any
|
||||
>taFont : any
|
||||
>size : any
|
||||
>0 : number
|
||||
|
||||
cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
|
||||
>cosr : number
|
||||
>Math.abs(Math.cos(rotation * Math.PI / 180)) : number
|
||||
>Math.abs : (x: number) => number
|
||||
>Math : Math
|
||||
>abs : (x: number) => number
|
||||
>Math.cos(rotation * Math.PI / 180) : number
|
||||
>Math.cos : (x: number) => number
|
||||
>Math : Math
|
||||
>cos : (x: number) => number
|
||||
>rotation * Math.PI / 180 : number
|
||||
>rotation * Math.PI : number
|
||||
>rotation : number
|
||||
>Math.PI : number
|
||||
>Math : Math
|
||||
>PI : number
|
||||
>180 : number
|
||||
|
||||
sinr = Math.abs(Math.sin(rotation * Math.PI / 180)),
|
||||
>sinr : number
|
||||
>Math.abs(Math.sin(rotation * Math.PI / 180)) : number
|
||||
>Math.abs : (x: number) => number
|
||||
>Math : Math
|
||||
>abs : (x: number) => number
|
||||
>Math.sin(rotation * Math.PI / 180) : number
|
||||
>Math.sin : (x: number) => number
|
||||
>Math : Math
|
||||
>sin : (x: number) => number
|
||||
>rotation * Math.PI / 180 : number
|
||||
>rotation * Math.PI : number
|
||||
>rotation : number
|
||||
>Math.PI : number
|
||||
>Math : Math
|
||||
>PI : number
|
||||
>180 : number
|
||||
|
||||
tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
|
||||
>tsize : any
|
||||
>taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0 : any
|
||||
>taTitleFont : any
|
||||
>g.normalizedLength(g.splitFontString(taTitleFont).size) : any
|
||||
>g.normalizedLength : any
|
||||
>g : any
|
||||
>normalizedLength : any
|
||||
>g.splitFontString(taTitleFont).size : any
|
||||
>g.splitFontString(taTitleFont) : any
|
||||
>g.splitFontString : any
|
||||
>g : any
|
||||
>splitFontString : any
|
||||
>taTitleFont : any
|
||||
>size : any
|
||||
>0 : number
|
||||
|
||||
if (rotation < 0) {
|
||||
>rotation < 0 : boolean
|
||||
>rotation : number
|
||||
>0 : number
|
||||
|
||||
rotation += 360;
|
||||
>rotation += 360 : number
|
||||
>rotation : number
|
||||
>360 : number
|
||||
}
|
||||
var cachedLabelW = this._getMaxLabelSize();
|
||||
>cachedLabelW : any
|
||||
>this._getMaxLabelSize() : any
|
||||
>this._getMaxLabelSize : any
|
||||
>this : any
|
||||
>_getMaxLabelSize : any
|
||||
|
||||
cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;
|
||||
>cachedLabelW = cachedLabelW && cachedLabelW.majLabelW : any
|
||||
>cachedLabelW : any
|
||||
>cachedLabelW && cachedLabelW.majLabelW : any
|
||||
>cachedLabelW : any
|
||||
>cachedLabelW.majLabelW : any
|
||||
>cachedLabelW : any
|
||||
>majLabelW : any
|
||||
|
||||
titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0,
|
||||
>titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) + tsize + taTitleGap : any
|
||||
>titleOffset : any
|
||||
>size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) + tsize + taTitleGap : any
|
||||
>size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) + tsize : any
|
||||
>size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) : any
|
||||
>size * cosr + (cachedLabelW || 0) * sinr + labelGap : any
|
||||
>size * cosr + (cachedLabelW || 0) * sinr : number
|
||||
>size * cosr : number
|
||||
>size : any
|
||||
>cosr : number
|
||||
>(cachedLabelW || 0) * sinr : number
|
||||
>(cachedLabelW || 0) : any
|
||||
>cachedLabelW || 0 : any
|
||||
>cachedLabelW : any
|
||||
>0 : number
|
||||
>sinr : number
|
||||
>labelGap : any
|
||||
>Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) : number
|
||||
>Math.max : (...values: number[]) => number
|
||||
>Math : Math
|
||||
>max : (...values: number[]) => number
|
||||
>taMajorTick.length > 0 ? taMajorTick.length : 0 : any
|
||||
>taMajorTick.length > 0 : boolean
|
||||
>taMajorTick.length : any
|
||||
>taMajorTick : any
|
||||
>length : any
|
||||
>0 : number
|
||||
>taMajorTick.length : any
|
||||
>taMajorTick : any
|
||||
>length : any
|
||||
>0 : number
|
||||
|
||||
taMinorTick.length > 0 ? taMinorTick.length : 0) +
|
||||
>taMinorTick.length > 0 ? taMinorTick.length : 0 : any
|
||||
>taMinorTick.length > 0 : boolean
|
||||
>taMinorTick.length : any
|
||||
>taMinorTick : any
|
||||
>length : any
|
||||
>0 : number
|
||||
>taMinorTick.length : any
|
||||
>taMinorTick : any
|
||||
>length : any
|
||||
>0 : number
|
||||
|
||||
tsize + taTitleGap;
|
||||
>tsize : any
|
||||
>taTitleGap : any
|
||||
|
||||
axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring
|
||||
>axisVector = { x: isRtl ? -1 : 1, y: 0 } : { x: number; y: number; }
|
||||
>axisVector : any
|
||||
>{ x: isRtl ? -1 : 1, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>isRtl ? -1 : 1 : number
|
||||
>isRtl : any
|
||||
>-1 : number
|
||||
>1 : number
|
||||
>1 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
|
||||
switch (rotation) {
|
||||
>rotation : number
|
||||
|
||||
default:
|
||||
if (rotation < (90 - centerAnchorLimit)) {
|
||||
>rotation < (90 - centerAnchorLimit) : boolean
|
||||
>rotation : number
|
||||
>(90 - centerAnchorLimit) : number
|
||||
>90 - centerAnchorLimit : number
|
||||
>90 : number
|
||||
>centerAnchorLimit : any
|
||||
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
>labelOffset.y = leftBottom ? size : 0 : any
|
||||
>labelOffset.y : any
|
||||
>labelOffset : any
|
||||
>y : any
|
||||
>leftBottom ? size : 0 : any
|
||||
>leftBottom : boolean
|
||||
>size : any
|
||||
>0 : number
|
||||
|
||||
} else if (rotation < (90 + centerAnchorLimit)) {
|
||||
>rotation < (90 + centerAnchorLimit) : boolean
|
||||
>rotation : number
|
||||
>(90 + centerAnchorLimit) : any
|
||||
>90 + centerAnchorLimit : any
|
||||
>90 : number
|
||||
>centerAnchorLimit : any
|
||||
|
||||
labelOffset.x = -size * 0.4;
|
||||
>labelOffset.x = -size * 0.4 : number
|
||||
>labelOffset.x : any
|
||||
>labelOffset : any
|
||||
>x : any
|
||||
>-size * 0.4 : number
|
||||
>-size : number
|
||||
>size : any
|
||||
>0.4 : number
|
||||
|
||||
} else if (rotation < 180) {
|
||||
>rotation < 180 : boolean
|
||||
>rotation : number
|
||||
>180 : number
|
||||
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
>labelOffset.y = leftBottom ? 0 : -size : number
|
||||
>labelOffset.y : any
|
||||
>labelOffset : any
|
||||
>y : any
|
||||
>leftBottom ? 0 : -size : number
|
||||
>leftBottom : boolean
|
||||
>0 : number
|
||||
>-size : number
|
||||
>size : any
|
||||
|
||||
} else if (rotation < (270 - centerAnchorLimit)) {
|
||||
>rotation < (270 - centerAnchorLimit) : boolean
|
||||
>rotation : number
|
||||
>(270 - centerAnchorLimit) : number
|
||||
>270 - centerAnchorLimit : number
|
||||
>270 : number
|
||||
>centerAnchorLimit : any
|
||||
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
>labelOffset.y = leftBottom ? 0 : -size : number
|
||||
>labelOffset.y : any
|
||||
>labelOffset : any
|
||||
>y : any
|
||||
>leftBottom ? 0 : -size : number
|
||||
>leftBottom : boolean
|
||||
>0 : number
|
||||
>-size : number
|
||||
>size : any
|
||||
|
||||
} else if (rotation < (270 + centerAnchorLimit)) {
|
||||
>rotation < (270 + centerAnchorLimit) : boolean
|
||||
>rotation : number
|
||||
>(270 + centerAnchorLimit) : any
|
||||
>270 + centerAnchorLimit : any
|
||||
>270 : number
|
||||
>centerAnchorLimit : any
|
||||
|
||||
labelOffset.y = leftBottom ? size * 0.4 : 0;
|
||||
>labelOffset.y = leftBottom ? size * 0.4 : 0 : number
|
||||
>labelOffset.y : any
|
||||
>labelOffset : any
|
||||
>y : any
|
||||
>leftBottom ? size * 0.4 : 0 : number
|
||||
>leftBottom : boolean
|
||||
>size * 0.4 : number
|
||||
>size : any
|
||||
>0.4 : number
|
||||
>0 : number
|
||||
|
||||
} else {
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
>labelOffset.y = leftBottom ? size : 0 : any
|
||||
>labelOffset.y : any
|
||||
>labelOffset : any
|
||||
>y : any
|
||||
>leftBottom ? size : 0 : any
|
||||
>leftBottom : boolean
|
||||
>size : any
|
||||
>0 : number
|
||||
}
|
||||
}
|
||||
|
||||
titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
|
||||
>titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0 : number
|
||||
>titleRotation : number
|
||||
>(taTitleOrientation && taTitleOrientation == "away") ? 180 : 0 : number
|
||||
>(taTitleOrientation && taTitleOrientation == "away") : boolean
|
||||
>taTitleOrientation && taTitleOrientation == "away" : boolean
|
||||
>taTitleOrientation : any
|
||||
>taTitleOrientation == "away" : boolean
|
||||
>taTitleOrientation : any
|
||||
>"away" : string
|
||||
>180 : number
|
||||
>0 : number
|
||||
|
||||
titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
|
||||
>titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize) : any
|
||||
>titlePos.y : any
|
||||
>titlePos : any
|
||||
>y : any
|
||||
>offsets.t - titleOffset + (titleRotation ? 0 : tsize) : any
|
||||
>offsets.t - titleOffset : number
|
||||
>offsets.t : any
|
||||
>offsets : any
|
||||
>t : any
|
||||
>titleOffset : any
|
||||
>(titleRotation ? 0 : tsize) : any
|
||||
>titleRotation ? 0 : tsize : any
|
||||
>titleRotation : number
|
||||
>0 : number
|
||||
>tsize : any
|
||||
|
||||
switch (labelAlign) {
|
||||
>labelAlign : any
|
||||
|
||||
case "start":
|
||||
>"start" : string
|
||||
|
||||
labelAlign = "end";
|
||||
>labelAlign = "end" : string
|
||||
>labelAlign : any
|
||||
>"end" : string
|
||||
|
||||
break;
|
||||
case "end":
|
||||
>"end" : string
|
||||
|
||||
labelAlign = "start";
|
||||
>labelAlign = "start" : string
|
||||
>labelAlign : any
|
||||
>"start" : string
|
||||
|
||||
break;
|
||||
case "middle":
|
||||
>"middle" : string
|
||||
|
||||
labelOffset.y -= size;
|
||||
>labelOffset.y -= size : number
|
||||
>labelOffset.y : any
|
||||
>labelOffset : any
|
||||
>y : any
|
||||
>size : any
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
let _ = rotation;
|
||||
>_ : number
|
||||
>rotation : number
|
||||
}
|
||||
|
68
tests/cases/compiler/controlFlowCaching.ts
Normal file
68
tests/cases/compiler/controlFlowCaching.ts
Normal file
|
@ -0,0 +1,68 @@
|
|||
// @strictNullChecks: true
|
||||
|
||||
// Repro for #8401
|
||||
|
||||
function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {
|
||||
var isRtl = this._isRtl(); // chart mirroring
|
||||
// prepare variable
|
||||
var o = this.opt, ta = this.chart.theme.axis, position = o.position,
|
||||
leftBottom = position !== "rightOrTop", rotation = o.rotation % 360,
|
||||
start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign,
|
||||
labelGap = this.chart.theme.axis.tick.labelGap,
|
||||
taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
|
||||
taTitleFont = o.titleFont || (ta.title && ta.title.font),
|
||||
taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black",
|
||||
taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black",
|
||||
taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15,
|
||||
taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis",
|
||||
taMajorTick = this.chart.theme.getTick("major", o),
|
||||
taMinorTick = this.chart.theme.getTick("minor", o),
|
||||
taMicroTick = this.chart.theme.getTick("micro", o),
|
||||
|
||||
taStroke = "stroke" in o ? o.stroke : ta.stroke,
|
||||
size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
|
||||
cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
|
||||
sinr = Math.abs(Math.sin(rotation * Math.PI / 180)),
|
||||
tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
|
||||
if (rotation < 0) {
|
||||
rotation += 360;
|
||||
}
|
||||
var cachedLabelW = this._getMaxLabelSize();
|
||||
cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;
|
||||
titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0,
|
||||
taMinorTick.length > 0 ? taMinorTick.length : 0) +
|
||||
tsize + taTitleGap;
|
||||
axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring
|
||||
switch (rotation) {
|
||||
default:
|
||||
if (rotation < (90 - centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
} else if (rotation < (90 + centerAnchorLimit)) {
|
||||
labelOffset.x = -size * 0.4;
|
||||
} else if (rotation < 180) {
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
} else if (rotation < (270 - centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? 0 : -size;
|
||||
} else if (rotation < (270 + centerAnchorLimit)) {
|
||||
labelOffset.y = leftBottom ? size * 0.4 : 0;
|
||||
} else {
|
||||
labelOffset.y = leftBottom ? size : 0;
|
||||
}
|
||||
}
|
||||
|
||||
titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
|
||||
titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
|
||||
switch (labelAlign) {
|
||||
case "start":
|
||||
labelAlign = "end";
|
||||
break;
|
||||
case "end":
|
||||
labelAlign = "start";
|
||||
break;
|
||||
case "middle":
|
||||
labelOffset.y -= size;
|
||||
break;
|
||||
}
|
||||
|
||||
let _ = rotation;
|
||||
}
|
Loading…
Reference in a new issue