File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -761,8 +761,15 @@ public IScriptExtent GetScriptExtentForFunctionName(FunctionDefinitionAst functi
761761 token =>
762762 ContainsExtent ( functionDefinitionAst . Extent , token . Extent )
763763 && token . Text . Equals ( functionDefinitionAst . Name ) ) ;
764- var funcNameToken = funcNameTokens . FirstOrDefault ( ) ;
765- return funcNameToken == null ? null : funcNameToken . Extent ;
764+
765+ // If the functions name is 'function' then the first token in the
766+ // list is the function keyword itself, so we need to skip it
767+ if ( functionDefinitionAst . Name . Equals ( "function" ) )
768+ {
769+ var funcNameToken = funcNameTokens . Skip ( 1 ) . FirstOrDefault ( ) ?? funcNameTokens . FirstOrDefault ( ) ;
770+ return funcNameToken ? . Extent ;
771+ }
772+ return funcNameTokens . FirstOrDefault ( ) ? . Extent ;
766773 }
767774
768775 /// <summary>
You can’t perform that action at this time.
0 commit comments