-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
asCode method writes patternproxies with source; printOn posts Tdef, …
…Pdef, Pdefn with their name.
- Loading branch information
adc
committed
May 14, 2011
1 parent
ebf9e22
commit 46f4921
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
+ PatternProxy { | ||
// like asCompileString, but with full source etc. | ||
asCode { | ||
var mykey = this.key.asCompileString; | ||
var str; str = "" ++ this.class.name ++ "("; | ||
|
||
if(source.isNil or: { source == this.class.default }) { | ||
str = str ++ mykey; | ||
} { | ||
str = str ++ this.repositoryArgs.asCompileString.drop(1).drop(-1); | ||
}; | ||
str = str ++ ")"; | ||
|
||
if(this.envir.notNil and: { this.envir.notEmpty }) { | ||
str = str ++ ".set(" ++ | ||
this.envir.asKeyValuePairs.asCompileString.drop(1).drop(-1) ++ ")" | ||
}; | ||
str = str ++ ";" | ||
^str | ||
} | ||
} | ||
|
||
+ Tdef { | ||
printOn { |stream| | ||
^this.storeOn(stream); | ||
} | ||
} | ||
+ Pdef { | ||
printOn { |stream| | ||
^this.storeOn(stream); | ||
} | ||
} | ||
+ Pdefn { | ||
printOn { |stream| | ||
^this.storeOn(stream); | ||
} | ||
} |