mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-27 03:12:44 +03:00
Added optimization for slice expression evaluation. It can be skipped in cases where the we are speculatively evaluating the type.
This commit is contained in:
parent
eeab5b127c
commit
5fffd5bbcf
@ -13002,17 +13002,20 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
}
|
||||
|
||||
function getTypeOfSlice(node: SliceNode): TypeResult {
|
||||
// Evaluate the expressions to report errors and record symbol references.
|
||||
if (node.startValue) {
|
||||
getTypeOfExpression(node.startValue);
|
||||
}
|
||||
// Evaluate the expressions to report errors and record symbol
|
||||
// references. We can skip this if we're executing speculatively.
|
||||
if (!speculativeTypeTracker.isSpeculative(node)) {
|
||||
if (node.startValue) {
|
||||
getTypeOfExpression(node.startValue);
|
||||
}
|
||||
|
||||
if (node.endValue) {
|
||||
getTypeOfExpression(node.endValue);
|
||||
}
|
||||
if (node.endValue) {
|
||||
getTypeOfExpression(node.endValue);
|
||||
}
|
||||
|
||||
if (node.stepValue) {
|
||||
getTypeOfExpression(node.stepValue);
|
||||
if (node.stepValue) {
|
||||
getTypeOfExpression(node.stepValue);
|
||||
}
|
||||
}
|
||||
|
||||
return { type: getBuiltInObject(node, 'slice'), node };
|
||||
|
Loading…
Reference in New Issue
Block a user