aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/compiler/JvstCodeGen.java
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2004-01-08 17:22:29 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2004-01-08 17:22:29 +0000
commitbd4705d214608f17b3c33339fb2399347b2f8c82 (patch)
treef0c701338ea077234a498e1304c3e8e18a2725cb /src/main/javassist/compiler/JvstCodeGen.java
parent2817e9c078a34a8b2e581fff13801bf92aa93c0f (diff)
downloadjavassist-bd4705d214608f17b3c33339fb2399347b2f8c82.tar.gz
javassist-bd4705d214608f17b3c33339fb2399347b2f8c82.zip
updated the copyright notices.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@67 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/compiler/JvstCodeGen.java')
-rw-r--r--src/main/javassist/compiler/JvstCodeGen.java34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/main/javassist/compiler/JvstCodeGen.java b/src/main/javassist/compiler/JvstCodeGen.java
index 54e95a0a..07e7521b 100644
--- a/src/main/javassist/compiler/JvstCodeGen.java
+++ b/src/main/javassist/compiler/JvstCodeGen.java
@@ -1,6 +1,6 @@
/*
* Javassist, a Java-bytecode translator toolkit.
- * Copyright (C) 1999-2003 Shigeru Chiba. All Rights Reserved.
+ * Copyright (C) 1999-2004 Shigeru Chiba. All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
@@ -187,8 +187,7 @@ public class JvstCodeGen extends MemberCodeGen {
compileUnwrapValue(returnType, bytecode);
else if (returnType instanceof CtPrimitiveType) {
CtPrimitiveType pt = (CtPrimitiveType)returnType;
- int destType = MemberResolver.jvmTypeNameToExprType(
- pt.getDescriptor());
+ int destType = MemberResolver.descToType(pt.getDescriptor());
atNumCastExpr(exprType, destType);
exprType = destType;
arrayDim = 0;
@@ -556,6 +555,35 @@ public class JvstCodeGen extends MemberCodeGen {
return is2word(exprType, arrayDim) ? 2 : 1;
}
+ /**
+ * Makes the given variable name available.
+ *
+ * @param typeDesc the type descriptor of the variable
+ * @param varName variable name
+ * @param varNo an index into the local variable array
+ */
+ public void recordVariable(String typeDesc, String varName, int varNo,
+ SymbolTable tbl) throws CompileError
+ {
+ char c;
+ int dim = 0;
+ while ((c = typeDesc.charAt(dim)) == '[')
+ ++dim;
+
+ int type = MemberResolver.descToType(c);
+ String cname = null;
+ if (type == CLASS) {
+ if (dim == 0)
+ cname = typeDesc;
+ else
+ cname = typeDesc.substring(dim);
+ }
+
+ Declarator decl
+ = new Declarator(type, cname, dim, varNo, new Symbol(varName));
+ tbl.append(varName, decl);
+ }
+
/* compileParameterList() returns the stack size used
* by the produced code.
*