protected override void VisitCastDefinitionSyntax(CastDefinitionSyntax pNode) { _locals.AddScope(); _methodReturns = SyntaxHelper.SelectNodeTypes(pNode.ReturnValues); base.VisitCastDefinitionSyntax(pNode); _locals.RemoveScope(); }
protected override void VisitCastDefinitionSyntax(CastDefinitionSyntax pNode) { using (var rf = Store.AddValue("ReturnFound", false)) { using (var rvc = Store.AddValue("ReturnValueCount", pNode.ReturnValues.Count)) { base.VisitCastDefinitionSyntax(pNode); if (pNode.ReturnValues.Count != 0 && !rf.Value) { CompilerErrors.MethodReturnPaths(pNode, pNode.Span); } else if (pNode.ReturnValues.Count == 0 && rf.Value) { CompilerErrors.MethodNoReturn(pNode, pNode.Span); } } } }
private bool IsCalledCast(CastDefinitionSyntax pMethod, CastSyntax pCall) { return(pMethod.Parameters[0].Type == pCall.FromType && pMethod.ReturnValues[0].Type == pCall.Type); }
protected virtual void VisitCastDefinitionSyntax(CastDefinitionSyntax pNode) { Visit(pNode.Parameters[0]); Visit(pNode.ReturnValues[0]); Visit(pNode.Body); }
protected virtual SyntaxNode VisitCastDefinitionSyntax(CastDefinitionSyntax pNode) { return(SyntaxFactory.CastDefinition(pNode.Scope, (TypedIdentifierSyntax)Visit(pNode.Parameters[0]), (BlockSyntax)Visit(pNode.Body), (TypeSyntax)Visit(pNode.ReturnValues[0]))); }
protected override void VisitCastDefinitionSyntax(CastDefinitionSyntax pNode) { _methodReturns = new SmallType[] { pNode.Type }; base.VisitCastDefinitionSyntax(pNode); }