(node *ast.Node, checkMode CheckMode)
| 7492 | } |
| 7493 | |
| 7494 | func (c *Checker) checkExpressionCachedEx(node *ast.Node, checkMode CheckMode) *Type { |
| 7495 | if checkMode != CheckModeNormal { |
| 7496 | return c.checkExpressionEx(node, checkMode) |
| 7497 | } |
| 7498 | links := c.typeNodeLinks.Get(node) |
| 7499 | if links.resolvedType == nil { |
| 7500 | // When computing a type that we're going to cache, we need to ignore any ongoing control flow |
| 7501 | // analysis because variables may have transient types in indeterminable states. Moving flowLoopStart |
| 7502 | // to the top of the stack ensures all transient types are computed from a known point. |
| 7503 | saveFlowLoopStack := c.flowLoopStack |
| 7504 | saveFlowTypeCache := c.flowTypeCache |
| 7505 | c.flowLoopStack = nil |
| 7506 | c.flowTypeCache = nil |
| 7507 | links.resolvedType = c.checkExpressionEx(node, checkMode) |
| 7508 | c.flowTypeCache = saveFlowTypeCache |
| 7509 | c.flowLoopStack = saveFlowLoopStack |
| 7510 | } |
| 7511 | return links.resolvedType |
| 7512 | } |
| 7513 | |
| 7514 | // Returns the type of an expression. Unlike checkExpression, this function is simply concerned |
| 7515 | // with computing the type and may not fully check all contained sub-expressions for errors. |
no test coverage detected