Skip to content

Commit

Permalink
Added Ldc(Class[_]) utility method
Browse files Browse the repository at this point in the history
  • Loading branch information
pradeepk authored and psuter committed Jul 19, 2012
1 parent 15e985f commit fd83079
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/scala/cafebabe/AbstractByteCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ object AbstractByteCodes {
ch << ldc_ref(ch.constantPool.addStringConstant(ch.constantPool.addString(s)))
})

def apply(c: Class[_]): AbstractByteCodeGenerator = ((ch: CodeHandler) => {
ch << ldc_ref(ch.constantPool.addClass(ch.constantPool.addString(c.getName().replaceAll("\\.", "/"))))
})

private def ldc_ref(cpRef: U2): AbstractByteCodeGenerator = ((ch: CodeHandler) => {
if(cpRef <= 0xFF) {
ch << LDC << RawByte((cpRef & 0xFF).asInstanceOf[U1])
Expand Down

0 comments on commit fd83079

Please sign in to comment.