@@ -473,7 +473,6 @@ If your provide 0 for COUNT then the entire regex match is returned."
473473 (let ((pos 0 )
474474 matches)
475475 (while (string-match regexp string pos)
476- (message " GOT MATCH " )
477476 (push (match-string count string) matches)
478477 (setq pos (match-end 0 )))
479478 matches)))
@@ -484,28 +483,35 @@ EVENT is isgnored."
484483 (when (memq (process-status process) '(signal exit))
485484 (let* ((buffer (process-buffer process))
486485 (funcname (process-get process 'solidity-gasestimate-for-function ))
486+ (filename (process-get process 'solidity-gasestimate-for-filename ))
487487 (output (with-current-buffer buffer (buffer-string )))
488488 (matches (solidity--re-matches (format " %s (.*?):.*?\\ ([0-9]+\\ |infinite\\ )" funcname) output 1 ))
489489 (result (car matches)))
490490 (kill-buffer buffer)
491491 (if result
492- (message " Gas for '%s ' is %s " funcname result)
493- (message " No gas estimate found for '%s ' " funcname)))))
492+ (let* ((clearfilename (file-name-nondirectory filename))
493+ (ctor-matches (solidity--re-matches (format " =.*?%s :%s .*?= " clearfilename funcname) output 0 )))
494+ (if ctor-matches
495+ (message " Gas for '%s ' constructor is %s " funcname (car (solidity--re-matches " construction:
496+ .*?=.*?\\ ([0-9]+\\ |infinite\\ )" output 1 )))
497+ (message " No gas estimate found for '%s ' " funcname)))))))
494498
495499
496500(defun solidity--start-gasestimate (func )
497501 " Start a gas estimation subprocess for FUNC.
498502
499503Does not currently work for constructors."
500- (let* ((command (format " %s --gas %s " solidity-solc-path (buffer-file-name )))
504+ (let* ((filename (buffer-file-name ))
505+ (command (format " %s --gas %s " solidity-solc-path filename))
501506 (process-name (format " solidity-command-%s " command))
502507 (process (start-process-shell-command
503508 process-name
504509 (format " *%s * " process-name)
505510 command)))
506511 (set-process-query-on-exit-flag process nil )
507512 (set-process-sentinel process 'solidity--handle-gasestimate-finish )
508- (process-put process 'solidity-gasestimate-for-function func)))
513+ (process-put process 'solidity-gasestimate-for-function func)
514+ (process-put process 'solidity-gasestimate-for-filename filename)))
509515
510516(defun solidity-estimate-gas-at-point ()
511517 " Estimate gas of the function at point.
0 commit comments