Check-in [bca8ee3e12]
Overview
Comment:full dep traversal in the collecting handler
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:bca8ee3e121081e2aeadbd1710a960a4cd41a214
User & Date: spaskalev on 2015-01-26 23:02:10
Other Links: manifest | tags
Context
2015-03-19
20:17
A simple parser combinator library check-in: 061baeefcb user: spaskalev tags: trunk
2015-01-26
23:02
full dep traversal in the collecting handler check-in: bca8ee3e12 user: spaskalev tags: trunk
21:32
Added missing depends interation in the collecting handler check-in: 3861ae4c57 user: spaskalev tags: trunk
Changes

Modified src/0dev.org/commands/tbd/tbd.go from [00e85b5d82] to [2547f40cdb].

216
217
218
219
220
221
222
223
224
225
226
227



228
229
230
231
232
233
234
235
236
237
238
		}
		return action{stop: true}
	}
}

// Returns a handler that stores every seen task and an ancillary function to retrieve those
func collecting() (handler, func() tasks) {
	var seen = make(map[*task]struct{})
	return func(t *task) action {
			seen[t] = struct{}{}
			for _, dep := range t.depends {
				seen[dep] = struct{}{}



			}
			return action{}
		}, func() tasks {
			seq := make(tasks, 0, len(seen))
			for k, _ := range seen {
				seq = append(seq, k)
			}
			sort.Stable(seq)
			return seq
		}
}







|

|
|
|
>
>
>











216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
		}
		return action{stop: true}
	}
}

// Returns a handler that stores every seen task and an ancillary function to retrieve those
func collecting() (handler, func() tasks) {
	var seen = make(map[*task]bool)
	return func(t *task) action {
			depth := tasks{t}
			for i := 0; i < len(depth); i++ {
				if !seen[depth[i]] {
					seen[depth[i]] = true
					depth = append(depth, depth[i].depends...)
				}
			}
			return action{}
		}, func() tasks {
			seq := make(tasks, 0, len(seen))
			for k, _ := range seen {
				seq = append(seq, k)
			}
			sort.Stable(seq)
			return seq
		}
}