Permalink
Browse files

Cache relevant properties

  • Loading branch information...
1 parent 7c06871 commit bfb9ea1eb3686a82d2f508276165805ef7805335 @nddrylliog nddrylliog committed Feb 20, 2013
Showing with 12 additions and 8 deletions.
  1. +0 −2 source/rock/backend/cnaughty/ModuleWriter.ooc
  2. +12 −6 source/rock/middle/UseDef.ooc
@@ -29,8 +29,6 @@ ModuleWriter: abstract class extends Skeleton {
if(!module includes empty?()) current nl()
for(uze in module uses) {
- "Writing includes" println()
-
// FIXME: have ifdef barriers instead
props := uze useDef getRelevantProperties(module params)
for(ynclude in props includes) {
@@ -77,6 +77,9 @@ UseDef: class {
properties := ArrayList<UseProperties> new()
versionStack := Stack<UseProperties> new()
+ // cache relevant properties
+ _relevantProperties: UseProperties
+
init: func (=identifier) {
requirements = ArrayList<Requirement> new()
pkgs = ArrayList<String> new()
@@ -418,13 +421,16 @@ UseDef: class {
}
getRelevantProperties: func (params: BuildParams) -> UseProperties {
- result := UseProperties new(this, UseVersion new(this))
+ if (!_relevantProperties) {
+ _relevantProperties = UseProperties new(this, UseVersion new(this))
- properties filter(|p| p useVersion satisfied?(params)) each(|p|
- "%s is satisfied" printfln(p useVersion toString())
- result merge!(p)
- )
- result
+ properties filter(|p| p useVersion satisfied?(params)) each(|p|
+ "%s is satisfied" printfln(p useVersion toString())
+ _relevantProperties merge!(p)
+ )
+ }
+
+ _relevantProperties
}
}

0 comments on commit bfb9ea1

Please sign in to comment.