private void setMeasureExp ( TypeCheckInfo question , SFunctionDefinitionBase node , Environment base , Environment local , NameScope scope ) throws AnalysisException { PType actual = node . getMeasure ( ) . apply ( THIS , question . newInfo ( local ) ) ; node . setMeasureName ( node . getName ( ) . getMeasureName ( node . getName ( ) . getLocation ( ) ) ) ; checkMeasure ( question , node , node . getMeasureName ( ) , actual ) ; List < List < PPattern > > cpll = new Vector < List < PPattern > > ( ) ; boolean isCurried ; if ( node instanceof AExplicitFunctionDefinition ) { // Concatenate the parameter patterns into one list for curried measures List < PPattern > all = new Vector < PPattern > ( ) ; AExplicitFunctionDefinition ex = ( AExplicitFunctionDefinition ) node ; for ( List < PPattern > pl : ex . getParamPatternList ( ) ) { for ( PPattern p : pl ) { all . add ( p . clone ( ) ) ; } } cpll . add ( all ) ; isCurried = ex . getIsCurried ( ) ; } else { List < PPattern > all = new Vector < PPattern > ( ) ; AImplicitFunctionDefinition imp = ( AImplicitFunctionDefinition ) node ; for ( APatternListTypePair ptp : imp . getParamPatterns ( ) ) { for ( PPattern p : ptp . getPatterns ( ) ) { all . add ( p . clone ( ) ) ; } } cpll . add ( all ) ; isCurried = false ; } AFunctionType mtype = question . assistantFactory . createAFunctionTypeAssistant ( ) . getMeasureType ( ( AFunctionType ) node . getType ( ) , isCurried , actual ) ; AExplicitFunctionDefinition def = AstFactory . newAExplicitFunctionDefinition ( node . getMeasureName ( ) , scope , ( List < ILexNameToken > ) node . getTypeParams ( ) . clone ( ) , mtype , cpll , node . getMeasure ( ) , null , null , false , null ) ; def . setClassDefinition ( node . getClassDefinition ( ) == null ? null : node . getClassDefinition ( ) . clone ( ) ) ; def . setAccess ( node . getAccess ( ) . clone ( ) ) ; question . assistantFactory . createPDefinitionAssistant ( ) . typeResolve ( def , THIS , question ) ; def . apply ( THIS , question ) ; node . setMeasureDef ( def ) ; }
Set measureDef to a newly created function based on the measure expression .