Check-in [bca8ee3e12]
Overview
SHA1:bca8ee3e121081e2aeadbd1710a960a4cd41a214
Date: 2015-01-26 23:02:10
User: spaskalev
Comment:full dep traversal in the collecting handler
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2015-03-19
20:17
[061baeefcb] A simple parser combinator library (user: spaskalev, tags: trunk)
2015-01-26
23:02
[bca8ee3e12] full dep traversal in the collecting handler (user: spaskalev, tags: trunk)
21:32
[3861ae4c57] Added missing depends interation in the collecting handler (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
		}
}