Skip to content

Instantly share code, notes, and snippets.

@UberMouse
Created January 27, 2014 03:35
Show Gist options
  • Save UberMouse/8642906 to your computer and use it in GitHub Desktop.
Save UberMouse/8642906 to your computer and use it in GitHub Desktop.
object Source {
def :=(v: String) = Value := v
private object Value extends UntypedAttr("source") {
override def :=(v: String) = new Attr(this, v)
}
class Attr(att:Attr, newVal:String) extends AttrPair(att, newVal)
}
PackageDef(Ident(newTermName("<empty>")),
List(ModuleDef(Modifiers(),
newTermName("Source"),
Template(List(Select(Ident(newTypeName("scala")), newTypeName("AnyRef"))),
emptyValDef,
List(DefDef(Modifiers(),
nme.CONSTRUCTOR,
List(),
List(List()),
TypeTree(),
Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY),
nme.CONSTRUCTOR), List())),
Literal(Constant(())))),
DefDef(Modifiers(),
newTermName("$colon$eq"),
List(),
List(List(ValDef(Modifiers(PARAM),
newTermName("v"),
Ident(newTypeName("String")),
EmptyTree))),
TypeTree(),
Apply(Select(Ident(newTermName("Value")), newTermName("$colon$eq")),
List(Ident(newTermName("v"))))),
ModuleDef(Modifiers(PRIVATE),
newTermName("Value"),
Template(List(Ident(newTypeName("UntypedAttr"))),
emptyValDef,
List(DefDef(Modifiers(),
nme.CONSTRUCTOR,
List(),
List(List()),
TypeTree(),
Block(List(Apply(Select(Super(This(tpnme
.EMPTY),
tpnme.EMPTY),
nme.CONSTRUCTOR),
List(Literal(Constant(
"source"))))),
Literal(Constant(())))),
DefDef(Modifiers(OVERRIDE),
newTermName("$colon$eq"),
List(),
List(List(ValDef(Modifiers(PARAM),
newTermName("v"),
Ident(newTypeName("String")),
EmptyTree))),
TypeTree(),
Apply(Select(New(Ident(newTypeName("Attr"))),
nme.CONSTRUCTOR),
List(This(tpnme.EMPTY),
Ident(newTermName("v")))))))),
ClassDef(Modifiers(),
newTypeName("Attr"),
List(),
Template(List(Ident(newTypeName("AttrPair"))),
emptyValDef,
List(ValDef(Modifiers(PRIVATE | LOCAL),
newTermName("att"),
Ident(newTypeName("Attr")),
EmptyTree),
ValDef(Modifiers(PRIVATE | LOCAL),
newTermName("newVal"),
Ident(newTypeName("String")),
EmptyTree),
DefDef(Modifiers(),
nme.CONSTRUCTOR,
List(),
List(List(ValDef(Modifiers(PARAM),
newTermName("att"),
Ident(newTypeName("Attr")),
EmptyTree),
ValDef(Modifiers(PARAM),
newTermName("newVal"),
Ident(newTypeName("String")),
EmptyTree))),
TypeTree(),
Block(List(Apply(Select(Super(This(tpnme
.EMPTY),
tpnme.EMPTY),
nme.CONSTRUCTOR),
List(Ident(newTermName("att")),
Ident(newTermName(
"newVal"))))),
Literal(Constant(()))))))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment