GIF89a=( õ' 7IAXKgNgYvYx\%wh…hŽth%ˆs%—x¨}9®Œ©€&©‰%¶†(¹–.¹5·œD¹&Çš)ÇŸ5ǘ;Í£*È¡&Õ²)ׯ7×µ<Ñ»4ï°3ø‘HÖ§KͯT÷¨Yÿšqÿ»qÿÔFØ !ù ' !ÿ NETSCAPE2.0 , =( þÀ“pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§gª«ªE¯°¨¬ª±²Œ¹º¹E¾­”´ÂB¶¯ §Åȸ»ÑD¾¿Á•ÄÅ®° ÝH¾ÒLÀÆDÙ«D¶BÝïðÀ¾DÑÑÔTÌÍíH òGö¨A RÎڐ |¥ ٭&ºìE8œ¹kGÔAÞpx­a¶­ã R2XB®åE8I€Õ6Xî:vT)äžþÀq¦è³¥ì仕F~%xñ  4#ZÔ‰O|-4Bs‘X:= QÉ œš lºÒyXJŠGȦ|s hÏíK–3l7·B|¥$'7Jީܪ‰‡àá”Dæn=Pƒ ¤Òëí‰`䌨ljóá¯Éüv>á–Á¼5 ½.69ûϸd«­ºÀûnlv©‹ªîf{¬ÜãPbŸ  l5‘ޝpß ´ ˜3aÅùäI«O’ý·‘áÞ‡˜¾Æ‚ÙÏiÇÿ‹Àƒ #öó)pâš Þ½ ‘Ý{ó)vmÞü%D~ 6f s}ŃƒDØW Eþ`‡þ À…L8xá†ç˜{)x`X/> Ì}mø‚–RØ‘*|`D=‚Ø_ ^ð5 !_…'aä“OÚ—7âcð`D”Cx`ÝÂ¥ä‹éY¹—F¼¤¥Š?¡Õ™ n@`} lď’ÄÉ@4>ñd œ à‘vÒxNÃ×™@žd=ˆgsžG±æ ´²æud &p8Qñ)ˆ«lXD©øÜéAžHìySun jª×k*D¤LH] †¦§C™Jä–´Xb~ʪwStŽ6K,°£qÁœ:9ت:¨þªl¨@¡`‚ûÚ ».Û¬¯t‹ÆSÉ[:°=Š‹„‘Nåû”Ìî{¿ÂA ‡Rà›ÀÙ6úë°Ÿð0Ä_ ½;ÃϱîÉì^ÇÛÇ#Ëë¼ôº!±Ä˜íUîÅÇ;0L1óÁµö«p% AÀºU̬ݵ¼á%霼€‡¯Á~`ÏG¯»À× ­²± =4ªnpð3¾¤³¯­ü¾¦îuÙuµÙ®|%2ÊIÿür¦#0·ÔJ``8È@S@5ê¢ ö×Þ^`8EÜ]ý.뜃Âç 7 ú ȉÞj œ½Dç zý¸iþœÑÙûÄë!ˆÞÀl§Ïw‹*DçI€nEX¯¬¼ &A¬Go¼QföõFç°¯;é¦÷îŽêJ°îúôF5¡ÌQ|îúöXªæ»TÁÏyñêï]ê² o óÎC=öõ›ÒÓPB@ D×½œä(>èCÂxŽ`±«Ÿ–JЀ»Û á¤±p+eE0`ëŽ`A Ú/NE€Ø†À9‚@¤à H½7”à‡%B‰`Àl*ƒó‘–‡8 2ñ%¸ —€:Ù1Á‰E¸àux%nP1ð!‘ðC)¾P81lÑɸF#ˆ€{´âé°ÈB„0>±û °b¡Š´±O‚3È–Ù()yRpbµ¨E.Z‘D8ÊH@% òŒx+%Ù˜Æcü »¸˜fõ¬b·d`Fê™8èXH"ÉÈ-±|1Ô6iI, 2““¬$+](A*jÐ QTÂo‰.ÛU슬Œã„Ž`¯SN¡–¶Äåyše¯ª’­¬‚´b¦Éož œ)åyâ@Ì®3 ÎtT̉°&Ø+žLÀf"Ø-|žçÔ>‡Ðv¦Ðžì\‚ Q1)Ž@Žh#aP72”ˆ™¨$‚ !ù " , =( …7IAXG]KgNgYvYxR"k\%w]'}hŽth%ˆg+ˆs%—r.—m3šx3˜x¨}9®€&©€+¨‡7§‰%¶†(¹–.¹œD¹&ǘ;Í•&ײ)×»4ïÌ6ò§KÍ þ@‘pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§g «¬ E ±± ¨­¶°ººE Á´”·®C¬²§Ç¶Œ»ÓDÃÕƷ¯Ê±H½ºM×ÁGÚ¬D¶BËÁ½î½DÓôTÏÛßîG»ôõC×CÌ l&âž:'òtU³6ɹ#·Ø)€'Ü.6±&ëÍÈ» K(8p0N?!æ2"ÛˆNIJX>R¼ÐO‚M '¡¨2¸*Ÿþ>#n↠å@‚<[:¡Iïf’ ¤TÚ˘CdbÜÙ“[«ŽEú5MBo¤×@€`@„€Êt W-3 ¶Ÿ¡BíêäjIÝ…Eò9[T…$íêﯧ„…•s»Óȳ¹€ÅÚdc®UUρ#±Ùïldj?´í¼²`\ŽÁðÞu|3'ÖŒ]ë6 ¶S#²‡˜FKLÈ *N E´‘áäŠ$˜›eÄYD„ºq«.è촁ƒs \-ÔjA 9²õ÷å- üúM[Âx(ís÷ì®x€|í¡Ù’p¦‚ ŽkÛTÇDpE@WÜ ²Ç]kŠ1¨ þ€·Yb ÓÁ‰l°*n0 ç™—žzBdОu¾7ĉBl€â‰-ºx~|UåU‰  h*Hœ|e"#"?vpÄiŠe6^ˆ„+qâŠm8 #VÇá ‘å–ÄV„œ|Аè•m"сœn|@›U¶ÆÎž—Špb¥G¨ED”€±Úê2FÌIç? >Éxå Œ± ¡¤„%‘žjŸ‘ꄯ<Ìaà9ijÐ2˜D¦È&›†Z`‚å]wþ¼Â:ç6àB¤7eFJ|õÒ§Õ,¨äàFÇ®cS·Ê¶+B°,‘Þ˜ºNûãØ>PADÌHD¹æž«ÄÀnÌ¥}­#Ë’ë QÀÉSÌÂÇ2ÌXÀ{æk²lQÁ2«ÊðÀ¯w|2Í h‹ÄÂG€,m¾¶ë3ÐÙ6-´ÅE¬L°ÆIij*K½ÀÇqï`DwVÍQXœÚÔpeœ±¬Ñ q˜§Tœ½µƒ°Œìu Â<¶aØ*At¯lmEØ ü ôÛN[P1ÔÛ¦­±$ÜÆ@`ùåDpy¶yXvCAyåB`ŽD¶ 0QwG#¯ æš[^Äþ $ÀÓÝǦ{„L™[±úKÄgÌ;ï£S~¹ìGX.ôgoT.»åˆ°ùŸûù¡?1zö¦Ÿž:ÅgÁ|ìL¹ „®£œŠ‚à0œ]PÁ^p F<"•ç?!,ñ‡N4—…PÄ Á„ö¨Û:Tè@hÀ‹%táÿ:ø-žI<`þ‹p I….)^ 40D#p@ƒj4–؀:²‰1Øâr˜¼F2oW¼#Z†;$Q q” ‘ ÂK¦ñNl#29 !’F@¥Bh·ᏀL!—XFóLH‘Kh¤.«hE&JòG¨¥<™WN!€ÑÙÚˆY„@†>Œž19J" 2,/ &.GXB%ÌRÈ9B6¹W]’î×ÔW¥’IÎ$ ñ‹ÓŒE8YÆ ¼³™ñA5“à®Q.aŸB€&Ø©³ JÁ—! ¦t)K%tœ-¦JF bòNMxLôþ)ÐR¸Ð™‘ èÝ6‘O!THÌ„HÛ ‰ !ù ) , =( …AXKgNgYvYxR"k\%wh…hŽh%ˆg+ˆs%—r.—x3˜x¨}9®€&©€+¨Œ,©‡7§‰%¶†(¹–.¹5·&Çš)ǘ;Í•&×£*Ȳ)ׯ7×»4ï°3øÌ6ò‘HÖ§KÍ»Hó¯T÷¨Yÿ»qÿÇhÿ þÀ”pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§g ª« E$±²¨ª­ · °²½$E$ÂÕ««D· Í ¿¦Ç¶¸ÌŒ¾³CÃÅÆ E ééH½MÛÂGâªD­ çBêêϾD²ÒaÀà€Š1r­ðÓ¤ ÔožzU!L˜C'¾yW½UGtäÇïÙllê0×àÂuGþ)AÀs[þ·xì ÁxO%ƒûX2ó—  P£n›R/¡ÑšHše+êDm?# —‘Ç£6¡8íJ¡ŸâDiäªM¥Ö„ôj“¬¹£5oQ7°- <‡ *´lãÓŒ2r/a!l)dÈ A™ÈE¢ôÔ͆…ð ;Ö˜c ¡%ß‚’Ùˆâ¸b½—pe~C"BíëÚHïeF2§æŠ8qb t_`urŠeü wÅu3êæPv§h•"ß`íÍxçLĹÜÖ3á  ~Öº“®›¸ÏMDfJÙ °„ÛµáWõ%§œ‚à©–‚X ÓØ)@®Ñ›Eþ´wëuÅSxb8y\mÖzœ¥§ZbºE—ÂLªÌw!y(>¡™wú=Ç|ÅÝs¢d €CÁW)HÜcC$€L Ä7„r.á\{)@ð` @ äXÈ$PD” `šaG:§æˆOˆ72EÐamn]ù"ŒcÊxÑŒ° &dR8`g«iÙŸLR!¦P …d’ä¡“¦ðÎTƒ¦ià|À _ ¥ Qi#¦Šg›Æ ›noMµ ›V ã£)p ç£ÎW…š=Âeªk§†j„ ´®1ß²sÉxéW«jšl|0¯B0Û, \jÛ´›6±¬¶C ÛíWþï|ëÙ‹¸ñzĸV {ì;Ýñn¼òVˆm³I¼³.Ðã¤PN¥ ²µ¼„µCã+¹ÍByî£Ñ¾HŸ›ëê 7ìYÆFTk¨SaoaY$Dµœìï¿Ã29RÈkt Çïfñ ÇÒ:ÀÐSp¹3ÇI¨â¥DZÄ ü9Ïýögñ½­uÔ*3)O‘˜Ö[_hv ,àî×Et Ÿé¶BH€ Õ[ü±64M@ÔSÌM7dÐl5-ÄÙU܍´©zߌ3Ô€3ž„ „ ¶ÛPô½5×g› êÚ˜kN„Ý…0Îj4€Ìë°“#{þÕ3S2çKÜ'ợlø¼Ú2K{° {Û¶?žm𸧠ËI¼nEò='êüóºè^üæÃ_Û=°óž‚ì#Oý¿Í'¡½áo..ÏYìnüñCœO±Áa¿¢Kô½o,üÄËbö²çºíï{ËC Ú— "”Ï{ËK ÍÒw„õ±Oz dÕ¨à:$ ƒô—«v»] A#ð «€¿šéz)Rx׿ˆ¥‚d``èw-îyÏf×K!ð€þ­Ð|ìPľ„=Ì`ý(f” 'Pa ¥ÐBJa%Ðâf§„%Š¡}FàáÝ×6>ÉäŠG"éŽè=ø!oа^FP¼Ø©Q„ÀCÙÁ`(Ž\ÄÝ® ©Â$<n@dÄ E#ììUÒI! ‚#lù‹`k¦ÐÇ'Rró’ZýNBÈMF Í[¤+‹ðɈ-áwj¨¥þ8¾rá ,VÂh„"|½œ=×G_¦Ñ™EØ 0i*%̲˜Æda0mV‚k¾)›;„&6 p>ÓjK “¦Ç# âDÂ:ûc?:R Ó¬fÞéI-Ì“•Ã<ä=™Ï7˜3œ¨˜c2ŒW ,ˆ”8(T™P‰F¡Jhç"‚ ; 403WebShell
403Webshell
Server IP : 172.67.177.218  /  Your IP : 216.73.216.165
Web Server : LiteSpeed
System : Linux premium229.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User : akhalid ( 749)
PHP Version : 8.3.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/ruby34/share/ruby/prism/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/ruby34/share/ruby/prism/relocation.rb
# frozen_string_literal: true

module Prism
  # Prism parses deterministically for the same input. This provides a nice
  # property that is exposed through the #node_id API on nodes. Effectively this
  # means that for the same input, these values will remain consistent every
  # time the source is parsed. This means we can reparse the source same with a
  # #node_id value and find the exact same node again.
  #
  # The Relocation module provides an API around this property. It allows you to
  # "save" nodes and locations using a minimal amount of memory (just the
  # node_id and a field identifier) and then reify them later.
  module Relocation
    # An entry in a repository that will lazily reify its values when they are
    # first accessed.
    class Entry
      # Raised if a value that could potentially be on an entry is missing
      # because it was either not configured on the repository or it has not yet
      # been fetched.
      class MissingValueError < StandardError
      end

      # Initialize a new entry with the given repository.
      def initialize(repository)
        @repository = repository
        @values = nil
      end

      # Fetch the filepath of the value.
      def filepath
        fetch_value(:filepath)
      end

      # Fetch the start line of the value.
      def start_line
        fetch_value(:start_line)
      end

      # Fetch the end line of the value.
      def end_line
        fetch_value(:end_line)
      end

      # Fetch the start byte offset of the value.
      def start_offset
        fetch_value(:start_offset)
      end

      # Fetch the end byte offset of the value.
      def end_offset
        fetch_value(:end_offset)
      end

      # Fetch the start character offset of the value.
      def start_character_offset
        fetch_value(:start_character_offset)
      end

      # Fetch the end character offset of the value.
      def end_character_offset
        fetch_value(:end_character_offset)
      end

      # Fetch the start code units offset of the value, for the encoding that
      # was configured on the repository.
      def start_code_units_offset
        fetch_value(:start_code_units_offset)
      end

      # Fetch the end code units offset of the value, for the encoding that was
      # configured on the repository.
      def end_code_units_offset
        fetch_value(:end_code_units_offset)
      end

      # Fetch the start byte column of the value.
      def start_column
        fetch_value(:start_column)
      end

      # Fetch the end byte column of the value.
      def end_column
        fetch_value(:end_column)
      end

      # Fetch the start character column of the value.
      def start_character_column
        fetch_value(:start_character_column)
      end

      # Fetch the end character column of the value.
      def end_character_column
        fetch_value(:end_character_column)
      end

      # Fetch the start code units column of the value, for the encoding that
      # was configured on the repository.
      def start_code_units_column
        fetch_value(:start_code_units_column)
      end

      # Fetch the end code units column of the value, for the encoding that was
      # configured on the repository.
      def end_code_units_column
        fetch_value(:end_code_units_column)
      end

      # Fetch the leading comments of the value.
      def leading_comments
        fetch_value(:leading_comments)
      end

      # Fetch the trailing comments of the value.
      def trailing_comments
        fetch_value(:trailing_comments)
      end

      # Fetch the leading and trailing comments of the value.
      def comments
        leading_comments.concat(trailing_comments)
      end

      # Reify the values on this entry with the given values. This is an
      # internal-only API that is called from the repository when it is time to
      # reify the values.
      def reify!(values) # :nodoc:
        @repository = nil
        @values = values
      end

      private

      # Fetch a value from the entry, raising an error if it is missing.
      def fetch_value(name)
        values.fetch(name) do
          raise MissingValueError, "No value for #{name}, make sure the " \
            "repository has been properly configured"
        end
      end

      # Return the values from the repository, reifying them if necessary.
      def values
        @values || (@repository.reify!; @values)
      end
    end

    # Represents the source of a repository that will be reparsed.
    class Source
      # The value that will need to be reparsed.
      attr_reader :value

      # Initialize the source with the given value.
      def initialize(value)
        @value = value
      end

      # Reparse the value and return the parse result.
      def result
        raise NotImplementedError, "Subclasses must implement #result"
      end

      # Create a code units cache for the given encoding.
      def code_units_cache(encoding)
        result.code_units_cache(encoding)
      end
    end

    # A source that is represented by a file path.
    class SourceFilepath < Source
      # Reparse the file and return the parse result.
      def result
        Prism.parse_file(value)
      end
    end

    # A source that is represented by a string.
    class SourceString < Source
      # Reparse the string and return the parse result.
      def result
        Prism.parse(value)
      end
    end

    # A field that represents the file path.
    class FilepathField
      # The file path that this field represents.
      attr_reader :value

      # Initialize a new field with the given file path.
      def initialize(value)
        @value = value
      end

      # Fetch the file path.
      def fields(_value)
        { filepath: value }
      end
    end

    # A field representing the start and end lines.
    class LinesField
      # Fetches the start and end line of a value.
      def fields(value)
        { start_line: value.start_line, end_line: value.end_line }
      end
    end

    # A field representing the start and end byte offsets.
    class OffsetsField
      # Fetches the start and end byte offset of a value.
      def fields(value)
        { start_offset: value.start_offset, end_offset: value.end_offset }
      end
    end

    # A field representing the start and end character offsets.
    class CharacterOffsetsField
      # Fetches the start and end character offset of a value.
      def fields(value)
        {
          start_character_offset: value.start_character_offset,
          end_character_offset: value.end_character_offset
        }
      end
    end

    # A field representing the start and end code unit offsets.
    class CodeUnitOffsetsField
      # A pointer to the repository object that is used for lazily creating a
      # code units cache.
      attr_reader :repository

      # The associated encoding for the code units.
      attr_reader :encoding

      # Initialize a new field with the associated repository and encoding.
      def initialize(repository, encoding)
        @repository = repository
        @encoding = encoding
        @cache = nil
      end

      # Fetches the start and end code units offset of a value for a particular
      # encoding.
      def fields(value)
        {
          start_code_units_offset: value.cached_start_code_units_offset(cache),
          end_code_units_offset: value.cached_end_code_units_offset(cache)
        }
      end

      private

      # Lazily create a code units cache for the associated encoding.
      def cache
        @cache ||= repository.code_units_cache(encoding)
      end
    end

    # A field representing the start and end byte columns.
    class ColumnsField
      # Fetches the start and end byte column of a value.
      def fields(value)
        { start_column: value.start_column, end_column: value.end_column }
      end
    end

    # A field representing the start and end character columns.
    class CharacterColumnsField
      # Fetches the start and end character column of a value.
      def fields(value)
        {
          start_character_column: value.start_character_column,
          end_character_column: value.end_character_column
        }
      end
    end

    # A field representing the start and end code unit columns for a specific
    # encoding.
    class CodeUnitColumnsField
      # The repository object that is used for lazily creating a code units
      # cache.
      attr_reader :repository

      # The associated encoding for the code units.
      attr_reader :encoding

      # Initialize a new field with the associated repository and encoding.
      def initialize(repository, encoding)
        @repository = repository
        @encoding = encoding
        @cache = nil
      end

      # Fetches the start and end code units column of a value for a particular
      # encoding.
      def fields(value)
        {
          start_code_units_column: value.cached_start_code_units_column(cache),
          end_code_units_column: value.cached_end_code_units_column(cache)
        }
      end

      private

      # Lazily create a code units cache for the associated encoding.
      def cache
        @cache ||= repository.code_units_cache(encoding)
      end
    end

    # An abstract field used as the parent class of the two comments fields.
    class CommentsField
      # An object that represents a slice of a comment.
      class Comment
        # The slice of the comment.
        attr_reader :slice

        # Initialize a new comment with the given slice.
        def initialize(slice)
          @slice = slice
        end
      end

      private

      # Create comment objects from the given values.
      def comments(values)
        values.map { |value| Comment.new(value.slice) }
      end
    end

    # A field representing the leading comments.
    class LeadingCommentsField < CommentsField
      # Fetches the leading comments of a value.
      def fields(value)
        { leading_comments: comments(value.leading_comments) }
      end
    end

    # A field representing the trailing comments.
    class TrailingCommentsField < CommentsField
      # Fetches the trailing comments of a value.
      def fields(value)
        { trailing_comments: comments(value.trailing_comments) }
      end
    end

    # A repository is a configured collection of fields and a set of entries
    # that knows how to reparse a source and reify the values.
    class Repository
      # Raised when multiple fields of the same type are configured on the same
      # repository.
      class ConfigurationError < StandardError
      end

      # The source associated with this repository. This will be either a
      # SourceFilepath (the most common use case) or a SourceString.
      attr_reader :source

      # The fields that have been configured on this repository.
      attr_reader :fields

      # The entries that have been saved on this repository.
      attr_reader :entries

      # Initialize a new repository with the given source.
      def initialize(source)
        @source = source
        @fields = {}
        @entries = Hash.new { |hash, node_id| hash[node_id] = {} }
      end

      # Create a code units cache for the given encoding from the source.
      def code_units_cache(encoding)
        source.code_units_cache(encoding)
      end

      # Configure the filepath field for this repository and return self.
      def filepath
        raise ConfigurationError, "Can only specify filepath for a filepath source" unless source.is_a?(SourceFilepath)
        field(:filepath, FilepathField.new(source.value))
      end

      # Configure the lines field for this repository and return self.
      def lines
        field(:lines, LinesField.new)
      end

      # Configure the offsets field for this repository and return self.
      def offsets
        field(:offsets, OffsetsField.new)
      end

      # Configure the character offsets field for this repository and return
      # self.
      def character_offsets
        field(:character_offsets, CharacterOffsetsField.new)
      end

      # Configure the code unit offsets field for this repository for a specific
      # encoding and return self.
      def code_unit_offsets(encoding)
        field(:code_unit_offsets, CodeUnitOffsetsField.new(self, encoding))
      end

      # Configure the columns field for this repository and return self.
      def columns
        field(:columns, ColumnsField.new)
      end

      # Configure the character columns field for this repository and return
      # self.
      def character_columns
        field(:character_columns, CharacterColumnsField.new)
      end

      # Configure the code unit columns field for this repository for a specific
      # encoding and return self.
      def code_unit_columns(encoding)
        field(:code_unit_columns, CodeUnitColumnsField.new(self, encoding))
      end

      # Configure the leading comments field for this repository and return
      # self.
      def leading_comments
        field(:leading_comments, LeadingCommentsField.new)
      end

      # Configure the trailing comments field for this repository and return
      # self.
      def trailing_comments
        field(:trailing_comments, TrailingCommentsField.new)
      end

      # Configure both the leading and trailing comment fields for this
      # repository and return self.
      def comments
        leading_comments.trailing_comments
      end

      # This method is called from nodes and locations when they want to enter
      # themselves into the repository. It it internal-only and meant to be
      # called from the #save* APIs.
      def enter(node_id, field_name) # :nodoc:
        entry = Entry.new(self)
        @entries[node_id][field_name] = entry
        entry
      end

      # This method is called from the entries in the repository when they need
      # to reify their values. It is internal-only and meant to be called from
      # the various value APIs.
      def reify! # :nodoc:
        result = source.result

        # Attach the comments if they have been requested as part of the
        # configuration of this repository.
        if fields.key?(:leading_comments) || fields.key?(:trailing_comments)
          result.attach_comments!
        end

        queue = [result.value] #: Array[Prism::node]
        while (node = queue.shift)
          @entries[node.node_id].each do |field_name, entry|
            value = node.public_send(field_name)
            values = {} #: Hash[Symbol, untyped]

            fields.each_value do |field|
              values.merge!(field.fields(value))
            end

            entry.reify!(values)
          end

          queue.concat(node.compact_child_nodes)
        end

        @entries.clear
      end

      private

      # Append the given field to the repository and return the repository so
      # that these calls can be chained.
      def field(name, value)
        raise ConfigurationError, "Cannot specify multiple #{name} fields" if @fields.key?(name)
        @fields[name] = value
        self
      end
    end

    # Create a new repository for the given filepath.
    def self.filepath(value)
      Repository.new(SourceFilepath.new(value))
    end

    # Create a new repository for the given string.
    def self.string(value)
      Repository.new(SourceString.new(value))
    end
  end
end

Youez - 2016 - github.com/yon3zu
LinuXploit