@@ -108,6 +108,7 @@ package builder
108108
109109import  (
110110	"encoding/json" 
111+ 	"fmt" 
111112	"os" 
112113	"os/exec" 
113114	"time" 
@@ -196,19 +197,28 @@ type includeCacheEntry struct {
196197	Includepath  * paths.Path 
197198}
198199
200+ func  (entry  * includeCacheEntry ) String () string  {
201+ 	return  fmt .Sprintf ("SourceFile: %s; Include: %s; IncludePath: %s" ,
202+ 		entry .Sourcefile , entry .Include , entry .Includepath )
203+ }
204+ 
205+ func  (entry  * includeCacheEntry ) Equals (other  * includeCacheEntry ) bool  {
206+ 	return  entry .String () ==  other .String ()
207+ }
208+ 
199209type  includeCache  struct  {
200210	// Are the cache contents valid so far? 
201211	valid  bool 
202212	// Index into entries of the next entry to be processed. Unused 
203213	// when the cache is invalid. 
204214	next     int 
205- 	entries  []includeCacheEntry 
215+ 	entries  []* includeCacheEntry 
206216}
207217
208218// Return the next cache entry. Should only be called when the cache is 
209219// valid and a next entry is available (the latter can be checked with 
210220// ExpectFile). Does not advance the cache. 
211- func  (cache  * includeCache ) Next () includeCacheEntry  {
221+ func  (cache  * includeCache ) Next () * includeCacheEntry  {
212222	return  cache .entries [cache .next ]
213223}
214224
@@ -227,9 +237,9 @@ func (cache *includeCache) ExpectFile(sourcefile *paths.Path) {
227237// invalidated, or was already invalid, an entry with the given values 
228238// is appended. 
229239func  (cache  * includeCache ) ExpectEntry (sourcefile  * paths.Path , include  string , librarypath  * paths.Path ) {
230- 	entry  :=  includeCacheEntry {Sourcefile : sourcefile , Include : include , Includepath : librarypath }
240+ 	entry  :=  & includeCacheEntry {Sourcefile : sourcefile , Include : include , Includepath : librarypath }
231241	if  cache .valid  {
232- 		if  cache .next  <  len (cache .entries ) &&  cache .Next ()  ==   entry  {
242+ 		if  cache .next  <  len (cache .entries ) &&  cache .Next (). Equals ( entry )  {
233243			cache .next ++ 
234244		} else  {
235245			cache .valid  =  false 
0 commit comments