applyEarlyDirectives applies all early directives needed before process() is called. additional directives remain in f.Directives for future processing
()
| 160 | // applyEarlyDirectives applies all early directives needed before process() is called. |
| 161 | // additional directives remain in f.Directives for future processing |
| 162 | func (fs *FileSet) applyEarlyDirectives() { |
| 163 | newdirs := make([]string, 0, len(fs.Directives)) |
| 164 | for _, d := range fs.Directives { |
| 165 | parts := strings.Split(d, " ") |
| 166 | if len(parts) == 0 { |
| 167 | continue |
| 168 | } |
| 169 | if fn, ok := earlyDirectives[parts[0]]; ok { |
| 170 | pushstate(parts[0]) |
| 171 | err := fn(parts, fs) |
| 172 | if err != nil { |
| 173 | warnf("early directive error: %s", err) |
| 174 | } |
| 175 | popstate() |
| 176 | } else { |
| 177 | newdirs = append(newdirs, d) |
| 178 | } |
| 179 | } |
| 180 | fs.Directives = newdirs |
| 181 | } |
| 182 | |
| 183 | // A linkset is a graph of unresolved |
| 184 | // identities. |