@@ -227,6 +227,7 @@ SyntaxAnalysis.prototype.AnalyseModule = function (sourceCode, initValueTable, t
227227 {
228228 if ( state == stInProc ) Meth . EndLine = i ;
229229 state = stInModule ;
230+ moduleContext . save ( Meth ) ;
230231 }
231232 else if ( ( Matches = this . RE_VARS_DEF . exec ( str ) ) != null )
232233 {
@@ -271,14 +272,15 @@ SyntaxAnalysis.prototype.AnalyseModule = function (sourceCode, initValueTable, t
271272 if ( addToCalls ) {
272273 if ( Meth . Calls . indexOf ( Matches [ 1 ] ) >= 0 ) continue ;
273274 Meth . Calls . push ( Matches [ 1 ] ) ;
275+ Meth . CallsPosition . push ( { "call" : Matches [ 1 ] , "line" : i , "character" : Matches . index } ) ;
274276
275277 }
276278
277279 //Сделаем поиск по общим модулям или под документам, вдруг там у нас статический вызов.
278280 //var mdRef = metadata.current.rootObject.childObject("Справочники", "Номенклатура")
279281 }
280282 if ( Meth . Calls . indexOf ( Matches [ 1 ] ) >= 0 ) continue ;
281- Meth . Calls . push ( Matches [ 1 ] ) ;
283+ Meth . CallsPosition . push ( { "call" : Matches [ 1 ] , "line" : i , "character" : Matches . index } ) ;
282284 }
283285 }
284286 }
@@ -316,11 +318,10 @@ function _1CModule(sourceText) {
316318}
317319
318320/* Возвращает исходный код метода по названию метода. */
319- _1CModule . prototype . getMethodSource = function ( methodName ) {
320- throw ( "Not implement" ) ;
321+ _1CModule . prototype . getMethod = function ( methodName ) {
321322 var method = this . context . getMethodByName ( methodName ) ;
322323 if ( ! method ) return undefined ;
323- return this . textWindow . Range ( method . StartLine + 1 , 1 , method . EndLine + 1 ) . GetText ( ) ;
324+ return method ;
324325}
325326
326327/* Возвращает таблицу значений с описаниями методов модуля. */
@@ -419,19 +420,24 @@ _1CModuleContextDescription.prototype.addMethod = function (method) {
419420 this . _methodsByName [ method . Name ] = method ;
420421
421422 // Добавляем метод в таблицу значений.
422- if ( this . _vtAllMethods )
423- {
424- var methRow = this . NewString ( ) ;
425- methRow . name = method . Name ;
426- methRow . isproc = method . IsProc ;
427- methRow . line = method . StartLine ;
428- methRow . endline = method . EndLine ;
429- methRow . context = method . Context ;
430- methRow . isexport = method . IsExport ;
431- methRow . description = method . description ;
432- methRow . _method = method ;
433-
434- this . _vtAllMethods . insert ( methRow ) ;
423+
424+ }
425+
426+ _1CModuleContextDescription . prototype . save = function ( method ) {
427+ if ( this . _vtAllMethods ) {
428+ if ( this . _vtAllMethods ) {
429+ var methRow = this . NewString ( ) ;
430+ methRow . name = method . Name ;
431+ methRow . isproc = method . IsProc ;
432+ methRow . line = method . StartLine ;
433+ methRow . endline = method . EndLine ;
434+ methRow . context = method . Context ;
435+ methRow . isexport = method . IsExport ;
436+ methRow . description = method . description ;
437+ methRow . _method = method ;
438+
439+ this . _vtAllMethods . insert ( methRow ) ;
440+ }
435441 }
436442}
437443
@@ -475,6 +481,7 @@ function _1CMethodDescription(parentModule) {
475481
476482 // Список вызовов: массив методов, вызываемых из данного метода.
477483 this . Calls = new Array ( ) ;
484+ this . CallsPosition = new Array ( ) ;
478485
479486 // Номер строки объявления метода.
480487 this . StartLine = 0 ;
0 commit comments