protected PType typeCheckLet ( INode node , LinkedList < PDefinition > localDefs , INode body , TypeCheckInfo question ) throws AnalysisException { // Each local definition is in scope for later local definitions... Environment local = question . env ; for ( PDefinition d : localDefs ) { if ( d instanceof AExplicitFunctionDefinition ) { // Functions' names are in scope in their bodies, whereas // simple variable declarations aren't local = new FlatCheckedEnvironment ( question . assistantFactory , d , local , question . scope ) ; // cumulative question . assistantFactory . createPDefinitionAssistant ( ) . implicitDefinitions ( d , local ) ; question . assistantFactory . createPDefinitionAssistant ( ) . typeResolve ( d , THIS , new TypeCheckInfo ( question . assistantFactory , local , question . scope , question . qualifiers ) ) ; if ( question . env . isVDMPP ( ) ) { SClassDefinition cdef = question . env . findClassDefinition ( ) ; // question.assistantFactory.createPDefinitionAssistant().setClassDefinition(d, cdef); d . setClassDefinition ( cdef ) ; d . setAccess ( question . assistantFactory . createPAccessSpecifierAssistant ( ) . getStatic ( d , true ) ) ; } d . apply ( THIS , new TypeCheckInfo ( question . assistantFactory , local , question . scope , question . qualifiers ) ) ; } else { question . assistantFactory . createPDefinitionAssistant ( ) . implicitDefinitions ( d , local ) ; question . assistantFactory . createPDefinitionAssistant ( ) . typeResolve ( d , THIS , new TypeCheckInfo ( question . assistantFactory , local , question . scope , question . qualifiers ) ) ; d . apply ( THIS , new TypeCheckInfo ( question . assistantFactory , local , question . scope ) ) ; local = new FlatCheckedEnvironment ( question . assistantFactory , d , local , question . scope ) ; // cumulative } } PType r = body . apply ( THIS , new TypeCheckInfo ( question . assistantFactory , local , question . scope , null , question . constraint , null ) ) ; local . unusedCheck ( question . env ) ; return r ; }
Type checks a let node