Comparing version 0.0.5 to 0.0.6
@@ -41,4 +41,4 @@ "use strict"; | ||
*/ | ||
var Opcodes_1 = require("./Opcodes"); | ||
var AnnotationVisitor = /** @class */ (function () { | ||
const Opcodes_1 = require("./Opcodes"); | ||
class AnnotationVisitor { | ||
/** | ||
@@ -54,4 +54,3 @@ * Constructs a new {@link AnnotationVisitor}. | ||
*/ | ||
function AnnotationVisitor(api, av) { | ||
if (av === void 0) { av = null; } | ||
constructor(api, av = null) { | ||
this.api = 0; | ||
@@ -79,7 +78,7 @@ if (api !== Opcodes_1.Opcodes.ASM4 && api !== Opcodes_1.Opcodes.ASM5) { | ||
*/ | ||
AnnotationVisitor.prototype.visit = function (name, value) { | ||
visit(name, value) { | ||
if (this.av != null) { | ||
this.av.visit(name, value); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -95,7 +94,7 @@ * Visits an enumeration value of the annotation. | ||
*/ | ||
AnnotationVisitor.prototype.visitEnum = function (name, desc, value) { | ||
visitEnum(name, desc, value) { | ||
if (this.av != null) { | ||
this.av.visitEnum(name, desc, value); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -114,3 +113,3 @@ * Visits a nested annotation value of the annotation. | ||
*/ | ||
AnnotationVisitor.prototype.visitAnnotation = function (name, desc) { | ||
visitAnnotation(name, desc) { | ||
if (this.av != null) { | ||
@@ -120,3 +119,3 @@ return this.av.visitAnnotation(name, desc); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -136,3 +135,3 @@ * Visits an array value of the annotation. Note that arrays of primitive | ||
*/ | ||
AnnotationVisitor.prototype.visitArray = function (name) { | ||
visitArray(name) { | ||
if (this.av != null) { | ||
@@ -142,14 +141,13 @@ return this.av.visitArray(name); | ||
return null; | ||
}; | ||
} | ||
/** | ||
* Visits the end of the annotation. | ||
*/ | ||
AnnotationVisitor.prototype.visitEnd = function () { | ||
visitEnd() { | ||
if (this.av != null) { | ||
this.av.visitEnd(); | ||
} | ||
}; | ||
return AnnotationVisitor; | ||
}()); | ||
} | ||
} | ||
exports.AnnotationVisitor = AnnotationVisitor; | ||
AnnotationVisitor["__class"] = "AnnotationVisitor"; |
@@ -31,19 +31,8 @@ "use strict"; | ||
*/ | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var AnnotationVisitor_1 = require("./AnnotationVisitor"); | ||
var Opcodes_1 = require("./Opcodes"); | ||
var Type_1 = require("./Type"); | ||
const AnnotationVisitor_1 = require("./AnnotationVisitor"); | ||
const Opcodes_1 = require("./Opcodes"); | ||
const Type_1 = require("./Type"); | ||
// import * as Long from 'long' | ||
var AnnotationWriter = /** @class */ (function (_super) { | ||
__extends(AnnotationWriter, _super); | ||
class AnnotationWriter extends AnnotationVisitor_1.AnnotationVisitor { | ||
/** | ||
@@ -64,15 +53,14 @@ * Constructs a new {@link AnnotationWriter}. | ||
*/ | ||
function AnnotationWriter(cw, named, bv, parent, offset) { | ||
var _this = _super.call(this, Opcodes_1.Opcodes.ASM5) || this; | ||
_this.size = 0; | ||
_this.named = false; | ||
_this.offset = 0; | ||
_this.cw = cw; | ||
_this.named = named; | ||
_this.bv = bv; | ||
_this.parent = parent; | ||
_this.offset = offset; | ||
return _this; | ||
constructor(cw, named, bv, parent, offset) { | ||
super(Opcodes_1.Opcodes.ASM5); | ||
this.size = 0; | ||
this.named = false; | ||
this.offset = 0; | ||
this.cw = cw; | ||
this.named = named; | ||
this.bv = bv; | ||
this.parent = parent; | ||
this.offset = offset; | ||
} | ||
AnnotationWriter.prototype.visit = function (name, value) { | ||
visit(name, value) { | ||
++this.size; | ||
@@ -89,3 +77,3 @@ if (this.named) { | ||
else if (typeof value === 'boolean') { | ||
var v = value ? 1 : 0; | ||
let v = value ? 1 : 0; | ||
this.bv.put12(('Z').charCodeAt(0), this.cw.newInteger(v).index); | ||
@@ -103,5 +91,5 @@ } | ||
else if (value != null && value instanceof Array) { | ||
var v = value; | ||
let v = value; | ||
this.bv.put12(('[').charCodeAt(0), v.length); | ||
for (var i = 0; i < v.length; i++) { | ||
for (let i = 0; i < v.length; i++) { | ||
this.bv.put12(('B').charCodeAt(0), this.cw.newInteger(v[i]).index); | ||
@@ -111,5 +99,5 @@ } | ||
else if (value != null && value instanceof Array) { | ||
var v = value; | ||
let v = value; | ||
this.bv.put12(('[').charCodeAt(0), v.length); | ||
for (var i = 0; i < v.length; i++) { | ||
for (let i = 0; i < v.length; i++) { | ||
this.bv.put12(('Z').charCodeAt(0), this.cw.newInteger(v[i] ? 1 : 0).index); | ||
@@ -119,5 +107,5 @@ } | ||
else if (value != null && value instanceof Array) { | ||
var v = value; | ||
let v = value; | ||
this.bv.put12(('[').charCodeAt(0), v.length); | ||
for (var i = 0; i < v.length; i++) { | ||
for (let i = 0; i < v.length; i++) { | ||
this.bv.put12(('S').charCodeAt(0), this.cw.newInteger(v[i]).index); | ||
@@ -127,5 +115,5 @@ } | ||
else if (value != null && value instanceof Array) { | ||
var v = value; | ||
let v = value; | ||
this.bv.put12(('[').charCodeAt(0), v.length); | ||
for (var i = 0; i < v.length; i++) { | ||
for (let i = 0; i < v.length; i++) { | ||
this.bv.put12(('C').charCodeAt(0), this.cw.newInteger((v[i]).charCodeAt(0)).index); | ||
@@ -135,5 +123,5 @@ } | ||
else if (value != null && value instanceof Array) { | ||
var v = value; | ||
let v = value; | ||
this.bv.put12(('[').charCodeAt(0), v.length); | ||
for (var i = 0; i < v.length; i++) { | ||
for (let i = 0; i < v.length; i++) { | ||
this.bv.put12(('I').charCodeAt(0), this.cw.newInteger(v[i]).index); | ||
@@ -143,5 +131,5 @@ } | ||
else if (value != null && value instanceof Array) { | ||
var v = value; | ||
let v = value; | ||
this.bv.put12(('[').charCodeAt(0), v.length); | ||
for (var i = 0; i < v.length; i++) { | ||
for (let i = 0; i < v.length; i++) { | ||
// break... | ||
@@ -152,5 +140,5 @@ // this.bv.put12(('J').charCodeAt(0), this.cw.newLong(v[i]).index); | ||
else if (value != null && value instanceof Array) { | ||
var v = value; | ||
let v = value; | ||
this.bv.put12(('[').charCodeAt(0), v.length); | ||
for (var i = 0; i < v.length; i++) { | ||
for (let i = 0; i < v.length; i++) { | ||
this.bv.put12(('F').charCodeAt(0), this.cw.newFloat(v[i]).index); | ||
@@ -160,5 +148,5 @@ } | ||
else if (value != null && value instanceof Array) { | ||
var v = value; | ||
let v = value; | ||
this.bv.put12(('[').charCodeAt(0), v.length); | ||
for (var i = 0; i < v.length; i++) { | ||
for (let i = 0; i < v.length; i++) { | ||
this.bv.put12(('D').charCodeAt(0), this.cw.newDouble(v[i]).index); | ||
@@ -168,7 +156,7 @@ } | ||
else { | ||
var i = this.cw.newConstItem(value); | ||
let i = this.cw.newConstItem(value); | ||
this.bv.put12((".s.IFJDCS".charAt(i.type)).charCodeAt(0), i.index); | ||
} | ||
}; | ||
AnnotationWriter.prototype.visitEnum = function (name, desc, value) { | ||
} | ||
visitEnum(name, desc, value) { | ||
++this.size; | ||
@@ -179,4 +167,4 @@ if (this.named) { | ||
this.bv.put12(('e').charCodeAt(0), this.cw.newUTF8(desc)).putShort(this.cw.newUTF8(value)); | ||
}; | ||
AnnotationWriter.prototype.visitAnnotation = function (name, desc) { | ||
} | ||
visitAnnotation(name, desc) { | ||
++this.size; | ||
@@ -188,4 +176,4 @@ if (this.named) { | ||
return new AnnotationWriter(this.cw, true, this.bv, this.bv, this.bv.length - 2); | ||
}; | ||
AnnotationWriter.prototype.visitArray = function (name) { | ||
} | ||
visitArray(name) { | ||
++this.size; | ||
@@ -197,10 +185,10 @@ if (this.named) { | ||
return new AnnotationWriter(this.cw, false, this.bv, this.bv, this.bv.length - 2); | ||
}; | ||
AnnotationWriter.prototype.visitEnd = function () { | ||
} | ||
visitEnd() { | ||
if (this.parent != null) { | ||
var data = this.parent.data; | ||
let data = this.parent.data; | ||
data[this.offset] = ((this.size >>> 8) | 0); | ||
data[this.offset + 1] = (this.size | 0); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -211,5 +199,5 @@ * Returns the size of this annotation writer list. | ||
*/ | ||
AnnotationWriter.prototype.getSize = function () { | ||
var size = 0; | ||
var aw = this; | ||
getSize() { | ||
let size = 0; | ||
let aw = this; | ||
while ((aw != null)) { | ||
@@ -221,3 +209,3 @@ size += aw.bv.length; | ||
return size; | ||
}; | ||
} | ||
/** | ||
@@ -230,7 +218,7 @@ * Puts the annotations of this annotation writer list into the given byte | ||
*/ | ||
AnnotationWriter.prototype.put = function (out) { | ||
var n = 0; | ||
var size = 2; | ||
var aw = this; | ||
var last = null; | ||
put(out) { | ||
let n = 0; | ||
let size = 2; | ||
let aw = this; | ||
let last = null; | ||
while ((aw != null)) { | ||
@@ -253,3 +241,3 @@ ++n; | ||
; | ||
}; | ||
} | ||
/** | ||
@@ -265,12 +253,12 @@ * Puts the given annotation lists into the given byte vector. | ||
*/ | ||
AnnotationWriter.put = function (panns, off, out) { | ||
var size = 1 + 2 * (panns.length - off); | ||
for (var i = off; i < panns.length; ++i) { | ||
static put(panns, off, out) { | ||
let size = 1 + 2 * (panns.length - off); | ||
for (let i = off; i < panns.length; ++i) { | ||
size += panns[i] == null ? 0 : panns[i].getSize(); | ||
} | ||
out.putInt(size).putByte(panns.length - off); | ||
for (var i = off; i < panns.length; ++i) { | ||
var aw = panns[i]; | ||
var last = null; | ||
var n = 0; | ||
for (let i = off; i < panns.length; ++i) { | ||
let aw = panns[i]; | ||
let last = null; | ||
let n = 0; | ||
while ((aw != null)) { | ||
@@ -292,3 +280,3 @@ ++n; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -307,3 +295,3 @@ * Puts the given type reference and type path into the given bytevector. | ||
*/ | ||
AnnotationWriter.putTarget = function (typeRef, typePath, out) { | ||
static putTarget(typeRef, typePath, out) { | ||
switch ((typeRef >>> 24)) { | ||
@@ -335,9 +323,8 @@ case 0: | ||
else { | ||
var length_1 = typePath.buf[typePath.offset] * 2 + 1; | ||
out.putByteArray(typePath.buf, typePath.offset, length_1); | ||
let length = typePath.buf[typePath.offset] * 2 + 1; | ||
out.putByteArray(typePath.buf, typePath.offset, length); | ||
} | ||
}; | ||
return AnnotationWriter; | ||
}(AnnotationVisitor_1.AnnotationVisitor)); | ||
} | ||
} | ||
exports.AnnotationWriter = AnnotationWriter; | ||
AnnotationWriter["__class"] = "AnnotationWriter"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ByteVector_1 = require("./ByteVector"); | ||
var Attribute = /** @class */ (function () { | ||
const ByteVector_1 = require("./ByteVector"); | ||
class Attribute { | ||
/** | ||
@@ -11,3 +11,3 @@ * Constructs a new empty attribute. | ||
*/ | ||
function Attribute(type) { | ||
constructor(type) { | ||
this.type = type; | ||
@@ -21,5 +21,5 @@ } | ||
*/ | ||
Attribute.prototype.isUnknown = function () { | ||
isUnknown() { | ||
return true; | ||
}; | ||
} | ||
/** | ||
@@ -30,5 +30,5 @@ * Returns <tt>true</tt> if this type of attribute is a code attribute. | ||
*/ | ||
Attribute.prototype.isCodeAttribute = function () { | ||
isCodeAttribute() { | ||
return false; | ||
}; | ||
} | ||
/** | ||
@@ -40,5 +40,5 @@ * Returns the labels corresponding to this attribute. | ||
*/ | ||
Attribute.prototype.getLabels = function () { | ||
getLabels() { | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -75,8 +75,8 @@ * Reads a {@link #type type} attribute. This method must return a | ||
*/ | ||
Attribute.prototype.read = function (cr, off, len, buf, codeOff, labels) { | ||
var attr = new Attribute(this.type); | ||
read(cr, off, len, buf, codeOff, labels) { | ||
let attr = new Attribute(this.type); | ||
attr.value = cr.buf.slice(0, len); | ||
// java.lang.System.arraycopy(cr.b, off, attr.value, 0, len); | ||
return attr; | ||
}; | ||
} | ||
/** | ||
@@ -107,8 +107,8 @@ * Returns the byte array form of this attribute. | ||
*/ | ||
Attribute.prototype.write = function (cw, code, len, maxStack, maxLocals) { | ||
var v = new ByteVector_1.ByteVector(); | ||
write(cw, code, len, maxStack, maxLocals) { | ||
let v = new ByteVector_1.ByteVector(); | ||
v.data = this.value; | ||
v.length = this.value.length; | ||
return v; | ||
}; | ||
} | ||
/** | ||
@@ -119,5 +119,5 @@ * Returns the length of the attribute list that begins with this attribute. | ||
*/ | ||
Attribute.prototype.getCount = function () { | ||
var count = 0; | ||
var attr = this; | ||
getCount() { | ||
let count = 0; | ||
let attr = this; | ||
while ((attr != null)) { | ||
@@ -129,3 +129,3 @@ count += 1; | ||
return count; | ||
}; | ||
} | ||
/** | ||
@@ -156,5 +156,5 @@ * Returns the size of all the attributes in this attribute list. | ||
*/ | ||
Attribute.prototype.getSize = function (cw, code, len, maxStack, maxLocals) { | ||
var attr = this; | ||
var size = 0; | ||
getSize(cw, code, len, maxStack, maxLocals) { | ||
let attr = this; | ||
let size = 0; | ||
while ((attr != null)) { | ||
@@ -167,3 +167,3 @@ cw.newUTF8(attr.type); | ||
return size; | ||
}; | ||
} | ||
/** | ||
@@ -195,6 +195,6 @@ * Writes all the attributes of this attribute list in the given byte | ||
*/ | ||
Attribute.prototype.put = function (cw, code, len, maxStack, maxLocals, out) { | ||
var attr = this; | ||
put(cw, code, len, maxStack, maxLocals, out) { | ||
let attr = this; | ||
while ((attr != null)) { | ||
var b = attr.write(cw, code, len, maxStack, maxLocals); | ||
let b = attr.write(cw, code, len, maxStack, maxLocals); | ||
out.putShort(cw.newUTF8(attr.type)).putInt(b.length); | ||
@@ -205,6 +205,5 @@ out.putByteArray(b.data, 0, b.length); | ||
; | ||
}; | ||
return Attribute; | ||
}()); | ||
} | ||
} | ||
exports.Attribute = Attribute; | ||
Attribute["__class"] = "Attribute"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var int8 = new Int8Array(4); | ||
var int32 = new Int32Array(int8.buffer, 0, 1); | ||
var float32 = new Float32Array(int8.buffer, 0, 1); | ||
let int8 = new Int8Array(4); | ||
let int32 = new Int32Array(int8.buffer, 0, 1); | ||
let float32 = new Float32Array(int8.buffer, 0, 1); | ||
exports.SHORT_MIN = -32768; | ||
@@ -18,6 +18,6 @@ exports.SHORT_MAX = 32768; | ||
exports.floatToIntBits = floatToIntBits; | ||
var int16 = new Int16Array(4); | ||
var int64 = new Int32Array(int16.buffer, 0, 2); | ||
var float64 = new Float64Array(int16.buffer, 0, 1); | ||
var Long = require("long"); | ||
let int16 = new Int16Array(4); | ||
let int64 = new Int32Array(int16.buffer, 0, 2); | ||
let float64 = new Float64Array(int16.buffer, 0, 1); | ||
const Long = require("long"); | ||
function longBitsToDouble(bits) { | ||
@@ -24,0 +24,0 @@ int64[0] = bits.high; |
@@ -39,3 +39,3 @@ "use strict"; | ||
*/ | ||
var ByteVector = /** @class */ (function () { | ||
class ByteVector { | ||
/** | ||
@@ -48,4 +48,3 @@ * Constructs a new {@link ByteVector ByteVector} with the given initial | ||
*/ | ||
function ByteVector(initialSize) { | ||
if (initialSize === void 0) { initialSize = 64; } | ||
constructor(initialSize = 64) { | ||
this.data = new Uint8Array(initialSize); | ||
@@ -61,4 +60,4 @@ } | ||
*/ | ||
ByteVector.prototype.putByte = function (b) { | ||
var length = this.length; | ||
putByte(b) { | ||
let length = this.length; | ||
if (length + 1 > this.data.length) { | ||
@@ -70,3 +69,3 @@ this.enlarge(1); | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -82,8 +81,8 @@ * Puts two bytes into this byte vector. The byte vector is automatically | ||
*/ | ||
ByteVector.prototype.put11 = function (b1, b2) { | ||
var length = this.length; | ||
put11(b1, b2) { | ||
let length = this.length; | ||
if (length + 2 > this.data.length) { | ||
this.enlarge(2); | ||
} | ||
var data = this.data; | ||
let data = this.data; | ||
data[length++] = (b1 | 0); | ||
@@ -93,3 +92,3 @@ data[length++] = (b2 | 0); | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -103,8 +102,8 @@ * Puts a short into this byte vector. The byte vector is automatically | ||
*/ | ||
ByteVector.prototype.putShort = function (s) { | ||
var length = this.length; | ||
putShort(s) { | ||
let length = this.length; | ||
if (length + 2 > this.data.length) { | ||
this.enlarge(2); | ||
} | ||
var data = this.data; | ||
let data = this.data; | ||
data[length++] = ((s >>> 8) | 0); | ||
@@ -114,3 +113,3 @@ data[length++] = (s | 0); | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -126,8 +125,8 @@ * Puts a byte and a short into this byte vector. The byte vector is | ||
*/ | ||
ByteVector.prototype.put12 = function (b, s) { | ||
var length = this.length; | ||
put12(b, s) { | ||
let length = this.length; | ||
if (length + 3 > this.data.length) { | ||
this.enlarge(3); | ||
} | ||
var data = this.data; | ||
let data = this.data; | ||
data[length++] = (b | 0); | ||
@@ -138,3 +137,3 @@ data[length++] = ((s >>> 8) | 0); | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -148,8 +147,8 @@ * Puts an int into this byte vector. The byte vector is automatically | ||
*/ | ||
ByteVector.prototype.putInt = function (i) { | ||
var length = this.length; | ||
putInt(i) { | ||
let length = this.length; | ||
if (length + 4 > this.data.length) { | ||
this.enlarge(4); | ||
} | ||
var data = this.data; | ||
let data = this.data; | ||
data[length++] = ((i >>> 24) | 0); | ||
@@ -161,3 +160,3 @@ data[length++] = ((i >>> 16) | 0); | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -171,9 +170,9 @@ * Puts a long into this byte vector. The byte vector is automatically | ||
*/ | ||
ByteVector.prototype.putLong = function (l) { | ||
var length = this.length; | ||
putLong(l) { | ||
let length = this.length; | ||
if (length + 8 > this.data.length) { | ||
this.enlarge(8); | ||
} | ||
var data = this.data; | ||
var i = l.getHighBits(); | ||
let data = this.data; | ||
let i = l.getHighBits(); | ||
data[length++] = (i >>> 24) & 256; | ||
@@ -190,3 +189,3 @@ data[length++] = (i >>> 16) & 256; | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -200,16 +199,16 @@ * Puts an UTF8 string into this byte vector. The byte vector is | ||
*/ | ||
ByteVector.prototype.putUTF8 = function (s) { | ||
var charLength = s.length; | ||
putUTF8(s) { | ||
let charLength = s.length; | ||
if (charLength > 65535) { | ||
throw new Error(); | ||
} | ||
var len = this.length; | ||
let len = this.length; | ||
if (len + 2 + charLength > this.data.length) { | ||
this.enlarge(2 + charLength); | ||
} | ||
var data = this.data; | ||
let data = this.data; | ||
data[len++] = ((charLength >>> 8) | 0); | ||
data[len++] = (charLength | 0); | ||
for (var i = 0; i < charLength; ++i) { | ||
var c = s.charAt(i); | ||
for (let i = 0; i < charLength; ++i) { | ||
let c = s.charAt(i); | ||
if ((c).charCodeAt(0) >= ('\u0001').charCodeAt(0) && (c).charCodeAt(0) <= ('\u007f').charCodeAt(0)) { | ||
@@ -225,3 +224,3 @@ data[len++] = (c).charCodeAt(0); | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -244,7 +243,7 @@ * Puts an UTF8 string into this byte vector. The byte vector is | ||
*/ | ||
ByteVector.prototype.encodeUTF8 = function (s, i, maxByteLength) { | ||
var charLength = s.length; | ||
var byteLength = i; | ||
var c; | ||
for (var j = i; j < charLength; ++j) { | ||
encodeUTF8(s, i, maxByteLength) { | ||
let charLength = s.length; | ||
let byteLength = i; | ||
let c; | ||
for (let j = i; j < charLength; ++j) { | ||
c = s.charAt(j); | ||
@@ -264,3 +263,3 @@ if ((c).charCodeAt(0) >= ('\u0001').charCodeAt(0) && (c).charCodeAt(0) <= ('\u007f').charCodeAt(0)) { | ||
} | ||
var start = this.length - i - 2; | ||
let start = this.length - i - 2; | ||
if (start >= 0) { | ||
@@ -273,4 +272,4 @@ this.data[start] = ((byteLength >>> 8) | 0); | ||
} | ||
var len = this.length; | ||
for (var j = i; j < charLength; ++j) { | ||
let len = this.length; | ||
for (let j = i; j < charLength; ++j) { | ||
c = s.charAt(j); | ||
@@ -292,3 +291,3 @@ if ((c).charCodeAt(0) >= ('\u0001').charCodeAt(0) && (c).charCodeAt(0) <= ('\u007f').charCodeAt(0)) { | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -307,3 +306,3 @@ * Puts an array of bytes into this byte vector. The byte vector is | ||
*/ | ||
ByteVector.prototype.putByteArray = function (b, off, len) { | ||
putByteArray(b, off, len) { | ||
if (this.length + len > this.data.length) { | ||
@@ -313,3 +312,3 @@ this.enlarge(len); | ||
if (b != null) { | ||
for (var i = 0; i < len; i++) { | ||
for (let i = 0; i < len; i++) { | ||
this.data[i + this.length] = b[i + off]; | ||
@@ -321,3 +320,3 @@ } | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -330,12 +329,11 @@ * Enlarge this byte vector so that it can receive n more bytes. | ||
*/ | ||
ByteVector.prototype.enlarge = function (size) { | ||
var length1 = 2 * this.data.length; | ||
var length2 = this.length + size; | ||
var newArr = new Uint8Array(length1 > length2 ? length1 : length2); | ||
enlarge(size) { | ||
let length1 = 2 * this.data.length; | ||
let length2 = this.length + size; | ||
const newArr = new Uint8Array(length1 > length2 ? length1 : length2); | ||
newArr.set(this.data); | ||
this.data = newArr; | ||
}; | ||
return ByteVector; | ||
}()); | ||
} | ||
} | ||
exports.ByteVector = ByteVector; | ||
ByteVector["__class"] = "ByteVector"; |
@@ -43,4 +43,4 @@ "use strict"; | ||
*/ | ||
var Opcodes_1 = require("./Opcodes"); | ||
var ClassVisitor = /** @class */ (function () { | ||
const Opcodes_1 = require("./Opcodes"); | ||
class ClassVisitor { | ||
/** | ||
@@ -56,4 +56,3 @@ * Constructs a new {@link ClassVisitor}. | ||
*/ | ||
function ClassVisitor(api, cv) { | ||
if (cv === void 0) { cv = null; } | ||
constructor(api, cv = null) { | ||
this.api = 0; | ||
@@ -91,7 +90,7 @@ if (api !== Opcodes_1.Opcodes.ASM4 && api !== Opcodes_1.Opcodes.ASM5) { | ||
*/ | ||
ClassVisitor.prototype.visit = function (version, access, name, signature, superName, interfaces) { | ||
visit(version, access, name, signature, superName, interfaces) { | ||
if (this.cv != null) { | ||
this.cv.visit(version, access, name, signature, superName, interfaces); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -108,7 +107,7 @@ * Visits the source of the class. | ||
*/ | ||
ClassVisitor.prototype.visitSource = function (source, debug) { | ||
visitSource(source, debug) { | ||
if (this.cv != null) { | ||
this.cv.visitSource(source, debug); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -129,7 +128,7 @@ * Visits the enclosing class of the class. This method must be called only | ||
*/ | ||
ClassVisitor.prototype.visitOuterClass = function (owner, name, desc) { | ||
visitOuterClass(owner, name, desc) { | ||
if (this.cv != null) { | ||
this.cv.visitOuterClass(owner, name, desc); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -145,3 +144,3 @@ * Visits an annotation of the class. | ||
*/ | ||
ClassVisitor.prototype.visitAnnotation = function (desc, visible) { | ||
visitAnnotation(desc, visible) { | ||
if (this.cv != null) { | ||
@@ -151,3 +150,3 @@ return this.cv.visitAnnotation(desc, visible); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -175,3 +174,3 @@ * Visits an annotation on a type in the class signature. | ||
*/ | ||
ClassVisitor.prototype.visitTypeAnnotation = function (typeRef, typePath, desc, visible) { | ||
visitTypeAnnotation(typeRef, typePath, desc, visible) { | ||
if (this.api < Opcodes_1.Opcodes.ASM5) { | ||
@@ -184,3 +183,3 @@ throw new Error(); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -192,7 +191,7 @@ * Visits a non standard attribute of the class. | ||
*/ | ||
ClassVisitor.prototype.visitAttribute = function (attr) { | ||
visitAttribute(attr) { | ||
if (this.cv != null) { | ||
this.cv.visitAttribute(attr); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -216,7 +215,7 @@ * Visits information about an inner class. This inner class is not | ||
*/ | ||
ClassVisitor.prototype.visitInnerClass = function (name, outerName, innerName, access) { | ||
visitInnerClass(name, outerName, innerName, access) { | ||
if (this.cv != null) { | ||
this.cv.visitInnerClass(name, outerName, innerName, access); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -249,3 +248,3 @@ * Visits a field of the class. | ||
*/ | ||
ClassVisitor.prototype.visitField = function (access, name, desc, signature, value) { | ||
visitField(access, name, desc, signature, value) { | ||
if (this.cv != null) { | ||
@@ -255,3 +254,3 @@ return this.cv.visitField(access, name, desc, signature, value); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -282,3 +281,3 @@ * Visits a method of the class. This method <i>must</i> return a new | ||
*/ | ||
ClassVisitor.prototype.visitMethod = function (access, name, desc, signature, exceptions) { | ||
visitMethod(access, name, desc, signature, exceptions) { | ||
if (this.cv != null) { | ||
@@ -288,3 +287,3 @@ return this.cv.visitMethod(access, name, desc, signature, exceptions); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -295,10 +294,9 @@ * Visits the end of the class. This method, which is the last one to be | ||
*/ | ||
ClassVisitor.prototype.visitEnd = function () { | ||
visitEnd() { | ||
if (this.cv != null) { | ||
this.cv.visitEnd(); | ||
} | ||
}; | ||
return ClassVisitor; | ||
}()); | ||
} | ||
} | ||
exports.ClassVisitor = ClassVisitor; | ||
ClassVisitor["__class"] = "ClassVisitor"; |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -52,12 +42,11 @@ /* | ||
*/ | ||
var AnnotationWriter_1 = require("./AnnotationWriter"); | ||
var ByteVector_1 = require("./ByteVector"); | ||
var ClassReader_1 = require("./ClassReader"); | ||
var ClassVisitor_1 = require("./ClassVisitor"); | ||
var FieldWriter_1 = require("./FieldWriter"); | ||
var Item_1 = require("./Item"); | ||
var MethodWriter_1 = require("./MethodWriter"); | ||
var Opcodes_1 = require("./Opcodes"); | ||
var ClassWriter = /** @class */ (function (_super) { | ||
__extends(ClassWriter, _super); | ||
const AnnotationWriter_1 = require("./AnnotationWriter"); | ||
const ByteVector_1 = require("./ByteVector"); | ||
const ClassReader_1 = require("./ClassReader"); | ||
const ClassVisitor_1 = require("./ClassVisitor"); | ||
const FieldWriter_1 = require("./FieldWriter"); | ||
const Item_1 = require("./Item"); | ||
const MethodWriter_1 = require("./MethodWriter"); | ||
const Opcodes_1 = require("./Opcodes"); | ||
class ClassWriter extends ClassVisitor_1.ClassVisitor { | ||
/** | ||
@@ -95,6 +84,5 @@ * Constructs a new {@link ClassWriter} object and enables optimizations for | ||
*/ | ||
function ClassWriter(classReader, flags) { | ||
var _this = this; | ||
constructor(classReader, flags) { | ||
if (((classReader != null && classReader instanceof ClassReader_1.ClassReader) || classReader === null) && ((typeof flags === 'number') || flags === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
let __args = Array.prototype.slice.call(arguments); | ||
{ | ||
@@ -138,26 +126,26 @@ throw new Error('not supported'); | ||
else if (((typeof classReader === 'number') || classReader === null) && flags === undefined) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
var flags_1 = __args[0]; | ||
_this = _super.call(this, Opcodes_1.Opcodes.ASM5) || this; | ||
_this.version = 0; | ||
_this.index = 0; | ||
_this.threshold = 0; | ||
_this.typeCount = 0; | ||
_this.access = 0; | ||
_this.name = 0; | ||
_this.signature = 0; | ||
_this.superName = 0; | ||
_this.interfaceCount = 0; | ||
_this.sourceFile = 0; | ||
_this.enclosingMethodOwner = 0; | ||
_this.enclosingMethod = 0; | ||
_this.innerClassesCount = 0; | ||
_this.bootstrapMethodsCount = 0; | ||
_this.compute = 0; | ||
_this.hasAsmInsns = false; | ||
(function () { | ||
_this.index = 1; | ||
_this.pool = new ByteVector_1.ByteVector(); | ||
_this.items = new Array(256); | ||
_this.threshold = ((0.75 * _this.items.length) | 0); | ||
let __args = Array.prototype.slice.call(arguments); | ||
let flags = __args[0]; | ||
super(Opcodes_1.Opcodes.ASM5); | ||
this.version = 0; | ||
this.index = 0; | ||
this.threshold = 0; | ||
this.typeCount = 0; | ||
this.access = 0; | ||
this.name = 0; | ||
this.signature = 0; | ||
this.superName = 0; | ||
this.interfaceCount = 0; | ||
this.sourceFile = 0; | ||
this.enclosingMethodOwner = 0; | ||
this.enclosingMethod = 0; | ||
this.innerClassesCount = 0; | ||
this.bootstrapMethodsCount = 0; | ||
this.compute = 0; | ||
this.hasAsmInsns = false; | ||
(() => { | ||
this.index = 1; | ||
this.pool = new ByteVector_1.ByteVector(); | ||
this.items = new Array(256); | ||
this.threshold = ((0.75 * this.items.length) | 0); | ||
// this.key = new Item(); | ||
@@ -167,3 +155,3 @@ // this.key2 = new Item(); | ||
// this.key4 = new Item(); | ||
_this.compute = (flags_1 & ClassWriter.COMPUTE_FRAMES) !== 0 ? MethodWriter_1.MethodWriter.FRAMES : ((flags_1 & ClassWriter.COMPUTE_MAXS) !== 0 ? MethodWriter_1.MethodWriter.MAXS : MethodWriter_1.MethodWriter.NOTHING); | ||
this.compute = (flags & ClassWriter.COMPUTE_FRAMES) !== 0 ? MethodWriter_1.MethodWriter.FRAMES : ((flags & ClassWriter.COMPUTE_MAXS) !== 0 ? MethodWriter_1.MethodWriter.MAXS : MethodWriter_1.MethodWriter.NOTHING); | ||
})(); | ||
@@ -173,17 +161,16 @@ } | ||
throw new Error('invalid overload'); | ||
return _this; | ||
} | ||
ClassWriter.__static_initialize = function () { if (!ClassWriter.__static_initialized) { | ||
static __static_initialize() { if (!ClassWriter.__static_initialized) { | ||
ClassWriter.__static_initialized = true; | ||
ClassWriter.__static_initializer_0(); | ||
} }; | ||
ClassWriter.TO_ACC_SYNTHETIC_$LI$ = function () { ClassWriter.__static_initialize(); if (ClassWriter.TO_ACC_SYNTHETIC == null) | ||
ClassWriter.TO_ACC_SYNTHETIC = (ClassWriter.ACC_SYNTHETIC_ATTRIBUTE / Opcodes_1.Opcodes.ACC_SYNTHETIC | 0); return ClassWriter.TO_ACC_SYNTHETIC; }; | ||
} } | ||
static TO_ACC_SYNTHETIC_$LI$() { ClassWriter.__static_initialize(); if (ClassWriter.TO_ACC_SYNTHETIC == null) | ||
ClassWriter.TO_ACC_SYNTHETIC = (ClassWriter.ACC_SYNTHETIC_ATTRIBUTE / Opcodes_1.Opcodes.ACC_SYNTHETIC | 0); return ClassWriter.TO_ACC_SYNTHETIC; } | ||
; | ||
ClassWriter.TYPE_$LI$ = function () { ClassWriter.__static_initialize(); return ClassWriter.TYPE; }; | ||
static TYPE_$LI$() { ClassWriter.__static_initialize(); return ClassWriter.TYPE; } | ||
; | ||
ClassWriter.__static_initializer_0 = function () { | ||
var i; | ||
var b = new Array(220); | ||
var s = "AAAAAAAAAAAAAAAABCLMMDDDDDEEEEEEEEEEEEEEEEEEEEAAAAAAAADDDDDEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAJJJJJJJJJJJJJJJJDOPAAAAAAGGGGGGGHIFBFAAFFAARQJJKKSSSSSSSSSSSSSSSSSS"; | ||
static __static_initializer_0() { | ||
let i; | ||
let b = new Array(220); | ||
let s = "AAAAAAAAAAAAAAAABCLMMDDDDDEEEEEEEEEEEEEEEEEEEEAAAAAAAADDDDDEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAJJJJJJJJJJJJJJJJDOPAAAAAAGGGGGGGHIFBFAAFFAARQJJKKSSSSSSSSSSSSSSSSSS"; | ||
for (i = 0; i < b.length; ++i) { | ||
@@ -193,4 +180,4 @@ b[i] = (((s.charAt(i)).charCodeAt(0) - ('A').charCodeAt(0)) | 0); | ||
ClassWriter.TYPE = b; | ||
}; | ||
ClassWriter.prototype.visit = function (version, access, name, signature, superName, interfaces) { | ||
} | ||
visit(version, access, name, signature, superName, interfaces) { | ||
this.version = version; | ||
@@ -207,8 +194,8 @@ this.access = access; | ||
this.interfaces = new Array(this.interfaceCount); | ||
for (var i = 0; i < this.interfaceCount; ++i) { | ||
for (let i = 0; i < this.interfaceCount; ++i) { | ||
this.interfaces[i] = this.newClass(interfaces[i]); | ||
} | ||
} | ||
}; | ||
ClassWriter.prototype.visitSource = function (file, debug) { | ||
} | ||
visitSource(file, debug) { | ||
throw new Error('not supported'); | ||
@@ -221,4 +208,4 @@ // if (file != null) { | ||
// } | ||
}; | ||
ClassWriter.prototype.visitOuterClass = function (owner, name, desc) { | ||
} | ||
visitOuterClass(owner, name, desc) { | ||
this.enclosingMethodOwner = this.newClass(owner); | ||
@@ -228,10 +215,10 @@ if (name != null && desc != null) { | ||
} | ||
}; | ||
ClassWriter.prototype.visitAnnotation = function (desc, visible) { | ||
} | ||
visitAnnotation(desc, visible) { | ||
if (!ClassReader_1.ClassReader.ANNOTATIONS) { | ||
return null; | ||
} | ||
var bv = new ByteVector_1.ByteVector(); | ||
let bv = new ByteVector_1.ByteVector(); | ||
bv.putShort(this.newUTF8(desc)).putShort(0); | ||
var aw = new AnnotationWriter_1.AnnotationWriter(this, true, bv, bv, 2); | ||
let aw = new AnnotationWriter_1.AnnotationWriter(this, true, bv, bv, 2); | ||
if (visible) { | ||
@@ -246,11 +233,11 @@ aw.next = this.anns; | ||
return aw; | ||
}; | ||
ClassWriter.prototype.visitTypeAnnotation = function (typeRef, typePath, desc, visible) { | ||
} | ||
visitTypeAnnotation(typeRef, typePath, desc, visible) { | ||
if (!ClassReader_1.ClassReader.ANNOTATIONS) { | ||
return null; | ||
} | ||
var bv = new ByteVector_1.ByteVector(); | ||
let bv = new ByteVector_1.ByteVector(); | ||
AnnotationWriter_1.AnnotationWriter.putTarget(typeRef, typePath, bv); | ||
bv.putShort(this.newUTF8(desc)).putShort(0); | ||
var aw = new AnnotationWriter_1.AnnotationWriter(this, true, bv, bv, bv.length - 2); | ||
let aw = new AnnotationWriter_1.AnnotationWriter(this, true, bv, bv, bv.length - 2); | ||
if (visible) { | ||
@@ -265,12 +252,12 @@ aw.next = this.tanns; | ||
return aw; | ||
}; | ||
ClassWriter.prototype.visitAttribute = function (attr) { | ||
} | ||
visitAttribute(attr) { | ||
attr.next = this.attrs; | ||
this.attrs = attr; | ||
}; | ||
ClassWriter.prototype.visitInnerClass = function (name, outerName, innerName, access) { | ||
} | ||
visitInnerClass(name, outerName, innerName, access) { | ||
if (this.innerClasses == null) { | ||
this.innerClasses = new ByteVector_1.ByteVector(); | ||
} | ||
var nameItem = this.newClassItem(name); | ||
let nameItem = this.newClassItem(name); | ||
if (nameItem.intVal === 0) { | ||
@@ -286,11 +273,11 @@ ++this.innerClassesCount; | ||
} | ||
}; | ||
ClassWriter.prototype.visitField = function (access, name, desc, signature, value) { | ||
} | ||
visitField(access, name, desc, signature, value) { | ||
return new FieldWriter_1.FieldWriter(this, access, name, desc, signature, value); | ||
}; | ||
ClassWriter.prototype.visitMethod = function (access, name, desc, signature, exceptions) { | ||
} | ||
visitMethod(access, name, desc, signature, exceptions) { | ||
return new MethodWriter_1.MethodWriter(this, access, name, desc, signature, exceptions, this.compute); | ||
}; | ||
ClassWriter.prototype.visitEnd = function () { | ||
}; | ||
} | ||
visitEnd() { | ||
} | ||
/** | ||
@@ -301,3 +288,3 @@ * Returns the bytecode of the class that was build with this class writer. | ||
*/ | ||
ClassWriter.prototype.toByteArray = function () { | ||
toByteArray() { | ||
// if (this.index > 65535) { | ||
@@ -480,3 +467,3 @@ // throw new Error("Class file too large!"); | ||
throw new Error('not supported'); | ||
}; | ||
} | ||
/** | ||
@@ -493,3 +480,3 @@ * Adds a number or string constant to the constant pool of the class being | ||
*/ | ||
ClassWriter.prototype.newConstItem = function (cst) { | ||
newConstItem(cst) { | ||
throw new Error("unsupported"); | ||
@@ -538,3 +525,3 @@ // if (typeof cst === 'number') { | ||
// } | ||
}; | ||
} | ||
/** | ||
@@ -553,5 +540,5 @@ * Adds a number or string constant to the constant pool of the class being | ||
*/ | ||
ClassWriter.prototype.newConst = function (cst) { | ||
newConst(cst) { | ||
return this.newConstItem(cst).index; | ||
}; | ||
} | ||
/** | ||
@@ -567,5 +554,5 @@ * Adds an UTF8 string to the constant pool of the class being build. Does | ||
*/ | ||
ClassWriter.prototype.newUTF8 = function (value) { | ||
newUTF8(value) { | ||
this.key.set(ClassWriter.UTF8, value, null, null); | ||
var result = this.get(this.key); | ||
let result = this.get(this.key); | ||
if (result == null) { | ||
@@ -577,3 +564,3 @@ this.pool.putByte(ClassWriter.UTF8).putUTF8(value); | ||
return result.index; | ||
}; | ||
} | ||
/** | ||
@@ -589,5 +576,5 @@ * Adds a class reference to the constant pool of the class being build. | ||
*/ | ||
ClassWriter.prototype.newClassItem = function (value) { | ||
newClassItem(value) { | ||
this.key2.set(ClassWriter.CLASS, value, null, null); | ||
var result = this.get(this.key2); | ||
let result = this.get(this.key2); | ||
if (result == null) { | ||
@@ -599,3 +586,3 @@ this.pool.put12(ClassWriter.CLASS, this.newUTF8(value)); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -611,5 +598,5 @@ * Adds a class reference to the constant pool of the class being build. | ||
*/ | ||
ClassWriter.prototype.newClass = function (value) { | ||
newClass(value) { | ||
return this.newClassItem(value).index; | ||
}; | ||
} | ||
/** | ||
@@ -625,5 +612,5 @@ * Adds a method type reference to the constant pool of the class being | ||
*/ | ||
ClassWriter.prototype.newMethodTypeItem = function (methodDesc) { | ||
newMethodTypeItem(methodDesc) { | ||
this.key2.set(ClassWriter.MTYPE, methodDesc, null, null); | ||
var result = this.get(this.key2); | ||
let result = this.get(this.key2); | ||
if (result == null) { | ||
@@ -635,3 +622,3 @@ this.pool.put12(ClassWriter.MTYPE, this.newUTF8(methodDesc)); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -648,5 +635,5 @@ * Adds a method type reference to the constant pool of the class being | ||
*/ | ||
ClassWriter.prototype.newMethodType = function (methodDesc) { | ||
newMethodType(methodDesc) { | ||
return this.newMethodTypeItem(methodDesc).index; | ||
}; | ||
} | ||
/** | ||
@@ -676,5 +663,5 @@ * Adds a handle to the constant pool of the class being build. Does nothing | ||
*/ | ||
ClassWriter.prototype.newHandleItem = function (tag, owner, name, desc, itf) { | ||
newHandleItem(tag, owner, name, desc, itf) { | ||
this.key4.set(ClassWriter.HANDLE_BASE + tag, owner, name, desc); | ||
var result = this.get(this.key4); | ||
let result = this.get(this.key4); | ||
if (result == null) { | ||
@@ -691,3 +678,3 @@ if (tag <= Opcodes_1.Opcodes.H_PUTSTATIC) { | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -719,5 +706,5 @@ * Adds a handle to the constant pool of the class being build. Does nothing | ||
*/ | ||
ClassWriter.prototype.newHandle$int$java_lang_String$java_lang_String$java_lang_String = function (tag, owner, name, desc) { | ||
newHandle$int$java_lang_String$java_lang_String$java_lang_String(tag, owner, name, desc) { | ||
return this.newHandle(tag, owner, name, desc, tag === Opcodes_1.Opcodes.H_INVOKEINTERFACE); | ||
}; | ||
} | ||
/** | ||
@@ -748,8 +735,7 @@ * Adds a handle to the constant pool of the class being build. Does nothing | ||
*/ | ||
ClassWriter.prototype.newHandle = function (tag, owner, name, desc, itf) { | ||
var _this = this; | ||
newHandle(tag, owner, name, desc, itf) { | ||
if (((typeof tag === 'number') || tag === null) && ((typeof owner === 'string') || owner === null) && ((typeof name === 'string') || name === null) && ((typeof desc === 'string') || desc === null) && ((typeof itf === 'boolean') || itf === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
return (function () { | ||
return _this.newHandleItem(tag, owner, name, desc, itf).index; | ||
let __args = Array.prototype.slice.call(arguments); | ||
return (() => { | ||
return this.newHandleItem(tag, owner, name, desc, itf).index; | ||
})(); | ||
@@ -762,3 +748,3 @@ } | ||
throw new Error('invalid overload'); | ||
}; | ||
} | ||
/** | ||
@@ -781,25 +767,21 @@ * Adds an invokedynamic reference to the constant pool of the class being | ||
*/ | ||
ClassWriter.prototype.newInvokeDynamicItem = function (name, desc, bsm) { | ||
var bsmArgs = []; | ||
for (var _i = 3; _i < arguments.length; _i++) { | ||
bsmArgs[_i - 3] = arguments[_i]; | ||
} | ||
var bootstrapMethods = this.bootstrapMethods; | ||
newInvokeDynamicItem(name, desc, bsm, ...bsmArgs) { | ||
let bootstrapMethods = this.bootstrapMethods; | ||
if (bootstrapMethods == null) { | ||
bootstrapMethods = this.bootstrapMethods = new ByteVector_1.ByteVector(); | ||
} | ||
var position = bootstrapMethods.length; | ||
var hashCode = bsm.hashCode(); | ||
let position = bootstrapMethods.length; | ||
let hashCode = bsm.hashCode(); | ||
bootstrapMethods.putShort(this.newHandle(bsm.tag, bsm.owner, bsm.name, bsm.descriptor, bsm.isInterface)); | ||
var argsLength = bsmArgs.length; | ||
let argsLength = bsmArgs.length; | ||
bootstrapMethods.putShort(argsLength); | ||
for (var i = 0; i < argsLength; i++) { | ||
var bsmArg = bsmArgs[i]; | ||
for (let i = 0; i < argsLength; i++) { | ||
let bsmArg = bsmArgs[i]; | ||
hashCode ^= bsmArg.toString(); | ||
bootstrapMethods.putShort(this.newConst(bsmArg)); | ||
} | ||
var data = bootstrapMethods.data; | ||
var length = (1 + 1 + argsLength) << 1; | ||
let data = bootstrapMethods.data; | ||
let length = (1 + 1 + argsLength) << 1; | ||
hashCode &= 2147483647; | ||
var result = this.items[hashCode % this.items.length]; | ||
let result = this.items[hashCode % this.items.length]; | ||
loop: while ((result != null)) { | ||
@@ -810,4 +792,4 @@ if (result.type !== ClassWriter.BSM || result.__hashCode !== hashCode) { | ||
} | ||
var resultPosition = result.intVal; | ||
for (var p = 0; p < length; p++) { | ||
let resultPosition = result.intVal; | ||
for (let p = 0; p < length; p++) { | ||
if (data[position + p] !== data[resultPosition + p]) { | ||
@@ -821,3 +803,3 @@ result = result.next; | ||
; | ||
var bootstrapMethodIndex; | ||
let bootstrapMethodIndex; | ||
if (result != null) { | ||
@@ -841,3 +823,3 @@ bootstrapMethodIndex = result.index; | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -861,9 +843,5 @@ * Adds an invokedynamic reference to the constant pool of the class being | ||
*/ | ||
ClassWriter.prototype.newInvokeDynamic = function (name, desc, bsm) { | ||
var bsmArgs = []; | ||
for (var _i = 3; _i < arguments.length; _i++) { | ||
bsmArgs[_i - 3] = arguments[_i]; | ||
} | ||
newInvokeDynamic(name, desc, bsm, ...bsmArgs) { | ||
return this.newInvokeDynamicItem.apply(this, [name, desc, bsm].concat(bsmArgs)).index; | ||
}; | ||
} | ||
/** | ||
@@ -881,5 +859,5 @@ * Adds a field reference to the constant pool of the class being build. | ||
*/ | ||
ClassWriter.prototype.newFieldItem = function (owner, name, desc) { | ||
newFieldItem(owner, name, desc) { | ||
this.key3.set(ClassWriter.FIELD, owner, name, desc); | ||
var result = this.get(this.key3); | ||
let result = this.get(this.key3); | ||
if (result == null) { | ||
@@ -891,3 +869,3 @@ this.put122(ClassWriter.FIELD, this.newClass(owner), this.newNameType(name, desc)); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -907,5 +885,5 @@ * Adds a field reference to the constant pool of the class being build. | ||
*/ | ||
ClassWriter.prototype.newField = function (owner, name, desc) { | ||
newField(owner, name, desc) { | ||
return this.newFieldItem(owner, name, desc).index; | ||
}; | ||
} | ||
/** | ||
@@ -925,6 +903,6 @@ * Adds a method reference to the constant pool of the class being build. | ||
*/ | ||
ClassWriter.prototype.newMethodItem = function (owner, name, desc, itf) { | ||
var type = itf ? ClassWriter.IMETH : ClassWriter.METH; | ||
newMethodItem(owner, name, desc, itf) { | ||
let type = itf ? ClassWriter.IMETH : ClassWriter.METH; | ||
this.key3.set(type, owner, name, desc); | ||
var result = this.get(this.key3); | ||
let result = this.get(this.key3); | ||
if (result == null) { | ||
@@ -936,3 +914,3 @@ this.put122(type, this.newClass(owner), this.newNameType(name, desc)); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -954,5 +932,5 @@ * Adds a method reference to the constant pool of the class being build. | ||
*/ | ||
ClassWriter.prototype.newMethod = function (owner, name, desc, itf) { | ||
newMethod(owner, name, desc, itf) { | ||
return this.newMethodItem(owner, name, desc, itf).index; | ||
}; | ||
} | ||
/** | ||
@@ -966,5 +944,5 @@ * Adds an integer to the constant pool of the class being build. Does | ||
*/ | ||
ClassWriter.prototype.newInteger = function (value) { | ||
newInteger(value) { | ||
this.key.set$int(value); | ||
var result = this.get(this.key); | ||
let result = this.get(this.key); | ||
if (result == null) { | ||
@@ -976,3 +954,3 @@ this.pool.putByte(ClassWriter.INT).putInt(value); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -986,5 +964,5 @@ * Adds a float to the constant pool of the class being build. Does nothing | ||
*/ | ||
ClassWriter.prototype.newFloat = function (value) { | ||
newFloat(value) { | ||
this.key.set$float(value); | ||
var result = this.get(this.key); | ||
let result = this.get(this.key); | ||
if (result == null) { | ||
@@ -996,3 +974,3 @@ this.pool.putByte(ClassWriter.FLOAT).putInt(this.key.intVal); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -1006,5 +984,5 @@ * Adds a long to the constant pool of the class being build. Does nothing | ||
*/ | ||
ClassWriter.prototype.newLong = function (value) { | ||
newLong(value) { | ||
this.key.set$long(value); | ||
var result = this.get(this.key); | ||
let result = this.get(this.key); | ||
if (result == null) { | ||
@@ -1017,3 +995,3 @@ this.pool.putByte(ClassWriter.LONG).putLong(value); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -1027,5 +1005,5 @@ * Adds a double to the constant pool of the class being build. Does nothing | ||
*/ | ||
ClassWriter.prototype.newDouble = function (value) { | ||
newDouble(value) { | ||
this.key.set$double(value); | ||
var result = this.get(this.key); | ||
let result = this.get(this.key); | ||
if (result == null) { | ||
@@ -1038,3 +1016,3 @@ this.pool.putByte(ClassWriter.DOUBLE).putLong(this.key.longVal); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -1048,5 +1026,5 @@ * Adds a string to the constant pool of the class being build. Does nothing | ||
*/ | ||
ClassWriter.prototype.newString = function (value) { | ||
newString(value) { | ||
this.key2.set(ClassWriter.STR, value, null, null); | ||
var result = this.get(this.key2); | ||
let result = this.get(this.key2); | ||
if (result == null) { | ||
@@ -1058,3 +1036,3 @@ this.pool.put12(ClassWriter.STR, this.newUTF8(value)); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -1072,5 +1050,5 @@ * Adds a name and type to the constant pool of the class being build. Does | ||
*/ | ||
ClassWriter.prototype.newNameType = function (name, desc) { | ||
newNameType(name, desc) { | ||
return this.newNameTypeItem(name, desc).index; | ||
}; | ||
} | ||
/** | ||
@@ -1086,5 +1064,5 @@ * Adds a name and type to the constant pool of the class being build. Does | ||
*/ | ||
ClassWriter.prototype.newNameTypeItem = function (name, desc) { | ||
newNameTypeItem(name, desc) { | ||
this.key2.set(ClassWriter.NAME_TYPE, name, desc, null); | ||
var result = this.get(this.key2); | ||
let result = this.get(this.key2); | ||
if (result == null) { | ||
@@ -1096,3 +1074,3 @@ this.put122(ClassWriter.NAME_TYPE, this.newUTF8(name), this.newUTF8(desc)); | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -1106,11 +1084,10 @@ * Adds the given internal name to {@link #typeTable} and returns its index. | ||
*/ | ||
ClassWriter.prototype.addType = function (type) { | ||
var _this = this; | ||
addType(type) { | ||
if (((typeof type === 'string') || type === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
return (function () { | ||
_this.key.set(ClassWriter.TYPE_NORMAL, type, null, null); | ||
var result = _this.get(_this.key); | ||
let __args = Array.prototype.slice.call(arguments); | ||
return (() => { | ||
this.key.set(ClassWriter.TYPE_NORMAL, type, null, null); | ||
let result = this.get(this.key); | ||
if (result == null) { | ||
result = _this.addType(_this.key); | ||
result = this.addType(this.key); | ||
} | ||
@@ -1125,3 +1102,3 @@ return result.index; | ||
throw new Error('invalid overload'); | ||
}; | ||
} | ||
/** | ||
@@ -1139,3 +1116,3 @@ * Adds the given "uninitialized" type to {@link #typeTable} and returns its | ||
*/ | ||
ClassWriter.prototype.addUninitializedType = function (type, offset) { | ||
addUninitializedType(type, offset) { | ||
this.key.type = ClassWriter.TYPE_UNINIT; | ||
@@ -1145,3 +1122,3 @@ this.key.intVal = offset; | ||
this.key.__hashCode = 2147483647 & (ClassWriter.TYPE_UNINIT + type.toString() + offset); | ||
var result = this.get(this.key); | ||
let result = this.get(this.key); | ||
if (result == null) { | ||
@@ -1151,3 +1128,3 @@ result = this.addType(this.key); | ||
return result.index; | ||
}; | ||
} | ||
/** | ||
@@ -1161,3 +1138,3 @@ * Adds the given Item to {@link #typeTable}. | ||
*/ | ||
ClassWriter.prototype.addType$Item = function (item) { | ||
addType$Item(item) { | ||
throw new Error('not supported'); | ||
@@ -1177,3 +1154,3 @@ // ++this.typeCount; | ||
// return result; | ||
}; | ||
} | ||
/** | ||
@@ -1191,3 +1168,3 @@ * Returns the index of the common super type of the two given types. This | ||
*/ | ||
ClassWriter.prototype.getMergedType = function (type1, type2) { | ||
getMergedType(type1, type2) { | ||
throw new Error('not supported'); | ||
@@ -1206,3 +1183,3 @@ // this.key2.type = ClassWriter.TYPE_MERGED; | ||
// return result.intVal; | ||
}; | ||
} | ||
/** | ||
@@ -1224,3 +1201,3 @@ * Returns the common super type of the two given types. The default | ||
*/ | ||
ClassWriter.prototype.getCommonSuperClass = function (type1, type2) { | ||
getCommonSuperClass(type1, type2) { | ||
return 'java/lang/Object'; | ||
@@ -1251,3 +1228,3 @@ //break.... | ||
// } | ||
}; | ||
} | ||
/** | ||
@@ -1262,4 +1239,4 @@ * Returns the constant pool's hash table item which is equal to the given | ||
*/ | ||
ClassWriter.prototype.get = function (key) { | ||
var i = this.items[key.__hashCode % this.items.length]; | ||
get(key) { | ||
let i = this.items[key.__hashCode % this.items.length]; | ||
while ((i != null && (i.type !== key.type || !key.isEqualTo(i)))) { | ||
@@ -1270,3 +1247,3 @@ i = i.next; | ||
return i; | ||
}; | ||
} | ||
/** | ||
@@ -1279,14 +1256,14 @@ * Puts the given item in the constant pool's hash table. The hash table | ||
*/ | ||
ClassWriter.prototype.put = function (i) { | ||
put(i) { | ||
if (this.index + this.typeCount > this.threshold) { | ||
var ll = this.items.length; | ||
var nl = ll * 2 + 1; | ||
var newItems = new Array(nl); | ||
for (var l = ll - 1; l >= 0; --l) { | ||
var j = this.items[l]; | ||
let ll = this.items.length; | ||
let nl = ll * 2 + 1; | ||
let newItems = new Array(nl); | ||
for (let l = ll - 1; l >= 0; --l) { | ||
let j = this.items[l]; | ||
while ((j != null)) { | ||
var index_1 = j.__hashCode % newItems.length; | ||
var k = j.next; | ||
j.next = newItems[index_1]; | ||
newItems[index_1] = j; | ||
let index = j.__hashCode % newItems.length; | ||
let k = j.next; | ||
j.next = newItems[index]; | ||
newItems[index] = j; | ||
j = k; | ||
@@ -1299,6 +1276,6 @@ } | ||
} | ||
var index = i.__hashCode % this.items.length; | ||
let index = i.__hashCode % this.items.length; | ||
i.next = this.items[index]; | ||
this.items[index] = i; | ||
}; | ||
} | ||
/** | ||
@@ -1314,5 +1291,5 @@ * Puts one byte and two shorts into the constant pool. | ||
*/ | ||
ClassWriter.prototype.put122 = function (b, s1, s2) { | ||
put122(b, s1, s2) { | ||
this.pool.put12(b, s1).putShort(s2); | ||
}; | ||
} | ||
/** | ||
@@ -1328,209 +1305,208 @@ * Puts two bytes and one short into the constant pool. | ||
*/ | ||
ClassWriter.prototype.put112 = function (b1, b2, s) { | ||
put112(b1, b2, s) { | ||
this.pool.put11(b1, b2).putShort(s); | ||
}; | ||
ClassWriter.__static_initialized = false; | ||
/** | ||
* Flag to automatically compute the maximum stack size and the maximum | ||
* number of local variables of methods. If this flag is set, then the | ||
* arguments of the {@link MethodVisitor#visitMaxs visitMaxs} method of the | ||
* {@link MethodVisitor} returned by the {@link #visitMethod visitMethod} | ||
* method will be ignored, and computed automatically from the signature and | ||
* the bytecode of each method. | ||
* | ||
* @see #ClassWriter(int) | ||
*/ | ||
ClassWriter.COMPUTE_MAXS = 1; | ||
/** | ||
* Flag to automatically compute the stack map frames of methods from | ||
* scratch. If this flag is set, then the calls to the | ||
* {@link MethodVisitor#visitFrame} method are ignored, and the stack map | ||
* frames are recomputed from the methods bytecode. The arguments of the | ||
* {@link MethodVisitor#visitMaxs visitMaxs} method are also ignored and | ||
* recomputed from the bytecode. In other words, COMPUTE_FRAMES implies | ||
* COMPUTE_MAXS. | ||
* | ||
* @see #ClassWriter(int) | ||
*/ | ||
ClassWriter.COMPUTE_FRAMES = 2; | ||
/** | ||
* Pseudo access flag to distinguish between the synthetic attribute and the | ||
* synthetic access flag. | ||
*/ | ||
ClassWriter.ACC_SYNTHETIC_ATTRIBUTE = 262144; | ||
/** | ||
* The type of instructions without any argument. | ||
*/ | ||
ClassWriter.NOARG_INSN = 0; | ||
/** | ||
* The type of instructions with an signed byte argument. | ||
*/ | ||
ClassWriter.SBYTE_INSN = 1; | ||
/** | ||
* The type of instructions with an signed short argument. | ||
*/ | ||
ClassWriter.SHORT_INSN = 2; | ||
/** | ||
* The type of instructions with a local variable index argument. | ||
*/ | ||
ClassWriter.VAR_INSN = 3; | ||
/** | ||
* The type of instructions with an implicit local variable index argument. | ||
*/ | ||
ClassWriter.IMPLVAR_INSN = 4; | ||
/** | ||
* The type of instructions with a type descriptor argument. | ||
*/ | ||
ClassWriter.TYPE_INSN = 5; | ||
/** | ||
* The type of field and method invocations instructions. | ||
*/ | ||
ClassWriter.FIELDORMETH_INSN = 6; | ||
/** | ||
* The type of the INVOKEINTERFACE/INVOKEDYNAMIC instruction. | ||
*/ | ||
ClassWriter.ITFMETH_INSN = 7; | ||
/** | ||
* The type of the INVOKEDYNAMIC instruction. | ||
*/ | ||
ClassWriter.INDYMETH_INSN = 8; | ||
/** | ||
* The type of instructions with a 2 bytes bytecode offset label. | ||
*/ | ||
ClassWriter.LABEL_INSN = 9; | ||
/** | ||
* The type of instructions with a 4 bytes bytecode offset label. | ||
*/ | ||
ClassWriter.LABELW_INSN = 10; | ||
/** | ||
* The type of the LDC instruction. | ||
*/ | ||
ClassWriter.LDC_INSN = 11; | ||
/** | ||
* The type of the LDC_W and LDC2_W instructions. | ||
*/ | ||
ClassWriter.LDCW_INSN = 12; | ||
/** | ||
* The type of the IINC instruction. | ||
*/ | ||
ClassWriter.IINC_INSN = 13; | ||
/** | ||
* The type of the TABLESWITCH instruction. | ||
*/ | ||
ClassWriter.TABL_INSN = 14; | ||
/** | ||
* The type of the LOOKUPSWITCH instruction. | ||
*/ | ||
ClassWriter.LOOK_INSN = 15; | ||
/** | ||
* The type of the MULTIANEWARRAY instruction. | ||
*/ | ||
ClassWriter.MANA_INSN = 16; | ||
/** | ||
* The type of the WIDE instruction. | ||
*/ | ||
ClassWriter.WIDE_INSN = 17; | ||
/** | ||
* The type of the ASM pseudo instructions with an unsigned 2 bytes offset | ||
* label (see Label#resolve). | ||
*/ | ||
ClassWriter.ASM_LABEL_INSN = 18; | ||
/** | ||
* Represents a frame inserted between already existing frames. This kind of | ||
* frame can only be used if the frame content can be computed from the | ||
* previous existing frame and from the instructions between this existing | ||
* frame and the inserted one, without any knowledge of the type hierarchy. | ||
* This kind of frame is only used when an unconditional jump is inserted in | ||
* a method while expanding an ASM pseudo instruction (see ClassReader). | ||
*/ | ||
ClassWriter.F_INSERT = 256; | ||
/** | ||
* The type of CONSTANT_Class constant pool items. | ||
*/ | ||
ClassWriter.CLASS = 7; | ||
/** | ||
* The type of CONSTANT_Fieldref constant pool items. | ||
*/ | ||
ClassWriter.FIELD = 9; | ||
/** | ||
* The type of CONSTANT_Methodref constant pool items. | ||
*/ | ||
ClassWriter.METH = 10; | ||
/** | ||
* The type of CONSTANT_InterfaceMethodref constant pool items. | ||
*/ | ||
ClassWriter.IMETH = 11; | ||
/** | ||
* The type of CONSTANT_String constant pool items. | ||
*/ | ||
ClassWriter.STR = 8; | ||
/** | ||
* The type of CONSTANT_Integer constant pool items. | ||
*/ | ||
ClassWriter.INT = 3; | ||
/** | ||
* The type of CONSTANT_Float constant pool items. | ||
*/ | ||
ClassWriter.FLOAT = 4; | ||
/** | ||
* The type of CONSTANT_Long constant pool items. | ||
*/ | ||
ClassWriter.LONG = 5; | ||
/** | ||
* The type of CONSTANT_Double constant pool items. | ||
*/ | ||
ClassWriter.DOUBLE = 6; | ||
/** | ||
* The type of CONSTANT_NameAndType constant pool items. | ||
*/ | ||
ClassWriter.NAME_TYPE = 12; | ||
/** | ||
* The type of CONSTANT_Utf8 constant pool items. | ||
*/ | ||
ClassWriter.UTF8 = 1; | ||
/** | ||
* The type of CONSTANT_MethodType constant pool items. | ||
*/ | ||
ClassWriter.MTYPE = 16; | ||
/** | ||
* The type of CONSTANT_MethodHandle constant pool items. | ||
*/ | ||
ClassWriter.HANDLE = 15; | ||
/** | ||
* The type of CONSTANT_InvokeDynamic constant pool items. | ||
*/ | ||
ClassWriter.INDY = 18; | ||
/** | ||
* The base value for all CONSTANT_MethodHandle constant pool items. | ||
* Internally, ASM store the 9 variations of CONSTANT_MethodHandle into 9 | ||
* different items. | ||
*/ | ||
ClassWriter.HANDLE_BASE = 20; | ||
/** | ||
* Normal type Item stored in the ClassWriter {@link ClassWriter#typeTable}, | ||
* instead of the constant pool, in order to avoid clashes with normal | ||
* constant pool items in the ClassWriter constant pool's hash table. | ||
*/ | ||
ClassWriter.TYPE_NORMAL = 30; | ||
/** | ||
* Uninitialized type Item stored in the ClassWriter | ||
* {@link ClassWriter#typeTable}, instead of the constant pool, in order to | ||
* avoid clashes with normal constant pool items in the ClassWriter constant | ||
* pool's hash table. | ||
*/ | ||
ClassWriter.TYPE_UNINIT = 31; | ||
/** | ||
* Merged type Item stored in the ClassWriter {@link ClassWriter#typeTable}, | ||
* instead of the constant pool, in order to avoid clashes with normal | ||
* constant pool items in the ClassWriter constant pool's hash table. | ||
*/ | ||
ClassWriter.TYPE_MERGED = 32; | ||
/** | ||
* The type of BootstrapMethods items. These items are stored in a special | ||
* class attribute named BootstrapMethods and not in the constant pool. | ||
*/ | ||
ClassWriter.BSM = 33; | ||
return ClassWriter; | ||
}(ClassVisitor_1.ClassVisitor)); | ||
} | ||
} | ||
exports.ClassWriter = ClassWriter; | ||
ClassWriter.__static_initialized = false; | ||
/** | ||
* Flag to automatically compute the maximum stack size and the maximum | ||
* number of local variables of methods. If this flag is set, then the | ||
* arguments of the {@link MethodVisitor#visitMaxs visitMaxs} method of the | ||
* {@link MethodVisitor} returned by the {@link #visitMethod visitMethod} | ||
* method will be ignored, and computed automatically from the signature and | ||
* the bytecode of each method. | ||
* | ||
* @see #ClassWriter(int) | ||
*/ | ||
ClassWriter.COMPUTE_MAXS = 1; | ||
/** | ||
* Flag to automatically compute the stack map frames of methods from | ||
* scratch. If this flag is set, then the calls to the | ||
* {@link MethodVisitor#visitFrame} method are ignored, and the stack map | ||
* frames are recomputed from the methods bytecode. The arguments of the | ||
* {@link MethodVisitor#visitMaxs visitMaxs} method are also ignored and | ||
* recomputed from the bytecode. In other words, COMPUTE_FRAMES implies | ||
* COMPUTE_MAXS. | ||
* | ||
* @see #ClassWriter(int) | ||
*/ | ||
ClassWriter.COMPUTE_FRAMES = 2; | ||
/** | ||
* Pseudo access flag to distinguish between the synthetic attribute and the | ||
* synthetic access flag. | ||
*/ | ||
ClassWriter.ACC_SYNTHETIC_ATTRIBUTE = 262144; | ||
/** | ||
* The type of instructions without any argument. | ||
*/ | ||
ClassWriter.NOARG_INSN = 0; | ||
/** | ||
* The type of instructions with an signed byte argument. | ||
*/ | ||
ClassWriter.SBYTE_INSN = 1; | ||
/** | ||
* The type of instructions with an signed short argument. | ||
*/ | ||
ClassWriter.SHORT_INSN = 2; | ||
/** | ||
* The type of instructions with a local variable index argument. | ||
*/ | ||
ClassWriter.VAR_INSN = 3; | ||
/** | ||
* The type of instructions with an implicit local variable index argument. | ||
*/ | ||
ClassWriter.IMPLVAR_INSN = 4; | ||
/** | ||
* The type of instructions with a type descriptor argument. | ||
*/ | ||
ClassWriter.TYPE_INSN = 5; | ||
/** | ||
* The type of field and method invocations instructions. | ||
*/ | ||
ClassWriter.FIELDORMETH_INSN = 6; | ||
/** | ||
* The type of the INVOKEINTERFACE/INVOKEDYNAMIC instruction. | ||
*/ | ||
ClassWriter.ITFMETH_INSN = 7; | ||
/** | ||
* The type of the INVOKEDYNAMIC instruction. | ||
*/ | ||
ClassWriter.INDYMETH_INSN = 8; | ||
/** | ||
* The type of instructions with a 2 bytes bytecode offset label. | ||
*/ | ||
ClassWriter.LABEL_INSN = 9; | ||
/** | ||
* The type of instructions with a 4 bytes bytecode offset label. | ||
*/ | ||
ClassWriter.LABELW_INSN = 10; | ||
/** | ||
* The type of the LDC instruction. | ||
*/ | ||
ClassWriter.LDC_INSN = 11; | ||
/** | ||
* The type of the LDC_W and LDC2_W instructions. | ||
*/ | ||
ClassWriter.LDCW_INSN = 12; | ||
/** | ||
* The type of the IINC instruction. | ||
*/ | ||
ClassWriter.IINC_INSN = 13; | ||
/** | ||
* The type of the TABLESWITCH instruction. | ||
*/ | ||
ClassWriter.TABL_INSN = 14; | ||
/** | ||
* The type of the LOOKUPSWITCH instruction. | ||
*/ | ||
ClassWriter.LOOK_INSN = 15; | ||
/** | ||
* The type of the MULTIANEWARRAY instruction. | ||
*/ | ||
ClassWriter.MANA_INSN = 16; | ||
/** | ||
* The type of the WIDE instruction. | ||
*/ | ||
ClassWriter.WIDE_INSN = 17; | ||
/** | ||
* The type of the ASM pseudo instructions with an unsigned 2 bytes offset | ||
* label (see Label#resolve). | ||
*/ | ||
ClassWriter.ASM_LABEL_INSN = 18; | ||
/** | ||
* Represents a frame inserted between already existing frames. This kind of | ||
* frame can only be used if the frame content can be computed from the | ||
* previous existing frame and from the instructions between this existing | ||
* frame and the inserted one, without any knowledge of the type hierarchy. | ||
* This kind of frame is only used when an unconditional jump is inserted in | ||
* a method while expanding an ASM pseudo instruction (see ClassReader). | ||
*/ | ||
ClassWriter.F_INSERT = 256; | ||
/** | ||
* The type of CONSTANT_Class constant pool items. | ||
*/ | ||
ClassWriter.CLASS = 7; | ||
/** | ||
* The type of CONSTANT_Fieldref constant pool items. | ||
*/ | ||
ClassWriter.FIELD = 9; | ||
/** | ||
* The type of CONSTANT_Methodref constant pool items. | ||
*/ | ||
ClassWriter.METH = 10; | ||
/** | ||
* The type of CONSTANT_InterfaceMethodref constant pool items. | ||
*/ | ||
ClassWriter.IMETH = 11; | ||
/** | ||
* The type of CONSTANT_String constant pool items. | ||
*/ | ||
ClassWriter.STR = 8; | ||
/** | ||
* The type of CONSTANT_Integer constant pool items. | ||
*/ | ||
ClassWriter.INT = 3; | ||
/** | ||
* The type of CONSTANT_Float constant pool items. | ||
*/ | ||
ClassWriter.FLOAT = 4; | ||
/** | ||
* The type of CONSTANT_Long constant pool items. | ||
*/ | ||
ClassWriter.LONG = 5; | ||
/** | ||
* The type of CONSTANT_Double constant pool items. | ||
*/ | ||
ClassWriter.DOUBLE = 6; | ||
/** | ||
* The type of CONSTANT_NameAndType constant pool items. | ||
*/ | ||
ClassWriter.NAME_TYPE = 12; | ||
/** | ||
* The type of CONSTANT_Utf8 constant pool items. | ||
*/ | ||
ClassWriter.UTF8 = 1; | ||
/** | ||
* The type of CONSTANT_MethodType constant pool items. | ||
*/ | ||
ClassWriter.MTYPE = 16; | ||
/** | ||
* The type of CONSTANT_MethodHandle constant pool items. | ||
*/ | ||
ClassWriter.HANDLE = 15; | ||
/** | ||
* The type of CONSTANT_InvokeDynamic constant pool items. | ||
*/ | ||
ClassWriter.INDY = 18; | ||
/** | ||
* The base value for all CONSTANT_MethodHandle constant pool items. | ||
* Internally, ASM store the 9 variations of CONSTANT_MethodHandle into 9 | ||
* different items. | ||
*/ | ||
ClassWriter.HANDLE_BASE = 20; | ||
/** | ||
* Normal type Item stored in the ClassWriter {@link ClassWriter#typeTable}, | ||
* instead of the constant pool, in order to avoid clashes with normal | ||
* constant pool items in the ClassWriter constant pool's hash table. | ||
*/ | ||
ClassWriter.TYPE_NORMAL = 30; | ||
/** | ||
* Uninitialized type Item stored in the ClassWriter | ||
* {@link ClassWriter#typeTable}, instead of the constant pool, in order to | ||
* avoid clashes with normal constant pool items in the ClassWriter constant | ||
* pool's hash table. | ||
*/ | ||
ClassWriter.TYPE_UNINIT = 31; | ||
/** | ||
* Merged type Item stored in the ClassWriter {@link ClassWriter#typeTable}, | ||
* instead of the constant pool, in order to avoid clashes with normal | ||
* constant pool items in the ClassWriter constant pool's hash table. | ||
*/ | ||
ClassWriter.TYPE_MERGED = 32; | ||
/** | ||
* The type of BootstrapMethods items. These items are stored in a special | ||
* class attribute named BootstrapMethods and not in the constant pool. | ||
*/ | ||
ClassWriter.BSM = 33; | ||
ClassWriter["__class"] = "ClassWriter"; | ||
@@ -1537,0 +1513,0 @@ ClassWriter.TYPE_$LI$(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Context = /** @class */ (function () { | ||
function Context() { | ||
class Context { | ||
constructor() { | ||
this.flags = 0; | ||
@@ -14,5 +14,4 @@ this.access = 0; | ||
} | ||
return Context; | ||
}()); | ||
} | ||
exports.Context = Context; | ||
Context["__class"] = "Context"; |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -50,8 +40,4 @@ /* | ||
*/ | ||
var Frame_1 = require("./Frame"); | ||
var CurrentFrame = /** @class */ (function (_super) { | ||
__extends(CurrentFrame, _super); | ||
function CurrentFrame() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
const Frame_1 = require("./Frame"); | ||
class CurrentFrame extends Frame_1.Frame { | ||
/** | ||
@@ -63,12 +49,11 @@ * Sets this CurrentFrame to the input stack map frame of the next "current" | ||
*/ | ||
CurrentFrame.prototype.execute = function (opcode, arg, cw, item) { | ||
_super.prototype.execute.call(this, opcode, arg, cw, item); | ||
var successor = new Frame_1.Frame(); | ||
execute(opcode, arg, cw, item) { | ||
super.execute(opcode, arg, cw, item); | ||
let successor = new Frame_1.Frame(); | ||
this.merge(cw, successor, 0); | ||
this.set(successor); | ||
this.owner.inputStackTop = 0; | ||
}; | ||
return CurrentFrame; | ||
}(Frame_1.Frame)); | ||
} | ||
} | ||
exports.CurrentFrame = CurrentFrame; | ||
CurrentFrame["__class"] = "CurrentFrame"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Edge = /** @class */ (function () { | ||
function Edge() { | ||
class Edge { | ||
constructor() { | ||
this.info = 0; | ||
} | ||
/** | ||
* Denotes a normal control flow graph edge. | ||
*/ | ||
Edge.NORMAL = 0; | ||
/** | ||
* Denotes a control flow graph edge corresponding to an exception handler. | ||
* More precisely any {@link Edge} whose {@link #info} is strictly positive | ||
* corresponds to an exception handler. The actual value of {@link #info} is | ||
* the index, in the {@link ClassWriter} type table, of the exception that | ||
* is catched. | ||
*/ | ||
Edge.EXCEPTION = 2147483647; | ||
return Edge; | ||
}()); | ||
} | ||
exports.Edge = Edge; | ||
/** | ||
* Denotes a normal control flow graph edge. | ||
*/ | ||
Edge.NORMAL = 0; | ||
/** | ||
* Denotes a control flow graph edge corresponding to an exception handler. | ||
* More precisely any {@link Edge} whose {@link #info} is strictly positive | ||
* corresponds to an exception handler. The actual value of {@link #info} is | ||
* the index, in the {@link ClassWriter} type table, of the exception that | ||
* is catched. | ||
*/ | ||
Edge.EXCEPTION = 2147483647; |
@@ -40,4 +40,4 @@ "use strict"; | ||
*/ | ||
var Opcodes_1 = require("./Opcodes"); | ||
var FieldVisitor = /** @class */ (function () { | ||
const Opcodes_1 = require("./Opcodes"); | ||
class FieldVisitor { | ||
/** | ||
@@ -53,4 +53,3 @@ * Constructs a new {@link FieldVisitor}. | ||
*/ | ||
function FieldVisitor(api, fv) { | ||
if (fv === void 0) { fv = null; } | ||
constructor(api, fv = null) { | ||
this.api = 0; | ||
@@ -73,3 +72,3 @@ if (api !== Opcodes_1.Opcodes.ASM4 && api !== Opcodes_1.Opcodes.ASM5) { | ||
*/ | ||
FieldVisitor.prototype.visitAnnotation = function (desc, visible) { | ||
visitAnnotation(desc, visible) { | ||
if (this.fv != null) { | ||
@@ -79,3 +78,3 @@ return this.fv.visitAnnotation(desc, visible); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -99,3 +98,3 @@ * Visits an annotation on the type of the field. | ||
*/ | ||
FieldVisitor.prototype.visitTypeAnnotation = function (typeRef, typePath, desc, visible) { | ||
visitTypeAnnotation(typeRef, typePath, desc, visible) { | ||
if (this.api < Opcodes_1.Opcodes.ASM5) { | ||
@@ -108,3 +107,3 @@ throw new Error(); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -116,7 +115,7 @@ * Visits a non standard attribute of the field. | ||
*/ | ||
FieldVisitor.prototype.visitAttribute = function (attr) { | ||
visitAttribute(attr) { | ||
if (this.fv != null) { | ||
this.fv.visitAttribute(attr); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -127,10 +126,9 @@ * Visits the end of the field. This method, which is the last one to be | ||
*/ | ||
FieldVisitor.prototype.visitEnd = function () { | ||
visitEnd() { | ||
if (this.fv != null) { | ||
this.fv.visitEnd(); | ||
} | ||
}; | ||
return FieldVisitor; | ||
}()); | ||
} | ||
} | ||
exports.FieldVisitor = FieldVisitor; | ||
FieldVisitor["__class"] = "FieldVisitor"; |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var AnnotationWriter_1 = require("./AnnotationWriter"); | ||
var ByteVector_1 = require("./ByteVector"); | ||
var ClassReader_1 = require("./ClassReader"); | ||
var ClassWriter_1 = require("./ClassWriter"); | ||
var FieldVisitor_1 = require("./FieldVisitor"); | ||
var Opcodes_1 = require("./Opcodes"); | ||
var FieldWriter = /** @class */ (function (_super) { | ||
__extends(FieldWriter, _super); | ||
const AnnotationWriter_1 = require("./AnnotationWriter"); | ||
const ByteVector_1 = require("./ByteVector"); | ||
const ClassReader_1 = require("./ClassReader"); | ||
const ClassWriter_1 = require("./ClassWriter"); | ||
const FieldVisitor_1 = require("./FieldVisitor"); | ||
const Opcodes_1 = require("./Opcodes"); | ||
class FieldWriter extends FieldVisitor_1.FieldVisitor { | ||
/** | ||
@@ -37,35 +26,34 @@ * Constructs a new {@link FieldWriter}. | ||
*/ | ||
function FieldWriter(cw, access, name, desc, signature, value) { | ||
var _this = _super.call(this, Opcodes_1.Opcodes.ASM5) || this; | ||
_this.access = 0; | ||
_this.name = 0; | ||
_this.desc = 0; | ||
_this.signature = 0; | ||
_this.value = 0; | ||
constructor(cw, access, name, desc, signature, value) { | ||
super(Opcodes_1.Opcodes.ASM5); | ||
this.access = 0; | ||
this.name = 0; | ||
this.desc = 0; | ||
this.signature = 0; | ||
this.value = 0; | ||
if (cw.firstField == null) { | ||
cw.firstField = _this; | ||
cw.firstField = this; | ||
} | ||
else { | ||
cw.lastField.fv = _this; | ||
cw.lastField.fv = this; | ||
} | ||
cw.lastField = _this; | ||
_this.cw = cw; | ||
_this.access = access; | ||
_this.name = cw.newUTF8(name); | ||
_this.desc = cw.newUTF8(desc); | ||
cw.lastField = this; | ||
this.cw = cw; | ||
this.access = access; | ||
this.name = cw.newUTF8(name); | ||
this.desc = cw.newUTF8(desc); | ||
if (ClassReader_1.ClassReader.SIGNATURES && signature != null) { | ||
_this.signature = cw.newUTF8(signature); | ||
this.signature = cw.newUTF8(signature); | ||
} | ||
if (value != null) { | ||
_this.value = cw.newConstItem(value).index; | ||
this.value = cw.newConstItem(value).index; | ||
} | ||
return _this; | ||
} | ||
FieldWriter.prototype.visitAnnotation = function (desc, visible) { | ||
visitAnnotation(desc, visible) { | ||
if (!ClassReader_1.ClassReader.ANNOTATIONS) { | ||
return null; | ||
} | ||
var bv = new ByteVector_1.ByteVector(); | ||
let bv = new ByteVector_1.ByteVector(); | ||
bv.putShort(this.cw.newUTF8(desc)).putShort(0); | ||
var aw = new AnnotationWriter_1.AnnotationWriter(this.cw, true, bv, bv, 2); | ||
let aw = new AnnotationWriter_1.AnnotationWriter(this.cw, true, bv, bv, 2); | ||
if (visible) { | ||
@@ -80,11 +68,11 @@ aw.next = this.anns; | ||
return aw; | ||
}; | ||
FieldWriter.prototype.visitTypeAnnotation = function (typeRef, typePath, desc, visible) { | ||
} | ||
visitTypeAnnotation(typeRef, typePath, desc, visible) { | ||
if (!ClassReader_1.ClassReader.ANNOTATIONS) { | ||
return null; | ||
} | ||
var bv = new ByteVector_1.ByteVector(); | ||
let bv = new ByteVector_1.ByteVector(); | ||
AnnotationWriter_1.AnnotationWriter.putTarget(typeRef, typePath, bv); | ||
bv.putShort(this.cw.newUTF8(desc)).putShort(0); | ||
var aw = new AnnotationWriter_1.AnnotationWriter(this.cw, true, bv, bv, bv.length - 2); | ||
let aw = new AnnotationWriter_1.AnnotationWriter(this.cw, true, bv, bv, bv.length - 2); | ||
if (visible) { | ||
@@ -99,9 +87,9 @@ aw.next = this.tanns; | ||
return aw; | ||
}; | ||
FieldWriter.prototype.visitAttribute = function (attr) { | ||
} | ||
visitAttribute(attr) { | ||
attr.next = this.attrs; | ||
this.attrs = attr; | ||
}; | ||
FieldWriter.prototype.visitEnd = function () { | ||
}; | ||
} | ||
visitEnd() { | ||
} | ||
/** | ||
@@ -112,4 +100,4 @@ * Returns the size of this field. | ||
*/ | ||
FieldWriter.prototype.getSize = function () { | ||
var size = 8; | ||
getSize() { | ||
let size = 8; | ||
if (this.value !== 0) { | ||
@@ -153,3 +141,3 @@ this.cw.newUTF8("ConstantValue"); | ||
return size; | ||
}; | ||
} | ||
/** | ||
@@ -161,7 +149,7 @@ * Puts the content of this field into the given byte vector. | ||
*/ | ||
FieldWriter.prototype.put = function (out) { | ||
var FACTOR = ClassWriter_1.ClassWriter.TO_ACC_SYNTHETIC_$LI$(); | ||
var mask = Opcodes_1.Opcodes.ACC_DEPRECATED | ClassWriter_1.ClassWriter.ACC_SYNTHETIC_ATTRIBUTE | (((this.access & ClassWriter_1.ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) / FACTOR | 0)); | ||
put(out) { | ||
let FACTOR = ClassWriter_1.ClassWriter.TO_ACC_SYNTHETIC_$LI$(); | ||
let mask = Opcodes_1.Opcodes.ACC_DEPRECATED | ClassWriter_1.ClassWriter.ACC_SYNTHETIC_ATTRIBUTE | (((this.access & ClassWriter_1.ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) / FACTOR | 0)); | ||
out.putShort(this.access & ~mask).putShort(this.name).putShort(this.desc); | ||
var attributeCount = 0; | ||
let attributeCount = 0; | ||
if (this.value !== 0) { | ||
@@ -232,6 +220,5 @@ ++attributeCount; | ||
} | ||
}; | ||
return FieldWriter; | ||
}(FieldVisitor_1.FieldVisitor)); | ||
} | ||
} | ||
exports.FieldWriter = FieldWriter; | ||
FieldWriter["__class"] = "FieldWriter"; |
@@ -39,60 +39,60 @@ "use strict"; | ||
require("./ClassWriter"); | ||
var Opcodes_1 = require("./Opcodes"); | ||
var ClassWriter_1 = require("./ClassWriter"); | ||
var MethodWriter_1 = require("./MethodWriter"); | ||
var Type_1 = require("./Type"); | ||
var Frame = /** @class */ (function () { | ||
function Frame() { | ||
const Opcodes_1 = require("./Opcodes"); | ||
const ClassWriter_1 = require("./ClassWriter"); | ||
const MethodWriter_1 = require("./MethodWriter"); | ||
const Type_1 = require("./Type"); | ||
class Frame { | ||
constructor() { | ||
this.outputStackTop = 0; | ||
this.initializationCount = 0; | ||
} | ||
Frame.__static_initialize = function () { if (!Frame.__static_initialized) { | ||
static __static_initialize() { if (!Frame.__static_initialized) { | ||
Frame.__static_initialized = true; | ||
Frame.__static_initializer_0(); | ||
} }; | ||
Frame.OBJECT_$LI$ = function () { Frame.__static_initialize(); if (Frame.OBJECT == null) | ||
Frame.OBJECT = Frame.BASE | 7340032; return Frame.OBJECT; }; | ||
} } | ||
static OBJECT_$LI$() { Frame.__static_initialize(); if (Frame.OBJECT == null) | ||
Frame.OBJECT = Frame.BASE | 7340032; return Frame.OBJECT; } | ||
; | ||
Frame.UNINITIALIZED_$LI$ = function () { Frame.__static_initialize(); if (Frame.UNINITIALIZED == null) | ||
Frame.UNINITIALIZED = Frame.BASE | 8388608; return Frame.UNINITIALIZED; }; | ||
static UNINITIALIZED_$LI$() { Frame.__static_initialize(); if (Frame.UNINITIALIZED == null) | ||
Frame.UNINITIALIZED = Frame.BASE | 8388608; return Frame.UNINITIALIZED; } | ||
; | ||
Frame.TOP_$LI$ = function () { Frame.__static_initialize(); if (Frame.TOP == null) | ||
Frame.TOP = Frame.BASE | 0; return Frame.TOP; }; | ||
static TOP_$LI$() { Frame.__static_initialize(); if (Frame.TOP == null) | ||
Frame.TOP = Frame.BASE | 0; return Frame.TOP; } | ||
; | ||
Frame.BOOLEAN_$LI$ = function () { Frame.__static_initialize(); if (Frame.BOOLEAN == null) | ||
Frame.BOOLEAN = Frame.BASE | 9; return Frame.BOOLEAN; }; | ||
static BOOLEAN_$LI$() { Frame.__static_initialize(); if (Frame.BOOLEAN == null) | ||
Frame.BOOLEAN = Frame.BASE | 9; return Frame.BOOLEAN; } | ||
; | ||
Frame.BYTE_$LI$ = function () { Frame.__static_initialize(); if (Frame.BYTE == null) | ||
Frame.BYTE = Frame.BASE | 10; return Frame.BYTE; }; | ||
static BYTE_$LI$() { Frame.__static_initialize(); if (Frame.BYTE == null) | ||
Frame.BYTE = Frame.BASE | 10; return Frame.BYTE; } | ||
; | ||
Frame.CHAR_$LI$ = function () { Frame.__static_initialize(); if (Frame.CHAR == null) | ||
Frame.CHAR = Frame.BASE | 11; return Frame.CHAR; }; | ||
static CHAR_$LI$() { Frame.__static_initialize(); if (Frame.CHAR == null) | ||
Frame.CHAR = Frame.BASE | 11; return Frame.CHAR; } | ||
; | ||
Frame.SHORT_$LI$ = function () { Frame.__static_initialize(); if (Frame.SHORT == null) | ||
Frame.SHORT = Frame.BASE | 12; return Frame.SHORT; }; | ||
static SHORT_$LI$() { Frame.__static_initialize(); if (Frame.SHORT == null) | ||
Frame.SHORT = Frame.BASE | 12; return Frame.SHORT; } | ||
; | ||
Frame.INTEGER_$LI$ = function () { Frame.__static_initialize(); if (Frame.INTEGER == null) | ||
Frame.INTEGER = Frame.BASE | 1; return Frame.INTEGER; }; | ||
static INTEGER_$LI$() { Frame.__static_initialize(); if (Frame.INTEGER == null) | ||
Frame.INTEGER = Frame.BASE | 1; return Frame.INTEGER; } | ||
; | ||
Frame.FLOAT_$LI$ = function () { Frame.__static_initialize(); if (Frame.FLOAT == null) | ||
Frame.FLOAT = Frame.BASE | 2; return Frame.FLOAT; }; | ||
static FLOAT_$LI$() { Frame.__static_initialize(); if (Frame.FLOAT == null) | ||
Frame.FLOAT = Frame.BASE | 2; return Frame.FLOAT; } | ||
; | ||
Frame.DOUBLE_$LI$ = function () { Frame.__static_initialize(); if (Frame.DOUBLE == null) | ||
Frame.DOUBLE = Frame.BASE | 3; return Frame.DOUBLE; }; | ||
static DOUBLE_$LI$() { Frame.__static_initialize(); if (Frame.DOUBLE == null) | ||
Frame.DOUBLE = Frame.BASE | 3; return Frame.DOUBLE; } | ||
; | ||
Frame.LONG_$LI$ = function () { Frame.__static_initialize(); if (Frame.LONG == null) | ||
Frame.LONG = Frame.BASE | 4; return Frame.LONG; }; | ||
static LONG_$LI$() { Frame.__static_initialize(); if (Frame.LONG == null) | ||
Frame.LONG = Frame.BASE | 4; return Frame.LONG; } | ||
; | ||
Frame.NULL_$LI$ = function () { Frame.__static_initialize(); if (Frame.NULL == null) | ||
Frame.NULL = Frame.BASE | 5; return Frame.NULL; }; | ||
static NULL_$LI$() { Frame.__static_initialize(); if (Frame.NULL == null) | ||
Frame.NULL = Frame.BASE | 5; return Frame.NULL; } | ||
; | ||
Frame.UNINITIALIZED_THIS_$LI$ = function () { Frame.__static_initialize(); if (Frame.UNINITIALIZED_THIS == null) | ||
Frame.UNINITIALIZED_THIS = Frame.BASE | 6; return Frame.UNINITIALIZED_THIS; }; | ||
static UNINITIALIZED_THIS_$LI$() { Frame.__static_initialize(); if (Frame.UNINITIALIZED_THIS == null) | ||
Frame.UNINITIALIZED_THIS = Frame.BASE | 6; return Frame.UNINITIALIZED_THIS; } | ||
; | ||
Frame.SIZE_$LI$ = function () { Frame.__static_initialize(); return Frame.SIZE; }; | ||
static SIZE_$LI$() { Frame.__static_initialize(); return Frame.SIZE; } | ||
; | ||
Frame.__static_initializer_0 = function () { | ||
var i; | ||
var b = new Array(202); | ||
var s = "EFFFFFFFFGGFFFGGFFFEEFGFGFEEEEEEEEEEEEEEEEEEEEDEDEDDDDDCDCDEEEEEEEEEEEEEEEEEEEEBABABBBBDCFFFGGGEDCDCDCDCDCDCDCDCDCDCEEEEDDDDDDDCDCDCEFEFDDEEFFDEDEEEBDDBBDDDDDDCCCCCCCCEFEDDDCDCDEEEEEEEEEEFEEEEEEDDEEDDEE"; | ||
static __static_initializer_0() { | ||
let i; | ||
let b = new Array(202); | ||
let s = "EFFFFFFFFGGFFFGGFFFEEFGFGFEEEEEEEEEEEEEEEEEEEEDEDEDDDDDCDCDEEEEEEEEEEEEEEEEEEEEBABABBBBDCFFFGGGEDCDCDCDCDCDCDCDCDCDCEEEEDDDDDDDCDCDCEFEFDDEEFFDEDEEEBDDBBDDDDDDCCCCCCCCEFEDDDCDCDEEEEEEEEEEFEEEEEEDDEEDDEE"; | ||
for (i = 0; i < b.length; ++i) { | ||
@@ -102,3 +102,3 @@ b[i] = (s.charAt(i)).charCodeAt(0) - ('E').charCodeAt(0); | ||
Frame.SIZE = b; | ||
}; | ||
} | ||
/** | ||
@@ -127,14 +127,13 @@ * Sets this frame to the given value. | ||
*/ | ||
Frame.prototype.set = function (cw, nLocal, local, nStack, stack) { | ||
var _this = this; | ||
set(cw, nLocal, local, nStack, stack) { | ||
if (((cw != null && cw instanceof ClassWriter_1.ClassWriter) || cw === null) && ((typeof nLocal === 'number') || nLocal === null) && ((local != null && local instanceof Array) || local === null) && ((typeof nStack === 'number') || nStack === null) && ((stack != null && stack instanceof Array) || stack === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
return (function () { | ||
var i = Frame.convert(cw, nLocal, local, _this.inputLocals); | ||
let __args = Array.prototype.slice.call(arguments); | ||
return (() => { | ||
let i = Frame.convert(cw, nLocal, local, this.inputLocals); | ||
while ((i < local.length)) { | ||
_this.inputLocals[i++] = Frame.TOP_$LI$(); | ||
this.inputLocals[i++] = Frame.TOP_$LI$(); | ||
} | ||
; | ||
var nStackTop = 0; | ||
for (var j = 0; j < nStack; ++j) { | ||
let nStackTop = 0; | ||
for (let j = 0; j < nStack; ++j) { | ||
if (stack[j] === Opcodes_1.Opcodes.LONG || stack[j] === Opcodes_1.Opcodes.DOUBLE) { | ||
@@ -144,6 +143,6 @@ ++nStackTop; | ||
} | ||
_this.inputStack = new Array(nStack + nStackTop); | ||
Frame.convert(cw, nStack, stack, _this.inputStack); | ||
_this.outputStackTop = 0; | ||
_this.initializationCount = 0; | ||
this.inputStack = new Array(nStack + nStackTop); | ||
Frame.convert(cw, nStack, stack, this.inputStack); | ||
this.outputStackTop = 0; | ||
this.initializationCount = 0; | ||
})(); | ||
@@ -159,3 +158,3 @@ } | ||
throw new Error('invalid overload'); | ||
}; | ||
} | ||
/** | ||
@@ -184,5 +183,5 @@ * Converts types from the MethodWriter.visitFrame() format to the Frame | ||
*/ | ||
Frame.convert = function (cw, nInput, input, output) { | ||
var i = 0; | ||
for (var j = 0; j < nInput; ++j) { | ||
static convert(cw, nInput, input, output) { | ||
let i = 0; | ||
for (let j = 0; j < nInput; ++j) { | ||
if (typeof input[j] === 'number') { | ||
@@ -202,3 +201,3 @@ output[i++] = Frame.BASE | /* intValue */ (input[j] | 0); | ||
return i; | ||
}; | ||
} | ||
/** | ||
@@ -213,3 +212,3 @@ * Sets this frame to the value of the given frame. WARNING: after this | ||
*/ | ||
Frame.prototype.set$Frame = function (f) { | ||
set$Frame(f) { | ||
this.inputLocals = f.inputLocals; | ||
@@ -222,3 +221,3 @@ this.inputStack = f.inputStack; | ||
this.initializations = f.initializations; | ||
}; | ||
} | ||
/** | ||
@@ -231,3 +230,3 @@ * Returns the output frame local variable type at the given index. | ||
*/ | ||
Frame.prototype.get = function (local) { | ||
get(local) { | ||
if (this.outputLocals == null || local >= this.outputLocals.length) { | ||
@@ -237,3 +236,3 @@ return Frame.LOCAL | local; | ||
else { | ||
var type = this.outputLocals[local]; | ||
let type = this.outputLocals[local]; | ||
if (type === 0) { | ||
@@ -244,3 +243,3 @@ type = this.outputLocals[local] = Frame.LOCAL | local; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -254,10 +253,10 @@ * Sets the output frame local variable type at the given index. | ||
*/ | ||
Frame.prototype.set$int$int = function (local, type) { | ||
set$int$int(local, type) { | ||
if (this.outputLocals == null) { | ||
this.outputLocals = new Array(10); | ||
} | ||
var n = this.outputLocals.length; | ||
let n = this.outputLocals.length; | ||
if (local >= n) { | ||
var t = new Array(Math.max(local + 1, 2 * n)); | ||
for (var i = 0; i < n; i++) { | ||
let t = new Array(Math.max(local + 1, 2 * n)); | ||
for (let i = 0; i < n; i++) { | ||
t[i] = this.outputLocals[i]; | ||
@@ -269,3 +268,3 @@ } | ||
this.outputLocals[local] = type; | ||
}; | ||
} | ||
/** | ||
@@ -277,10 +276,10 @@ * Pushes a new type onto the output frame stack. | ||
*/ | ||
Frame.prototype.push$int = function (type) { | ||
push$int(type) { | ||
if (this.outputStack == null) { | ||
this.outputStack = new Array(10); | ||
} | ||
var n = this.outputStack.length; | ||
let n = this.outputStack.length; | ||
if (this.outputStackTop >= n) { | ||
var t = new Array(Math.max(this.outputStackTop + 1, 2 * n)); | ||
for (var i = 0; i < n; i++) { | ||
let t = new Array(Math.max(this.outputStackTop + 1, 2 * n)); | ||
for (let i = 0; i < n; i++) { | ||
t[i] = this.outputStack[i]; | ||
@@ -292,7 +291,7 @@ } | ||
this.outputStack[this.outputStackTop++] = type; | ||
var top = this.owner.inputStackTop + this.outputStackTop; | ||
let top = this.owner.inputStackTop + this.outputStackTop; | ||
if (top > this.owner.outputStackMax) { | ||
this.owner.outputStackMax = top; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -308,12 +307,11 @@ * Pushes a new type onto the output frame stack. | ||
*/ | ||
Frame.prototype.push = function (cw, desc) { | ||
var _this = this; | ||
push(cw, desc) { | ||
if (((cw != null && cw instanceof ClassWriter_1.ClassWriter) || cw === null) && ((typeof desc === 'string') || desc === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
return (function () { | ||
var type = Frame.type(cw, desc); | ||
let __args = Array.prototype.slice.call(arguments); | ||
return (() => { | ||
let type = Frame.type(cw, desc); | ||
if (type !== 0) { | ||
_this.push(type); | ||
this.push(type); | ||
if (type === Frame.LONG_$LI$() || type === Frame.DOUBLE_$LI$()) { | ||
_this.push(Frame.TOP_$LI$()); | ||
this.push(Frame.TOP_$LI$()); | ||
} | ||
@@ -328,3 +326,3 @@ } | ||
throw new Error('invalid overload'); | ||
}; | ||
} | ||
/** | ||
@@ -339,5 +337,5 @@ * Returns the int encoding of the given type. | ||
*/ | ||
Frame.type = function (cw, desc) { | ||
var t; | ||
var index = desc.charAt(0) === '(' ? desc.indexOf(')') + 1 : 0; | ||
static type(cw, desc) { | ||
let t; | ||
let index = desc.charAt(0) === '(' ? desc.indexOf(')') + 1 : 0; | ||
switch ((desc.charAt(index))) { | ||
@@ -362,4 +360,4 @@ case 'V': | ||
default: | ||
var data = void 0; | ||
var dims = index + 1; | ||
let data; | ||
let dims = index + 1; | ||
while ((desc.charAt(dims) === '[')) { | ||
@@ -400,3 +398,3 @@ ++dims; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -407,3 +405,3 @@ * Pops a type from the output frame stack and returns its value. | ||
*/ | ||
Frame.prototype.pop$ = function () { | ||
pop$() { | ||
if (this.outputStackTop > 0) { | ||
@@ -415,3 +413,3 @@ return this.outputStack[--this.outputStackTop]; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -423,3 +421,3 @@ * Pops the given number of types from the output frame stack. | ||
*/ | ||
Frame.prototype.pop$int = function (elements) { | ||
pop$int(elements) { | ||
if (this.outputStackTop >= elements) { | ||
@@ -432,3 +430,3 @@ this.outputStackTop -= elements; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -442,16 +440,15 @@ * Pops a type from the output frame stack. | ||
*/ | ||
Frame.prototype.pop = function (desc) { | ||
var _this = this; | ||
pop(desc) { | ||
if (((typeof desc === 'string') || desc === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
return (function () { | ||
var c = desc.charAt(0); | ||
let __args = Array.prototype.slice.call(arguments); | ||
return (() => { | ||
let c = desc.charAt(0); | ||
if (c === '(') { | ||
_this.pop((Type_1.Type.getArgumentsAndReturnSizes(desc) >> 2) - 1); | ||
this.pop((Type_1.Type.getArgumentsAndReturnSizes(desc) >> 2) - 1); | ||
} | ||
else if (c === 'J' || c === 'D') { | ||
_this.pop(2); | ||
this.pop(2); | ||
} | ||
else { | ||
_this.pop(1); | ||
this.pop(1); | ||
} | ||
@@ -468,3 +465,3 @@ })(); | ||
throw new Error('invalid overload'); | ||
}; | ||
} | ||
/** | ||
@@ -477,10 +474,10 @@ * Adds a new type to the list of types on which a constructor is invoked in | ||
*/ | ||
Frame.prototype.init$int = function (__var) { | ||
init$int(__var) { | ||
if (this.initializations == null) { | ||
this.initializations = new Array(2); | ||
} | ||
var n = this.initializations.length; | ||
let n = this.initializations.length; | ||
if (this.initializationCount >= n) { | ||
var t = new Array(Math.max(this.initializationCount + 1, 2 * n)); | ||
for (var i = 0; i < n; i++) { | ||
let t = new Array(Math.max(this.initializationCount + 1, 2 * n)); | ||
for (let i = 0; i < n; i++) { | ||
t[i] = this.initializations[i]; | ||
@@ -492,3 +489,3 @@ } | ||
this.initializations[this.initializationCount++] = __var; | ||
}; | ||
} | ||
/** | ||
@@ -505,8 +502,7 @@ * Replaces the given type with the appropriate type if it is one of the | ||
*/ | ||
Frame.prototype.init = function (cw, t) { | ||
var _this = this; | ||
init(cw, t) { | ||
if (((cw != null && cw instanceof ClassWriter_1.ClassWriter) || cw === null) && ((typeof t === 'number') || t === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
return (function () { | ||
var s; | ||
let __args = Array.prototype.slice.call(arguments); | ||
return (() => { | ||
let s; | ||
if (t === Frame.UNINITIALIZED_THIS_$LI$()) { | ||
@@ -516,3 +512,3 @@ s = Frame.OBJECT_$LI$() | cw.addType(cw.thisName); | ||
else if ((t & (Frame.DIM | Frame.BASE_KIND)) === Frame.UNINITIALIZED_$LI$()) { | ||
var type = cw.typeTable[t & Frame.BASE_VALUE].strVal1; | ||
let type = cw.typeTable[t & Frame.BASE_VALUE].strVal1; | ||
s = Frame.OBJECT_$LI$() | cw.addType(type); | ||
@@ -523,11 +519,11 @@ } | ||
} | ||
for (var j = 0; j < _this.initializationCount; ++j) { | ||
var u = _this.initializations[j]; | ||
var dim = u & Frame.DIM; | ||
var kind = u & Frame.KIND; | ||
for (let j = 0; j < this.initializationCount; ++j) { | ||
let u = this.initializations[j]; | ||
let dim = u & Frame.DIM; | ||
let kind = u & Frame.KIND; | ||
if (kind === Frame.LOCAL) { | ||
u = dim + _this.inputLocals[u & Frame.VALUE]; | ||
u = dim + this.inputLocals[u & Frame.VALUE]; | ||
} | ||
else if (kind === Frame.STACK) { | ||
u = dim + _this.inputStack[_this.inputStack.length - (u & Frame.VALUE)]; | ||
u = dim + this.inputStack[this.inputStack.length - (u & Frame.VALUE)]; | ||
} | ||
@@ -546,3 +542,3 @@ if (t === u) { | ||
throw new Error('invalid overload'); | ||
}; | ||
} | ||
/** | ||
@@ -561,6 +557,6 @@ * Initializes the input frame of the first basic block from the method | ||
*/ | ||
Frame.prototype.initInputFrame = function (cw, access, args, maxLocals) { | ||
initInputFrame(cw, access, args, maxLocals) { | ||
this.inputLocals = new Array(maxLocals); | ||
this.inputStack = new Array(0); | ||
var i = 0; | ||
let i = 0; | ||
if ((access & Opcodes_1.Opcodes.ACC_STATIC) === 0) { | ||
@@ -574,4 +570,4 @@ if ((access & MethodWriter_1.MethodWriter.ACC_CONSTRUCTOR) === 0) { | ||
} | ||
for (var j = 0; j < args.length; ++j) { | ||
var t = Frame.type(cw, args[j].getDescriptor()); | ||
for (let j = 0; j < args.length; ++j) { | ||
let t = Frame.type(cw, args[j].getDescriptor()); | ||
this.inputLocals[i++] = t; | ||
@@ -586,3 +582,3 @@ if (t === Frame.LONG_$LI$() || t === Frame.DOUBLE_$LI$()) { | ||
; | ||
}; | ||
} | ||
/** | ||
@@ -600,7 +596,7 @@ * Simulates the action of the given instruction on the output stack frame. | ||
*/ | ||
Frame.prototype.execute = function (opcode, arg, cw, item) { | ||
var t1; | ||
var t2; | ||
var t3; | ||
var t4; | ||
execute(opcode, arg, cw, item) { | ||
let t1; | ||
let t2; | ||
let t3; | ||
let t4; | ||
switch ((opcode)) { | ||
@@ -997,3 +993,3 @@ case Opcodes_1.Opcodes.NOP: | ||
case Opcodes_1.Opcodes.ANEWARRAY: | ||
var s = item.strVal1; | ||
let s = item.strVal1; | ||
this.pop(); | ||
@@ -1022,3 +1018,3 @@ if (s.charAt(0) === '[') { | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -1039,11 +1035,11 @@ * Merges the input frame of the given basic block with the input and output | ||
*/ | ||
Frame.prototype.merge = function (cw, frame, edge) { | ||
var changed = false; | ||
var i; | ||
var s; | ||
var dim; | ||
var kind; | ||
var t; | ||
var nLocal = this.inputLocals.length; | ||
var nStack = this.inputStack.length; | ||
merge(cw, frame, edge) { | ||
let changed = false; | ||
let i; | ||
let s; | ||
let dim; | ||
let kind; | ||
let t; | ||
let nLocal = this.inputLocals.length; | ||
let nStack = this.inputStack.length; | ||
if (frame.inputLocals == null) { | ||
@@ -1098,3 +1094,3 @@ frame.inputLocals = new Array(nLocal); | ||
} | ||
var nInputStack = this.inputStack.length + this.owner.inputStackTop; | ||
let nInputStack = this.inputStack.length + this.owner.inputStackTop; | ||
if (frame.inputStack == null) { | ||
@@ -1135,3 +1131,3 @@ frame.inputStack = new Array(nInputStack + this.outputStackTop); | ||
return changed; | ||
}; | ||
} | ||
/** | ||
@@ -1153,4 +1149,4 @@ * Merges the type at the given index in the given type array with the given | ||
*/ | ||
Frame.merge = function (cw, t, types, index) { | ||
var u = types[index]; | ||
static merge(cw, t, types, index) { | ||
let u = types[index]; | ||
if (u === t) { | ||
@@ -1169,3 +1165,3 @@ return false; | ||
} | ||
var v; | ||
let v; | ||
if ((u & Frame.BASE_KIND) === Frame.OBJECT_$LI$() || (u & Frame.DIM) !== 0) { | ||
@@ -1180,3 +1176,3 @@ if (t === Frame.NULL_$LI$()) { | ||
else { | ||
var vdim = Frame.ELEMENT_OF + (u & Frame.DIM); | ||
let vdim = Frame.ELEMENT_OF + (u & Frame.DIM); | ||
v = vdim | Frame.OBJECT_$LI$() | cw.addType("java/lang/Object"); | ||
@@ -1186,4 +1182,4 @@ } | ||
else if ((t & Frame.BASE_KIND) === Frame.OBJECT_$LI$() || (t & Frame.DIM) !== 0) { | ||
var tdim = (((t & Frame.DIM) === 0 || (t & Frame.BASE_KIND) === Frame.OBJECT_$LI$()) ? 0 : Frame.ELEMENT_OF) + (t & Frame.DIM); | ||
var udim = (((u & Frame.DIM) === 0 || (u & Frame.BASE_KIND) === Frame.OBJECT_$LI$()) ? 0 : Frame.ELEMENT_OF) + (u & Frame.DIM); | ||
let tdim = (((t & Frame.DIM) === 0 || (t & Frame.BASE_KIND) === Frame.OBJECT_$LI$()) ? 0 : Frame.ELEMENT_OF) + (t & Frame.DIM); | ||
let udim = (((u & Frame.DIM) === 0 || (u & Frame.BASE_KIND) === Frame.OBJECT_$LI$()) ? 0 : Frame.ELEMENT_OF) + (u & Frame.DIM); | ||
v = Math.min(tdim, udim) | Frame.OBJECT_$LI$() | cw.addType("java/lang/Object"); | ||
@@ -1206,63 +1202,62 @@ } | ||
return false; | ||
}; | ||
Frame.__static_initialized = false; | ||
/** | ||
* Mask to get the dimension of a frame type. This dimension is a signed | ||
* integer between -8 and 7. | ||
*/ | ||
Frame.DIM = -268435456; | ||
/** | ||
* Constant to be added to a type to get a type with one more dimension. | ||
*/ | ||
Frame.ARRAY_OF = 268435456; | ||
/** | ||
* Constant to be added to a type to get a type with one less dimension. | ||
*/ | ||
Frame.ELEMENT_OF = -268435456; | ||
/** | ||
* Mask to get the kind of a frame type. | ||
* | ||
* @see #BASE | ||
* @see #LOCAL | ||
* @see #STACK | ||
*/ | ||
Frame.KIND = 251658240; | ||
/** | ||
* Flag used for LOCAL and STACK types. Indicates that if this type happens | ||
* to be a long or double type (during the computations of input frames), | ||
* then it must be set to TOP because the second word of this value has been | ||
* reused to store other data in the basic block. Hence the first word no | ||
* longer stores a valid long or double value. | ||
*/ | ||
Frame.TOP_IF_LONG_OR_DOUBLE = 8388608; | ||
/** | ||
* Mask to get the value of a frame type. | ||
*/ | ||
Frame.VALUE = 8388607; | ||
/** | ||
* Mask to get the kind of base types. | ||
*/ | ||
Frame.BASE_KIND = 267386880; | ||
/** | ||
* Mask to get the value of base types. | ||
*/ | ||
Frame.BASE_VALUE = 1048575; | ||
/** | ||
* Kind of the types that are not relative to an input stack map frame. | ||
*/ | ||
Frame.BASE = 16777216; | ||
/** | ||
* Kind of the types that are relative to the local variable types of an | ||
* input stack map frame. The value of such types is a local variable index. | ||
*/ | ||
Frame.LOCAL = 33554432; | ||
/** | ||
* Kind of the the types that are relative to the stack of an input stack | ||
* map frame. The value of such types is a position relatively to the top of | ||
* this stack. | ||
*/ | ||
Frame.STACK = 50331648; | ||
return Frame; | ||
}()); | ||
} | ||
} | ||
exports.Frame = Frame; | ||
Frame.__static_initialized = false; | ||
/** | ||
* Mask to get the dimension of a frame type. This dimension is a signed | ||
* integer between -8 and 7. | ||
*/ | ||
Frame.DIM = -268435456; | ||
/** | ||
* Constant to be added to a type to get a type with one more dimension. | ||
*/ | ||
Frame.ARRAY_OF = 268435456; | ||
/** | ||
* Constant to be added to a type to get a type with one less dimension. | ||
*/ | ||
Frame.ELEMENT_OF = -268435456; | ||
/** | ||
* Mask to get the kind of a frame type. | ||
* | ||
* @see #BASE | ||
* @see #LOCAL | ||
* @see #STACK | ||
*/ | ||
Frame.KIND = 251658240; | ||
/** | ||
* Flag used for LOCAL and STACK types. Indicates that if this type happens | ||
* to be a long or double type (during the computations of input frames), | ||
* then it must be set to TOP because the second word of this value has been | ||
* reused to store other data in the basic block. Hence the first word no | ||
* longer stores a valid long or double value. | ||
*/ | ||
Frame.TOP_IF_LONG_OR_DOUBLE = 8388608; | ||
/** | ||
* Mask to get the value of a frame type. | ||
*/ | ||
Frame.VALUE = 8388607; | ||
/** | ||
* Mask to get the kind of base types. | ||
*/ | ||
Frame.BASE_KIND = 267386880; | ||
/** | ||
* Mask to get the value of base types. | ||
*/ | ||
Frame.BASE_VALUE = 1048575; | ||
/** | ||
* Kind of the types that are not relative to an input stack map frame. | ||
*/ | ||
Frame.BASE = 16777216; | ||
/** | ||
* Kind of the types that are relative to the local variable types of an | ||
* input stack map frame. The value of such types is a local variable index. | ||
*/ | ||
Frame.LOCAL = 33554432; | ||
/** | ||
* Kind of the the types that are relative to the stack of an input stack | ||
* map frame. The value of such types is a position relatively to the top of | ||
* this stack. | ||
*/ | ||
Frame.STACK = 50331648; | ||
Frame["__class"] = "Frame"; | ||
@@ -1269,0 +1264,0 @@ Frame.SIZE_$LI$(); |
@@ -39,4 +39,4 @@ "use strict"; | ||
*/ | ||
var Opcodes_1 = require("./Opcodes"); | ||
var Handle = /** @class */ (function () { | ||
const Opcodes_1 = require("./Opcodes"); | ||
class Handle { | ||
/** | ||
@@ -65,4 +65,3 @@ * Constructs a new field or method handle. | ||
*/ | ||
function Handle(tag, owner, name, desc, itf) { | ||
if (itf === void 0) { itf = tag == Opcodes_1.Opcodes.H_INVOKEINTERFACE; } | ||
constructor(tag, owner, name, desc, itf = tag == Opcodes_1.Opcodes.H_INVOKEINTERFACE) { | ||
this.tag = tag; | ||
@@ -74,3 +73,3 @@ this.owner = owner; | ||
} | ||
Handle.prototype.equals = function (obj) { | ||
equals(obj) { | ||
if (obj === this) { | ||
@@ -82,8 +81,8 @@ return true; | ||
} | ||
var h = obj; | ||
let h = obj; | ||
return this.tag === h.tag && this.isInterface === h.isInterface && (this.owner === h.owner) && (this.name === h.name) && (this.descriptor === h.descriptor); | ||
}; | ||
Handle.prototype.hashCode = function () { | ||
} | ||
hashCode() { | ||
return this.tag + (this.isInterface ? 64 : 0) + this.owner.toString() * this.name.toString() * this.descriptor.toString(); | ||
}; | ||
} | ||
/** | ||
@@ -102,8 +101,7 @@ * Returns the textual representation of this handle. The textual | ||
*/ | ||
Handle.prototype.toString = function () { | ||
toString() { | ||
return this.owner + '.' + this.name + this.descriptor + " (" + this.tag + (this.isInterface ? " itf" : "") + ')'; | ||
}; | ||
return Handle; | ||
}()); | ||
} | ||
} | ||
exports.Handle = Handle; | ||
Handle["__class"] = "Handle"; |
@@ -39,6 +39,6 @@ "use strict"; | ||
*/ | ||
var ClassWriter_1 = require("./ClassWriter"); | ||
var bits_1 = require("./bits"); | ||
var Long = require("long"); | ||
var Item = /** @class */ (function () { | ||
const ClassWriter_1 = require("./ClassWriter"); | ||
const bits_1 = require("./bits"); | ||
const Long = require("long"); | ||
class Item { | ||
/** | ||
@@ -52,3 +52,3 @@ * Constructs a copy of the given item. | ||
*/ | ||
function Item(index, i) { | ||
constructor(index, i) { | ||
this.index = index; | ||
@@ -72,7 +72,7 @@ if (i) { | ||
*/ | ||
Item.prototype.set$int = function (intVal) { | ||
set$int(intVal) { | ||
this.type = ClassWriter_1.ClassWriter.INT; | ||
this.intVal = intVal; | ||
this.__hashCode = 2147483647 & (this.type + intVal); | ||
}; | ||
} | ||
/** | ||
@@ -84,7 +84,7 @@ * Sets this item to a long item. | ||
*/ | ||
Item.prototype.set$long = function (longVal) { | ||
set$long(longVal) { | ||
this.type = ClassWriter_1.ClassWriter.LONG; | ||
this.longVal = longVal; | ||
this.__hashCode = 2147483647 & (this.type + (longVal.getLowBits())); | ||
}; | ||
} | ||
/** | ||
@@ -96,7 +96,7 @@ * Sets this item to a float item. | ||
*/ | ||
Item.prototype.set$float = function (floatVal) { | ||
set$float(floatVal) { | ||
this.type = ClassWriter_1.ClassWriter.FLOAT; | ||
this.intVal = bits_1.floatToIntBits(floatVal); | ||
this.__hashCode = 2147483647 & (this.type + (floatVal | 0)); | ||
}; | ||
} | ||
/** | ||
@@ -108,7 +108,7 @@ * Sets this item to a double item. | ||
*/ | ||
Item.prototype.set$double = function (doubleVal) { | ||
set$double(doubleVal) { | ||
this.type = ClassWriter_1.ClassWriter.DOUBLE; | ||
this.longVal = bits_1.doubleToLongBits(doubleVal); | ||
this.__hashCode = 2147483647 & (this.type + (doubleVal | 0)); | ||
}; | ||
} | ||
/** | ||
@@ -126,3 +126,3 @@ * Sets this item to an item that do not hold a primitive value. | ||
*/ | ||
Item.prototype.set = function (type, strVal1, strVal2, strVal3) { | ||
set(type, strVal1, strVal2, strVal3) { | ||
this.type = type; | ||
@@ -154,3 +154,3 @@ this.strVal1 = strVal1; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -166,3 +166,3 @@ * Sets the item to an InvokeDynamic item. | ||
*/ | ||
Item.prototype.setInvkDynItem = function (name, desc, bsmIndex) { | ||
setInvkDynItem(name, desc, bsmIndex) { | ||
this.type = ClassWriter_1.ClassWriter.INDY; | ||
@@ -173,3 +173,3 @@ this.longVal = Long.fromInt(bsmIndex); | ||
this.__hashCode = 2147483647 & (ClassWriter_1.ClassWriter.INDY + bsmIndex * this.strVal1.toString() * this.strVal2.toString()); | ||
}; | ||
} | ||
/** | ||
@@ -185,7 +185,7 @@ * Sets the item to a BootstrapMethod item. | ||
*/ | ||
Item.prototype.setPosHash = function (position, hashCode) { | ||
setPosHash(position, hashCode) { | ||
this.type = ClassWriter_1.ClassWriter.BSM; | ||
this.intVal = position; | ||
this.__hashCode = hashCode; | ||
}; | ||
} | ||
/** | ||
@@ -201,3 +201,3 @@ * Indicates if the given item is equal to this one. <i>This method assumes | ||
*/ | ||
Item.prototype.isEqualTo = function (i) { | ||
isEqualTo(i) { | ||
switch ((this.type)) { | ||
@@ -229,5 +229,4 @@ case ClassWriter_1.ClassWriter.UTF8: | ||
} | ||
}; | ||
return Item; | ||
}()); | ||
} | ||
} | ||
exports.Item = Item; | ||
@@ -239,4 +238,4 @@ Item["__class"] = "Item"; | ||
return hash; | ||
for (var i = 0; i < str.length; i++) { | ||
var char = str.charCodeAt(i); | ||
for (let i = 0; i < str.length; i++) { | ||
let char = str.charCodeAt(i); | ||
hash = ((hash << 5) - hash) + char; | ||
@@ -251,4 +250,4 @@ hash = hash & hash; // Convert to 32bit integer | ||
return hash; | ||
for (var i = 0; i < this.length; i++) { | ||
var char = this.charCodeAt(i); | ||
for (let i = 0; i < this.length; i++) { | ||
let char = this.charCodeAt(i); | ||
hash = ((hash << 5) - hash) + char; | ||
@@ -255,0 +254,0 @@ hash = hash & hash; // Convert to 32bit integer |
@@ -42,11 +42,11 @@ "use strict"; | ||
*/ | ||
var Edge_1 = require("./Edge"); | ||
var Opcodes_1 = require("./Opcodes"); | ||
var ClassReader_1 = require("./ClassReader"); | ||
var bits = require("./bits"); | ||
var Label = /** @class */ (function () { | ||
const Edge_1 = require("./Edge"); | ||
const Opcodes_1 = require("./Opcodes"); | ||
const ClassReader_1 = require("./ClassReader"); | ||
const bits = require("./bits"); | ||
class Label { | ||
/** | ||
* Constructs a new label. | ||
*/ | ||
function Label() { | ||
constructor() { | ||
this.status = 0; | ||
@@ -69,3 +69,3 @@ this.line = 0; | ||
*/ | ||
Label.prototype.getOffset = function () { | ||
getOffset() { | ||
if ((this.status & Label.RESOLVED) === 0) { | ||
@@ -75,3 +75,3 @@ throw new Error("Label offset position has not been resolved yet"); | ||
return this.position; | ||
}; | ||
} | ||
/** | ||
@@ -96,3 +96,3 @@ * Puts a reference to this label in the bytecode of a method. If the | ||
*/ | ||
Label.prototype.put = function (owner, out, source, wideOffset) { | ||
put(owner, out, source, wideOffset) { | ||
if ((this.status & Label.RESOLVED) === 0) { | ||
@@ -116,3 +116,3 @@ if (wideOffset) { | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -131,3 +131,3 @@ * Adds a forward reference to this label. This method must be called only | ||
*/ | ||
Label.prototype.addReference = function (sourcePosition, referencePosition) { | ||
addReference(sourcePosition, referencePosition) { | ||
if (this.srcAndRefPositions == null) { | ||
@@ -137,3 +137,3 @@ this.srcAndRefPositions = new Array(6); | ||
if (this.referenceCount >= this.srcAndRefPositions.length) { | ||
var a = new Array(this.srcAndRefPositions.length + 6); | ||
let a = new Array(this.srcAndRefPositions.length + 6); | ||
a.concat(this.srcAndRefPositions); | ||
@@ -145,3 +145,3 @@ // java.lang.System.arraycopy(this.srcAndRefPositions, 0, a, 0, this.srcAndRefPositions.length); | ||
this.srcAndRefPositions[this.referenceCount++] = referencePosition; | ||
}; | ||
} | ||
/** | ||
@@ -169,15 +169,15 @@ * Resolves all forward references to this label. This method must be called | ||
*/ | ||
Label.prototype.resolve = function (owner, position, data) { | ||
var needUpdate = false; | ||
resolve(owner, position, data) { | ||
let needUpdate = false; | ||
this.status |= Label.RESOLVED; | ||
this.position = position; | ||
var i = 0; | ||
let i = 0; | ||
while ((i < this.referenceCount)) { | ||
var source = this.srcAndRefPositions[i++]; | ||
var reference = this.srcAndRefPositions[i++]; | ||
var offset = void 0; | ||
let source = this.srcAndRefPositions[i++]; | ||
let reference = this.srcAndRefPositions[i++]; | ||
let offset; | ||
if (source >= 0) { | ||
offset = position - source; | ||
if (offset < bits.SHORT_MIN || offset > bits.SHORT_MAX) { | ||
var opcode = data[reference - 1] & 255; | ||
let opcode = data[reference - 1] & 255; | ||
if (opcode <= Opcodes_1.Opcodes.JSR) { | ||
@@ -204,3 +204,3 @@ data[reference - 1] = ((opcode + 49) | 0); | ||
return needUpdate; | ||
}; | ||
} | ||
/** | ||
@@ -214,5 +214,5 @@ * Returns the first label of the series to which this label belongs. For an | ||
*/ | ||
Label.prototype.getFirst = function () { | ||
getFirst() { | ||
return !ClassReader_1.ClassReader.FRAMES || this.frame == null ? this : this.frame.owner; | ||
}; | ||
} | ||
/** | ||
@@ -225,3 +225,3 @@ * Returns true is this basic block belongs to the given subroutine. | ||
*/ | ||
Label.prototype.inSubroutine = function (id) { | ||
inSubroutine(id) { | ||
if ((this.status & Label.VISITED) !== 0) { | ||
@@ -231,3 +231,3 @@ return (this.srcAndRefPositions[((id >>> 32) | 0)] & (id | 0)) !== 0; | ||
return false; | ||
}; | ||
} | ||
/** | ||
@@ -242,7 +242,7 @@ * Returns true if this basic block and the given one belong to a common | ||
*/ | ||
Label.prototype.inSameSubroutine = function (block) { | ||
inSameSubroutine(block) { | ||
if ((this.status & Label.VISITED) === 0 || (block.status & Label.VISITED) === 0) { | ||
return false; | ||
} | ||
for (var i = 0; i < this.srcAndRefPositions.length; ++i) { | ||
for (let i = 0; i < this.srcAndRefPositions.length; ++i) { | ||
if ((this.srcAndRefPositions[i] & block.srcAndRefPositions[i]) !== 0) { | ||
@@ -253,3 +253,3 @@ return true; | ||
return false; | ||
}; | ||
} | ||
/** | ||
@@ -263,3 +263,3 @@ * Marks this basic block as belonging to the given subroutine. | ||
*/ | ||
Label.prototype.addToSubroutine = function (id, nbSubroutines) { | ||
addToSubroutine(id, nbSubroutines) { | ||
if ((this.status & Label.VISITED) === 0) { | ||
@@ -270,3 +270,3 @@ this.status |= Label.VISITED; | ||
this.srcAndRefPositions[((id >>> 32) | 0)] |= (id | 0); | ||
}; | ||
} | ||
/** | ||
@@ -287,6 +287,6 @@ * Finds the basic blocks that belong to a given subroutine, and marks these | ||
*/ | ||
Label.prototype.visitSubroutine = function (JSR, id, nbSubroutines) { | ||
var stack = this; | ||
visitSubroutine(JSR, id, nbSubroutines) { | ||
let stack = this; | ||
while ((stack != null)) { | ||
var l = stack; | ||
let l = stack; | ||
stack = l.next; | ||
@@ -301,7 +301,7 @@ l.next = null; | ||
if (!l.inSameSubroutine(JSR)) { | ||
var e_1 = new Edge_1.Edge(); | ||
e_1.info = l.inputStackTop; | ||
e_1.successor = JSR.successors.successor; | ||
e_1.next = l.successors; | ||
l.successors = e_1; | ||
let e = new Edge_1.Edge(); | ||
e.info = l.inputStackTop; | ||
e.successor = JSR.successors.successor; | ||
e.next = l.successors; | ||
l.successors = e; | ||
} | ||
@@ -316,3 +316,3 @@ } | ||
} | ||
var e = l.successors; | ||
let e = l.successors; | ||
while ((e != null)) { | ||
@@ -330,3 +330,3 @@ if ((l.status & Label.JSR) === 0 || e !== l.successors.next) { | ||
; | ||
}; | ||
} | ||
/** | ||
@@ -337,64 +337,63 @@ * Returns a string representation of this label. | ||
*/ | ||
Label.prototype.toString = function () { | ||
toString() { | ||
return "Lable"; | ||
// return "L" + java.lang.System.identityHashCode(this); | ||
}; | ||
/** | ||
* Indicates if this label is only used for debug attributes. Such a label | ||
* is not the start of a basic block, the target of a jump instruction, or | ||
* an exception handler. It can be safely ignored in control flow graph | ||
* analysis algorithms (for optimization purposes). | ||
*/ | ||
Label.DEBUG = 1; | ||
/** | ||
* Indicates if the position of this label is known. | ||
*/ | ||
Label.RESOLVED = 2; | ||
/** | ||
* Indicates if this label has been updated, after instruction resizing. | ||
*/ | ||
Label.RESIZED = 4; | ||
/** | ||
* Indicates if this basic block has been pushed in the basic block stack. | ||
* See {@link MethodWriter#visitMaxs visitMaxs}. | ||
*/ | ||
Label.PUSHED = 8; | ||
/** | ||
* Indicates if this label is the target of a jump instruction, or the start | ||
* of an exception handler. | ||
*/ | ||
Label.TARGET = 16; | ||
/** | ||
* Indicates if a stack map frame must be stored for this label. | ||
*/ | ||
Label.STORE = 32; | ||
/** | ||
* Indicates if this label corresponds to a reachable basic block. | ||
*/ | ||
Label.REACHABLE = 64; | ||
/** | ||
* Indicates if this basic block ends with a JSR instruction. | ||
*/ | ||
Label.JSR = 128; | ||
/** | ||
* Indicates if this basic block ends with a RET instruction. | ||
*/ | ||
Label.RET = 256; | ||
/** | ||
* Indicates if this basic block is the start of a subroutine. | ||
*/ | ||
Label.SUBROUTINE = 512; | ||
/** | ||
* Indicates if this subroutine basic block has been visited by a | ||
* visitSubroutine(null, ...) call. | ||
*/ | ||
Label.VISITED = 1024; | ||
/** | ||
* Indicates if this subroutine basic block has been visited by a | ||
* visitSubroutine(!null, ...) call. | ||
*/ | ||
Label.VISITED2 = 2048; | ||
return Label; | ||
}()); | ||
} | ||
} | ||
exports.Label = Label; | ||
/** | ||
* Indicates if this label is only used for debug attributes. Such a label | ||
* is not the start of a basic block, the target of a jump instruction, or | ||
* an exception handler. It can be safely ignored in control flow graph | ||
* analysis algorithms (for optimization purposes). | ||
*/ | ||
Label.DEBUG = 1; | ||
/** | ||
* Indicates if the position of this label is known. | ||
*/ | ||
Label.RESOLVED = 2; | ||
/** | ||
* Indicates if this label has been updated, after instruction resizing. | ||
*/ | ||
Label.RESIZED = 4; | ||
/** | ||
* Indicates if this basic block has been pushed in the basic block stack. | ||
* See {@link MethodWriter#visitMaxs visitMaxs}. | ||
*/ | ||
Label.PUSHED = 8; | ||
/** | ||
* Indicates if this label is the target of a jump instruction, or the start | ||
* of an exception handler. | ||
*/ | ||
Label.TARGET = 16; | ||
/** | ||
* Indicates if a stack map frame must be stored for this label. | ||
*/ | ||
Label.STORE = 32; | ||
/** | ||
* Indicates if this label corresponds to a reachable basic block. | ||
*/ | ||
Label.REACHABLE = 64; | ||
/** | ||
* Indicates if this basic block ends with a JSR instruction. | ||
*/ | ||
Label.JSR = 128; | ||
/** | ||
* Indicates if this basic block ends with a RET instruction. | ||
*/ | ||
Label.RET = 256; | ||
/** | ||
* Indicates if this basic block is the start of a subroutine. | ||
*/ | ||
Label.SUBROUTINE = 512; | ||
/** | ||
* Indicates if this subroutine basic block has been visited by a | ||
* visitSubroutine(null, ...) call. | ||
*/ | ||
Label.VISITED = 1024; | ||
/** | ||
* Indicates if this subroutine basic block has been visited by a | ||
* visitSubroutine(!null, ...) call. | ||
*/ | ||
Label.VISITED2 = 2048; | ||
Label["__class"] = "Label"; |
@@ -57,4 +57,4 @@ "use strict"; | ||
*/ | ||
var Opcodes_1 = require("./Opcodes"); | ||
var MethodVisitor = /** @class */ (function () { | ||
const Opcodes_1 = require("./Opcodes"); | ||
class MethodVisitor { | ||
/** | ||
@@ -70,4 +70,3 @@ * Constructs a new {@link MethodVisitor}. | ||
*/ | ||
function MethodVisitor(api, mv) { | ||
if (mv === void 0) { mv = null; } | ||
constructor(api, mv = null) { | ||
this.api = 0; | ||
@@ -90,3 +89,3 @@ if (api !== Opcodes_1.Opcodes.ASM4 && api !== Opcodes_1.Opcodes.ASM5) { | ||
*/ | ||
MethodVisitor.prototype.visitParameter = function (name, access) { | ||
visitParameter(name, access) { | ||
if (this.api < Opcodes_1.Opcodes.ASM5) { | ||
@@ -98,3 +97,3 @@ throw new Error(); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -110,3 +109,3 @@ * Visits the default value of this annotation interface method. | ||
*/ | ||
MethodVisitor.prototype.visitAnnotationDefault = function () { | ||
visitAnnotationDefault() { | ||
if (this.mv != null) { | ||
@@ -116,3 +115,3 @@ return this.mv.visitAnnotationDefault(); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -128,3 +127,3 @@ * Visits an annotation of this method. | ||
*/ | ||
MethodVisitor.prototype.visitAnnotation = function (desc, visible) { | ||
visitAnnotation(desc, visible) { | ||
if (this.mv != null) { | ||
@@ -134,3 +133,3 @@ return this.mv.visitAnnotation(desc, visible); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -161,3 +160,3 @@ * Visits an annotation on a type in the method signature. | ||
*/ | ||
MethodVisitor.prototype.visitTypeAnnotation = function (typeRef, typePath, desc, visible) { | ||
visitTypeAnnotation(typeRef, typePath, desc, visible) { | ||
if (this.api < Opcodes_1.Opcodes.ASM5) { | ||
@@ -170,3 +169,3 @@ throw new Error(); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -184,3 +183,3 @@ * Visits an annotation of a parameter this method. | ||
*/ | ||
MethodVisitor.prototype.visitParameterAnnotation = function (parameter, desc, visible) { | ||
visitParameterAnnotation(parameter, desc, visible) { | ||
if (this.mv != null) { | ||
@@ -190,3 +189,3 @@ return this.mv.visitParameterAnnotation(parameter, desc, visible); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -198,15 +197,15 @@ * Visits a non standard attribute of this method. | ||
*/ | ||
MethodVisitor.prototype.visitAttribute = function (attr) { | ||
visitAttribute(attr) { | ||
if (this.mv != null) { | ||
this.mv.visitAttribute(attr); | ||
} | ||
}; | ||
} | ||
/** | ||
* Starts the visit of the method's code, if any (i.e. non abstract method). | ||
*/ | ||
MethodVisitor.prototype.visitCode = function () { | ||
visitCode() { | ||
if (this.mv != null) { | ||
this.mv.visitCode(); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -287,9 +286,8 @@ * Visits the current state of the local variables and operand stack | ||
*/ | ||
MethodVisitor.prototype.visitFrame = function (type, nLocal, local, nStack, stack) { | ||
var _this = this; | ||
visitFrame(type, nLocal, local, nStack, stack) { | ||
if (((typeof type === 'number') || type === null) && ((typeof nLocal === 'number') || nLocal === null) && ((local != null && local instanceof Array) || local === null) && ((typeof nStack === 'number') || nStack === null) && ((stack != null && stack instanceof Array) || stack === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
return (function () { | ||
if (_this.mv != null) { | ||
_this.mv.visitFrame(type, nLocal, local, nStack, stack); | ||
let __args = Array.prototype.slice.call(arguments); | ||
return (() => { | ||
if (this.mv != null) { | ||
this.mv.visitFrame(type, nLocal, local, nStack, stack); | ||
} | ||
@@ -300,3 +298,3 @@ })(); | ||
throw new Error('invalid overload'); | ||
}; | ||
} | ||
/** | ||
@@ -322,7 +320,7 @@ * Visits a zero operand instruction. | ||
*/ | ||
MethodVisitor.prototype.visitInsn = function (opcode) { | ||
visitInsn(opcode) { | ||
if (this.mv != null) { | ||
this.mv.visitInsn(opcode); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -346,7 +344,7 @@ * Visits an instruction with a single int operand. | ||
*/ | ||
MethodVisitor.prototype.visitIntInsn = function (opcode, operand) { | ||
visitIntInsn(opcode, operand) { | ||
if (this.mv != null) { | ||
this.mv.visitIntInsn(opcode, operand); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -364,7 +362,7 @@ * Visits a local variable instruction. A local variable instruction is an | ||
*/ | ||
MethodVisitor.prototype.visitVarInsn = function (opcode, __var) { | ||
visitVarInsn(opcode, __var) { | ||
if (this.mv != null) { | ||
this.mv.visitVarInsn(opcode, __var); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -382,7 +380,7 @@ * Visits a type instruction. A type instruction is an instruction that | ||
*/ | ||
MethodVisitor.prototype.visitTypeInsn = function (opcode, type) { | ||
visitTypeInsn(opcode, type) { | ||
if (this.mv != null) { | ||
this.mv.visitTypeInsn(opcode, type); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -403,7 +401,7 @@ * Visits a field instruction. A field instruction is an instruction that | ||
*/ | ||
MethodVisitor.prototype.visitFieldInsn = function (opcode, owner, name, desc) { | ||
visitFieldInsn(opcode, owner, name, desc) { | ||
if (this.mv != null) { | ||
this.mv.visitFieldInsn(opcode, owner, name, desc); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -425,5 +423,5 @@ * Visits a method instruction. A method instruction is an instruction that | ||
*/ | ||
MethodVisitor.prototype.visitMethodInsn$int$java_lang_String$java_lang_String$java_lang_String = function (opcode, owner, name, desc) { | ||
visitMethodInsn$int$java_lang_String$java_lang_String$java_lang_String(opcode, owner, name, desc) { | ||
if (this.api >= Opcodes_1.Opcodes.ASM5) { | ||
var itf = opcode === Opcodes_1.Opcodes.INVOKEINTERFACE; | ||
let itf = opcode === Opcodes_1.Opcodes.INVOKEINTERFACE; | ||
this.visitMethodInsn(opcode, owner, name, desc, itf); | ||
@@ -435,3 +433,3 @@ return; | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -455,16 +453,15 @@ * Visits a method instruction. A method instruction is an instruction that | ||
*/ | ||
MethodVisitor.prototype.visitMethodInsn = function (opcode, owner, name, desc, itf) { | ||
var _this = this; | ||
visitMethodInsn(opcode, owner, name, desc, itf) { | ||
if (((typeof opcode === 'number') || opcode === null) && ((typeof owner === 'string') || owner === null) && ((typeof name === 'string') || name === null) && ((typeof desc === 'string') || desc === null) && ((typeof itf === 'boolean') || itf === null)) { | ||
var __args = Array.prototype.slice.call(arguments); | ||
return (function () { | ||
if (_this.api < Opcodes_1.Opcodes.ASM5) { | ||
let __args = Array.prototype.slice.call(arguments); | ||
return (() => { | ||
if (this.api < Opcodes_1.Opcodes.ASM5) { | ||
if (itf !== (opcode === Opcodes_1.Opcodes.INVOKEINTERFACE)) { | ||
throw new Error("INVOKESPECIAL/STATIC on interfaces require ASM 5"); | ||
} | ||
_this.visitMethodInsn(opcode, owner, name, desc); | ||
this.visitMethodInsn(opcode, owner, name, desc); | ||
return; | ||
} | ||
if (_this.mv != null) { | ||
_this.mv.visitMethodInsn(opcode, owner, name, desc, itf); | ||
if (this.mv != null) { | ||
this.mv.visitMethodInsn(opcode, owner, name, desc, itf); | ||
} | ||
@@ -478,3 +475,3 @@ })(); | ||
throw new Error('invalid overload'); | ||
}; | ||
} | ||
/** | ||
@@ -496,11 +493,7 @@ * Visits an invokedynamic instruction. | ||
*/ | ||
MethodVisitor.prototype.visitInvokeDynamicInsn = function (name, desc, bsm) { | ||
var bsmArgs = []; | ||
for (var _i = 3; _i < arguments.length; _i++) { | ||
bsmArgs[_i - 3] = arguments[_i]; | ||
} | ||
visitInvokeDynamicInsn(name, desc, bsm, ...bsmArgs) { | ||
if (this.mv != null) { | ||
(this['__jswref_0'] = this.mv).visitInvokeDynamicInsn.apply(this['__jswref_0'], [name, desc, bsm].concat(bsmArgs)); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -520,7 +513,7 @@ * Visits a jump instruction. A jump instruction is an instruction that may | ||
*/ | ||
MethodVisitor.prototype.visitJumpInsn = function (opcode, label) { | ||
visitJumpInsn(opcode, label) { | ||
if (this.mv != null) { | ||
this.mv.visitJumpInsn(opcode, label); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -533,7 +526,7 @@ * Visits a label. A label designates the instruction that will be visited | ||
*/ | ||
MethodVisitor.prototype.visitLabel = function (label) { | ||
visitLabel(label) { | ||
if (this.mv != null) { | ||
this.mv.visitLabel(label); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -583,7 +576,7 @@ * Visits a LDC instruction. Note that new constant types may be added in | ||
*/ | ||
MethodVisitor.prototype.visitLdcInsn = function (cst) { | ||
visitLdcInsn(cst) { | ||
if (this.mv != null) { | ||
this.mv.visitLdcInsn(cst); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -597,7 +590,7 @@ * Visits an IINC instruction. | ||
*/ | ||
MethodVisitor.prototype.visitIincInsn = function (__var, increment) { | ||
visitIincInsn(__var, increment) { | ||
if (this.mv != null) { | ||
this.mv.visitIincInsn(__var, increment); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -616,11 +609,7 @@ * Visits a TABLESWITCH instruction. | ||
*/ | ||
MethodVisitor.prototype.visitTableSwitchInsn = function (min, max, dflt) { | ||
var labels = []; | ||
for (var _i = 3; _i < arguments.length; _i++) { | ||
labels[_i - 3] = arguments[_i]; | ||
} | ||
visitTableSwitchInsn(min, max, dflt, ...labels) { | ||
if (this.mv != null) { | ||
(this['__jswref_1'] = this.mv).visitTableSwitchInsn.apply(this['__jswref_1'], [min, max, dflt].concat(labels)); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -637,7 +626,7 @@ * Visits a LOOKUPSWITCH instruction. | ||
*/ | ||
MethodVisitor.prototype.visitLookupSwitchInsn = function (dflt, keys, labels) { | ||
visitLookupSwitchInsn(dflt, keys, labels) { | ||
if (this.mv != null) { | ||
this.mv.visitLookupSwitchInsn(dflt, keys, labels); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -651,7 +640,7 @@ * Visits a MULTIANEWARRAY instruction. | ||
*/ | ||
MethodVisitor.prototype.visitMultiANewArrayInsn = function (desc, dims) { | ||
visitMultiANewArrayInsn(desc, dims) { | ||
if (this.mv != null) { | ||
this.mv.visitMultiANewArrayInsn(desc, dims); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -688,3 +677,3 @@ * Visits an annotation on an instruction. This method must be called just | ||
*/ | ||
MethodVisitor.prototype.visitInsnAnnotation = function (typeRef, typePath, desc, visible) { | ||
visitInsnAnnotation(typeRef, typePath, desc, visible) { | ||
if (this.api < Opcodes_1.Opcodes.ASM5) { | ||
@@ -697,3 +686,3 @@ throw new Error(); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -716,7 +705,7 @@ * Visits a try catch block. | ||
*/ | ||
MethodVisitor.prototype.visitTryCatchBlock = function (start, end, handler, type) { | ||
visitTryCatchBlock(start, end, handler, type) { | ||
if (this.mv != null) { | ||
this.mv.visitTryCatchBlock(start, end, handler, type); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -743,3 +732,3 @@ * Visits an annotation on an exception handler type. This method must be | ||
*/ | ||
MethodVisitor.prototype.visitTryCatchAnnotation = function (typeRef, typePath, desc, visible) { | ||
visitTryCatchAnnotation(typeRef, typePath, desc, visible) { | ||
if (this.api < Opcodes_1.Opcodes.ASM5) { | ||
@@ -752,3 +741,3 @@ throw new Error(); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -777,7 +766,7 @@ * Visits a local variable declaration. | ||
*/ | ||
MethodVisitor.prototype.visitLocalVariable = function (name, desc, signature, start, end, index) { | ||
visitLocalVariable(name, desc, signature, start, end, index) { | ||
if (this.mv != null) { | ||
this.mv.visitLocalVariable(name, desc, signature, start, end, index); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -812,3 +801,3 @@ * Visits an annotation on a local variable type. | ||
*/ | ||
MethodVisitor.prototype.visitLocalVariableAnnotation = function (typeRef, typePath, start, end, index, desc, visible) { | ||
visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible) { | ||
if (this.api < Opcodes_1.Opcodes.ASM5) { | ||
@@ -821,3 +810,3 @@ throw new Error(); | ||
return null; | ||
}; | ||
} | ||
/** | ||
@@ -835,7 +824,7 @@ * Visits a line number declaration. | ||
*/ | ||
MethodVisitor.prototype.visitLineNumber = function (line, start) { | ||
visitLineNumber(line, start) { | ||
if (this.mv != null) { | ||
this.mv.visitLineNumber(line, start); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -850,7 +839,7 @@ * Visits the maximum stack size and the maximum number of local variables | ||
*/ | ||
MethodVisitor.prototype.visitMaxs = function (maxStack, maxLocals) { | ||
visitMaxs(maxStack, maxLocals) { | ||
if (this.mv != null) { | ||
this.mv.visitMaxs(maxStack, maxLocals); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -861,10 +850,9 @@ * Visits the end of the method. This method, which is the last one to be | ||
*/ | ||
MethodVisitor.prototype.visitEnd = function () { | ||
visitEnd() { | ||
if (this.mv != null) { | ||
this.mv.visitEnd(); | ||
} | ||
}; | ||
return MethodVisitor; | ||
}()); | ||
} | ||
} | ||
exports.MethodVisitor = MethodVisitor; | ||
MethodVisitor["__class"] = "MethodVisitor"; |
@@ -181,3 +181,3 @@ /** | ||
*/ | ||
readonly internalName: string; | ||
get internalName(): string; | ||
/** | ||
@@ -197,3 +197,3 @@ * Appends the descriptor corresponding to this Java type to the given | ||
*/ | ||
readonly size: number; | ||
get size(): number; | ||
/** | ||
@@ -200,0 +200,0 @@ * Tests if the given object is equal to this type. |
@@ -10,3 +10,3 @@ "use strict"; | ||
*/ | ||
var Type = /** @class */ (function () { | ||
class Type { | ||
/** | ||
@@ -20,3 +20,3 @@ * Constructs a reference type. | ||
*/ | ||
function Type(sort, buf, off, len) { | ||
constructor(sort, buf, off, len) { | ||
this.sort = 0; | ||
@@ -36,5 +36,5 @@ this.off = 0; | ||
*/ | ||
Type.getObjectType = function (internalName) { | ||
static getObjectType(internalName) { | ||
return new Type(internalName[0] === '[' ? Type.ARRAY : Type.OBJECT, internalName, 0, internalName.length); | ||
}; | ||
} | ||
/** | ||
@@ -47,5 +47,5 @@ * Returns the Java type corresponding to the given method descriptor. | ||
*/ | ||
Type.getMethodType = function (methodDescriptor) { | ||
static getMethodType(methodDescriptor) { | ||
return Type.getType(methodDescriptor, 0); | ||
}; | ||
} | ||
/** | ||
@@ -59,7 +59,7 @@ * Returns the Java types corresponding to the argument types of the given | ||
*/ | ||
Type.getArgumentTypes = function (methodDescriptor) { | ||
var off = 1; | ||
var size = 0; | ||
static getArgumentTypes(methodDescriptor) { | ||
let off = 1; | ||
let size = 0; | ||
while ((true)) { | ||
var car = methodDescriptor[off++]; | ||
let car = methodDescriptor[off++]; | ||
if (car === ')') { | ||
@@ -79,3 +79,3 @@ break; | ||
; | ||
var args = new Array(size); | ||
let args = new Array(size); | ||
off = 1; | ||
@@ -90,3 +90,3 @@ size = 0; | ||
return args; | ||
}; | ||
} | ||
/** | ||
@@ -102,7 +102,7 @@ * Computes the size of the arguments and of the return value of a method. | ||
*/ | ||
Type.getArgumentsAndReturnSizes = function (desc) { | ||
var n = 1; | ||
var c = 1; | ||
static getArgumentsAndReturnSizes(desc) { | ||
let n = 1; | ||
let c = 1; | ||
while ((true)) { | ||
var car = desc.charAt(c++); | ||
let car = desc.charAt(c++); | ||
if (car === ')') { | ||
@@ -135,3 +135,3 @@ car = desc.charAt(c); | ||
; | ||
}; | ||
} | ||
/** | ||
@@ -146,6 +146,5 @@ * Returns the Java type corresponding to the given type descriptor. For | ||
*/ | ||
Type.getType = function (str, off) { | ||
if (off === void 0) { off = 0; } | ||
var len; | ||
var buf = ''.concat(str); | ||
static getType(str, off = 0) { | ||
let len; | ||
let buf = ''.concat(str); | ||
switch (buf[off]) { | ||
@@ -194,19 +193,15 @@ case 'V': | ||
} | ||
}; | ||
Object.defineProperty(Type.prototype, "internalName", { | ||
/** | ||
* Returns the internal name of the class corresponding to this object or | ||
* array type. The internal name of a class is its fully qualified name (as | ||
* returned by Class.getName(), where '.' are replaced by '/'. This method | ||
* should only be used for an object or array type. | ||
* | ||
* @return the internal name of the class corresponding to this object type. | ||
*/ | ||
get: function () { | ||
return this.buf.substr(this.off, this.len); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
} | ||
/** | ||
* Returns the internal name of the class corresponding to this object or | ||
* array type. The internal name of a class is its fully qualified name (as | ||
* returned by Class.getName(), where '.' are replaced by '/'. This method | ||
* should only be used for an object or array type. | ||
* | ||
* @return the internal name of the class corresponding to this object type. | ||
*/ | ||
get internalName() { | ||
return this.buf.substr(this.off, this.len); | ||
} | ||
/** | ||
* Appends the descriptor corresponding to this Java type to the given | ||
@@ -217,7 +212,6 @@ * string buffer. | ||
*/ | ||
Type.prototype.getDescriptor = function (buf) { | ||
if (buf === void 0) { buf = ''; } | ||
getDescriptor(buf = '') { | ||
if (this.sort == Type.OBJECT) { | ||
buf += ('L'); | ||
for (var i = 0; i < this.len; i++) { | ||
for (let i = 0; i < this.len; i++) { | ||
buf += this.buf[i + this.off]; | ||
@@ -229,3 +223,3 @@ } | ||
else { // sort == ARRAY || sort == METHOD | ||
for (var i = 0; i < this.len; i++) { | ||
for (let i = 0; i < this.len; i++) { | ||
buf += this.buf[i + this.off]; | ||
@@ -235,18 +229,14 @@ } | ||
} | ||
}; | ||
Object.defineProperty(Type.prototype, "size", { | ||
/** | ||
* Returns the size of values of this type. This method must not be used for | ||
* method types. | ||
* | ||
* @return the size of values of this type, i.e., 2 for <tt>long</tt> and | ||
* <tt>double</tt>, 0 for <tt>void</tt> and 1 otherwise. | ||
*/ | ||
get: function () { | ||
return this.buf == null ? (this.off & 255) : 1; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
} | ||
/** | ||
* Returns the size of values of this type. This method must not be used for | ||
* method types. | ||
* | ||
* @return the size of values of this type, i.e., 2 for <tt>long</tt> and | ||
* <tt>double</tt>, 0 for <tt>void</tt> and 1 otherwise. | ||
*/ | ||
get size() { | ||
return this.buf == null ? (this.off & 255) : 1; | ||
} | ||
/** | ||
* Tests if the given object is equal to this type. | ||
@@ -257,3 +247,3 @@ * | ||
*/ | ||
Type.prototype.equals = function (o) { | ||
equals(o) { | ||
if (this === o) { | ||
@@ -265,3 +255,3 @@ return true; | ||
} | ||
var t = o; | ||
let t = o; | ||
if (this.sort !== t.sort) { | ||
@@ -274,3 +264,3 @@ return false; | ||
} | ||
for (var i = this.off, j = t.off, end = i + this.len; i < end; i++, j++) { | ||
for (let i = this.off, j = t.off, end = i + this.len; i < end; i++, j++) { | ||
if (this.buf[i] !== t.buf[j]) { | ||
@@ -282,3 +272,3 @@ return false; | ||
return true; | ||
}; | ||
} | ||
/** | ||
@@ -289,6 +279,6 @@ * Returns a hash code value for this type. | ||
*/ | ||
Type.prototype.hashCode = function () { | ||
var hc = 13 * this.sort; | ||
hashCode() { | ||
let hc = 13 * this.sort; | ||
if (this.sort >= Type.ARRAY) { | ||
for (var i = this.off, end = i + this.len; i < end; i++) { | ||
for (let i = this.off, end = i + this.len; i < end; i++) { | ||
hc = 17 * (hc + (this.buf[i]).charCodeAt(0)); | ||
@@ -298,3 +288,3 @@ } | ||
return hc; | ||
}; | ||
} | ||
/** | ||
@@ -305,92 +295,91 @@ * Returns a string representation of this type. | ||
*/ | ||
Type.prototype.toString = function () { | ||
toString() { | ||
return this.getDescriptor(); | ||
}; | ||
/** | ||
* The sort of the <tt>void</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.VOID = 0; | ||
/** | ||
* The sort of the <tt>boolean</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.BOOLEAN = 1; | ||
/** | ||
* The sort of the <tt>char</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.CHAR = 2; | ||
/** | ||
* The sort of the <tt>byte</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.BYTE = 3; | ||
/** | ||
* The sort of the <tt>short</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.SHORT = 4; | ||
/** | ||
* The sort of the <tt>int</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.INT = 5; | ||
/** | ||
* The sort of the <tt>float</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.FLOAT = 6; | ||
/** | ||
* The sort of the <tt>long</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.LONG = 7; | ||
/** | ||
* The sort of the <tt>double</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.DOUBLE = 8; | ||
/** | ||
* The sort of array reference types. See {@link #getSort getSort}. | ||
*/ | ||
Type.ARRAY = 9; | ||
/** | ||
* The sort of object reference types. See {@link #getSort getSort}. | ||
*/ | ||
Type.OBJECT = 10; | ||
/** | ||
* The sort of method types. See {@link #getSort getSort}. | ||
*/ | ||
Type.METHOD = 11; | ||
/** | ||
* The <tt>void</tt> type. | ||
*/ | ||
Type.VOID_TYPE = new Type(Type.VOID, null, (('V').charCodeAt(0) << 24) | (5 << 16), 1); | ||
/** | ||
* The <tt>boolean</tt> type. | ||
*/ | ||
Type.BOOLEAN_TYPE = new Type(Type.BOOLEAN, null, (('Z').charCodeAt(0) << 24) | (5 << 8) | 1, 1); | ||
/** | ||
* The <tt>char</tt> type. | ||
*/ | ||
Type.CHAR_TYPE = new Type(Type.CHAR, null, (('C').charCodeAt(0) << 24) | (6 << 8) | 1, 1); | ||
/** | ||
* The <tt>byte</tt> type. | ||
*/ | ||
Type.BYTE_TYPE = new Type(Type.BYTE, null, (('B').charCodeAt(0) << 24) | (5 << 8) | 1, 1); | ||
/** | ||
* The <tt>short</tt> type. | ||
*/ | ||
Type.SHORT_TYPE = new Type(Type.SHORT, null, (('S').charCodeAt(0) << 24) | (7 << 8) | 1, 1); | ||
/** | ||
* The <tt>int</tt> type. | ||
*/ | ||
Type.INT_TYPE = new Type(Type.INT, null, (('I').charCodeAt(0) << 24) | 1, 1); | ||
/** | ||
* The <tt>float</tt> type. | ||
*/ | ||
Type.FLOAT_TYPE = new Type(Type.FLOAT, null, (('F').charCodeAt(0) << 24) | (2 << 16) | (2 << 8) | 1, 1); | ||
/** | ||
* The <tt>long</tt> type. | ||
*/ | ||
Type.LONG_TYPE = new Type(Type.LONG, null, (('J').charCodeAt(0) << 24) | (1 << 16) | (1 << 8) | 2, 1); | ||
/** | ||
* The <tt>double</tt> type. | ||
*/ | ||
Type.DOUBLE_TYPE = new Type(Type.DOUBLE, null, (('D').charCodeAt(0) << 24) | (3 << 16) | (3 << 8) | 2, 1); | ||
return Type; | ||
}()); | ||
} | ||
} | ||
exports.Type = Type; | ||
/** | ||
* The sort of the <tt>void</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.VOID = 0; | ||
/** | ||
* The sort of the <tt>boolean</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.BOOLEAN = 1; | ||
/** | ||
* The sort of the <tt>char</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.CHAR = 2; | ||
/** | ||
* The sort of the <tt>byte</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.BYTE = 3; | ||
/** | ||
* The sort of the <tt>short</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.SHORT = 4; | ||
/** | ||
* The sort of the <tt>int</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.INT = 5; | ||
/** | ||
* The sort of the <tt>float</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.FLOAT = 6; | ||
/** | ||
* The sort of the <tt>long</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.LONG = 7; | ||
/** | ||
* The sort of the <tt>double</tt> type. See {@link #getSort getSort}. | ||
*/ | ||
Type.DOUBLE = 8; | ||
/** | ||
* The sort of array reference types. See {@link #getSort getSort}. | ||
*/ | ||
Type.ARRAY = 9; | ||
/** | ||
* The sort of object reference types. See {@link #getSort getSort}. | ||
*/ | ||
Type.OBJECT = 10; | ||
/** | ||
* The sort of method types. See {@link #getSort getSort}. | ||
*/ | ||
Type.METHOD = 11; | ||
/** | ||
* The <tt>void</tt> type. | ||
*/ | ||
Type.VOID_TYPE = new Type(Type.VOID, null, (('V').charCodeAt(0) << 24) | (5 << 16), 1); | ||
/** | ||
* The <tt>boolean</tt> type. | ||
*/ | ||
Type.BOOLEAN_TYPE = new Type(Type.BOOLEAN, null, (('Z').charCodeAt(0) << 24) | (5 << 8) | 1, 1); | ||
/** | ||
* The <tt>char</tt> type. | ||
*/ | ||
Type.CHAR_TYPE = new Type(Type.CHAR, null, (('C').charCodeAt(0) << 24) | (6 << 8) | 1, 1); | ||
/** | ||
* The <tt>byte</tt> type. | ||
*/ | ||
Type.BYTE_TYPE = new Type(Type.BYTE, null, (('B').charCodeAt(0) << 24) | (5 << 8) | 1, 1); | ||
/** | ||
* The <tt>short</tt> type. | ||
*/ | ||
Type.SHORT_TYPE = new Type(Type.SHORT, null, (('S').charCodeAt(0) << 24) | (7 << 8) | 1, 1); | ||
/** | ||
* The <tt>int</tt> type. | ||
*/ | ||
Type.INT_TYPE = new Type(Type.INT, null, (('I').charCodeAt(0) << 24) | 1, 1); | ||
/** | ||
* The <tt>float</tt> type. | ||
*/ | ||
Type.FLOAT_TYPE = new Type(Type.FLOAT, null, (('F').charCodeAt(0) << 24) | (2 << 16) | (2 << 8) | 1, 1); | ||
/** | ||
* The <tt>long</tt> type. | ||
*/ | ||
Type.LONG_TYPE = new Type(Type.LONG, null, (('J').charCodeAt(0) << 24) | (1 << 16) | (1 << 8) | 2, 1); | ||
/** | ||
* The <tt>double</tt> type. | ||
*/ | ||
Type.DOUBLE_TYPE = new Type(Type.DOUBLE, null, (('D').charCodeAt(0) << 24) | (3 << 16) | (3 << 8) | 2, 1); | ||
Type["__class"] = "Type"; |
@@ -45,3 +45,3 @@ export declare class TypePath { | ||
*/ | ||
readonly length: number; | ||
get length(): number; | ||
/** | ||
@@ -48,0 +48,0 @@ * Returns the value of the given step of this path. |
@@ -39,4 +39,4 @@ "use strict"; | ||
*/ | ||
var ByteVector_1 = require("./ByteVector"); | ||
var TypePath = /** @class */ (function () { | ||
const ByteVector_1 = require("./ByteVector"); | ||
class TypePath { | ||
/** | ||
@@ -51,3 +51,3 @@ * Creates a new type path. | ||
*/ | ||
function TypePath(b, offset) { | ||
constructor(b, offset) { | ||
this.offset = 0; | ||
@@ -57,15 +57,11 @@ this.buf = b; | ||
} | ||
Object.defineProperty(TypePath.prototype, "length", { | ||
/** | ||
* Returns the length of this path. | ||
* | ||
* @return the length of this path. | ||
*/ | ||
get: function () { | ||
return this.buf[this.offset]; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Returns the length of this path. | ||
* | ||
* @return the length of this path. | ||
*/ | ||
get length() { | ||
return this.buf[this.offset]; | ||
} | ||
/** | ||
* Returns the value of the given step of this path. | ||
@@ -79,5 +75,5 @@ * | ||
*/ | ||
TypePath.prototype.getStep = function (index) { | ||
getStep(index) { | ||
return this.buf[this.offset + 2 * index + 1]; | ||
}; | ||
} | ||
/** | ||
@@ -93,5 +89,5 @@ * Returns the index of the type argument that the given step is stepping | ||
*/ | ||
TypePath.prototype.getStepArgument = function (index) { | ||
getStepArgument(index) { | ||
return this.buf[this.offset + 2 * index + 2]; | ||
}; | ||
} | ||
/** | ||
@@ -106,11 +102,11 @@ * Converts a type path in string form, in the format used by | ||
*/ | ||
TypePath.fromString = function (typePath) { | ||
static fromString(typePath) { | ||
if (typePath == null || typePath.length === 0) { | ||
return null; | ||
} | ||
var n = typePath.length; | ||
var out = new ByteVector_1.ByteVector(n); | ||
let n = typePath.length; | ||
let out = new ByteVector_1.ByteVector(n); | ||
out.putByte(0); | ||
for (var i = 0; i < n;) { | ||
var c = typePath.charAt(i++); | ||
for (let i = 0; i < n;) { | ||
let c = typePath.charAt(i++); | ||
if (c === '[') { | ||
@@ -126,3 +122,3 @@ out.put11(TypePath.ARRAY_ELEMENT, 0); | ||
else if ((c).charCodeAt(0) >= ('0').charCodeAt(0) && (c).charCodeAt(0) <= ('9').charCodeAt(0)) { | ||
var typeArg = (c).charCodeAt(0) - ('0').charCodeAt(0); | ||
let typeArg = (c).charCodeAt(0) - ('0').charCodeAt(0); | ||
while ((i < n && ((c = typePath.charAt(i))).charCodeAt(0) >= ('0').charCodeAt(0) && (c).charCodeAt(0) <= ('9').charCodeAt(0))) { | ||
@@ -141,3 +137,3 @@ typeArg = typeArg * 10 + (c).charCodeAt(0) - ('0').charCodeAt(0); | ||
return new TypePath(out.data, 0); | ||
}; | ||
} | ||
/** | ||
@@ -150,6 +146,6 @@ * Returns a string representation of this type path. {@link #ARRAY_ELEMENT | ||
*/ | ||
TypePath.prototype.toString = function () { | ||
var length = this.length; | ||
var result; | ||
for (var i = 0; i < length; ++i) { | ||
toString() { | ||
let length = this.length; | ||
let result; | ||
for (let i = 0; i < length; ++i) { | ||
switch ((this.getStep(i))) { | ||
@@ -173,26 +169,25 @@ case TypePath.ARRAY_ELEMENT: | ||
return result.toString(); | ||
}; | ||
/** | ||
* A type path step that steps into the element type of an array type. See | ||
* {@link #getStep getStep}. | ||
*/ | ||
TypePath.ARRAY_ELEMENT = 0; | ||
/** | ||
* A type path step that steps into the nested type of a class type. See | ||
* {@link #getStep getStep}. | ||
*/ | ||
TypePath.INNER_TYPE = 1; | ||
/** | ||
* A type path step that steps into the bound of a wildcard type. See | ||
* {@link #getStep getStep}. | ||
*/ | ||
TypePath.WILDCARD_BOUND = 2; | ||
/** | ||
* A type path step that steps into a type argument of a generic type. See | ||
* {@link #getStep getStep}. | ||
*/ | ||
TypePath.TYPE_ARGUMENT = 3; | ||
return TypePath; | ||
}()); | ||
} | ||
} | ||
exports.TypePath = TypePath; | ||
/** | ||
* A type path step that steps into the element type of an array type. See | ||
* {@link #getStep getStep}. | ||
*/ | ||
TypePath.ARRAY_ELEMENT = 0; | ||
/** | ||
* A type path step that steps into the nested type of a class type. See | ||
* {@link #getStep getStep}. | ||
*/ | ||
TypePath.INNER_TYPE = 1; | ||
/** | ||
* A type path step that steps into the bound of a wildcard type. See | ||
* {@link #getStep getStep}. | ||
*/ | ||
TypePath.WILDCARD_BOUND = 2; | ||
/** | ||
* A type path step that steps into a type argument of a generic type. See | ||
* {@link #getStep getStep}. | ||
*/ | ||
TypePath.TYPE_ARGUMENT = 3; | ||
TypePath["__class"] = "TypePath"; |
@@ -42,3 +42,3 @@ "use strict"; | ||
*/ | ||
var TypeReference = /** @class */ (function () { | ||
class TypeReference { | ||
/** | ||
@@ -52,3 +52,3 @@ * Creates a new TypeReference. | ||
*/ | ||
function TypeReference(typeRef) { | ||
constructor(typeRef) { | ||
this.value = 0; | ||
@@ -70,5 +70,5 @@ this.value = typeRef; | ||
*/ | ||
TypeReference.newTypeReference = function (sort) { | ||
static newTypeReference(sort) { | ||
return new TypeReference(sort << 24); | ||
}; | ||
} | ||
/** | ||
@@ -84,5 +84,5 @@ * Returns a reference to a type parameter of a generic class or method. | ||
*/ | ||
TypeReference.newTypeParameterReference = function (sort, paramIndex) { | ||
static newTypeParameterReference(sort, paramIndex) { | ||
return new TypeReference((sort << 24) | (paramIndex << 16)); | ||
}; | ||
} | ||
/** | ||
@@ -102,5 +102,5 @@ * Returns a reference to a type parameter bound of a generic class or | ||
*/ | ||
TypeReference.newTypeParameterBoundReference = function (sort, paramIndex, boundIndex) { | ||
static newTypeParameterBoundReference(sort, paramIndex, boundIndex) { | ||
return new TypeReference((sort << 24) | (paramIndex << 16) | (boundIndex << 8)); | ||
}; | ||
} | ||
/** | ||
@@ -115,6 +115,6 @@ * Returns a reference to the super class or to an interface of the | ||
*/ | ||
TypeReference.newSuperTypeReference = function (itfIndex) { | ||
static newSuperTypeReference(itfIndex) { | ||
itfIndex &= 65535; | ||
return new TypeReference((TypeReference.CLASS_EXTENDS << 24) | (itfIndex << 8)); | ||
}; | ||
} | ||
/** | ||
@@ -128,5 +128,5 @@ * Returns a reference to the type of a formal parameter of a method. | ||
*/ | ||
TypeReference.newFormalParameterReference = function (paramIndex) { | ||
static newFormalParameterReference(paramIndex) { | ||
return new TypeReference((TypeReference.METHOD_FORMAL_PARAMETER << 24) | (paramIndex << 16)); | ||
}; | ||
} | ||
/** | ||
@@ -141,5 +141,5 @@ * Returns a reference to the type of an exception, in a 'throws' clause of | ||
*/ | ||
TypeReference.newExceptionReference = function (exceptionIndex) { | ||
static newExceptionReference(exceptionIndex) { | ||
return new TypeReference((TypeReference.THROWS << 24) | (exceptionIndex << 8)); | ||
}; | ||
} | ||
/** | ||
@@ -155,5 +155,5 @@ * Returns a reference to the type of the exception declared in a 'catch' | ||
*/ | ||
TypeReference.newTryCatchReference = function (tryCatchBlockIndex) { | ||
static newTryCatchReference(tryCatchBlockIndex) { | ||
return new TypeReference((TypeReference.EXCEPTION_PARAMETER << 24) | (tryCatchBlockIndex << 8)); | ||
}; | ||
} | ||
/** | ||
@@ -178,5 +178,5 @@ * Returns a reference to the type of a type argument in a constructor or | ||
*/ | ||
TypeReference.newTypeArgumentReference = function (sort, argIndex) { | ||
static newTypeArgumentReference(sort, argIndex) { | ||
return new TypeReference((sort << 24) | argIndex); | ||
}; | ||
} | ||
/** | ||
@@ -208,5 +208,5 @@ * Returns the sort of this type reference. | ||
*/ | ||
TypeReference.prototype.getSort = function () { | ||
getSort() { | ||
return this.value >>> 24; | ||
}; | ||
} | ||
/** | ||
@@ -222,5 +222,5 @@ * Returns the index of the type parameter referenced by this type | ||
*/ | ||
TypeReference.prototype.getTypeParameterIndex = function () { | ||
getTypeParameterIndex() { | ||
return (this.value & 16711680) >> 16; | ||
}; | ||
} | ||
/** | ||
@@ -235,5 +235,5 @@ * Returns the index of the type parameter bound, within the type parameter | ||
*/ | ||
TypeReference.prototype.getTypeParameterBoundIndex = function () { | ||
getTypeParameterBoundIndex() { | ||
return (this.value & 65280) >> 8; | ||
}; | ||
} | ||
/** | ||
@@ -248,5 +248,5 @@ * Returns the index of the "super type" of a class that is referenced by | ||
*/ | ||
TypeReference.prototype.getSuperTypeIndex = function () { | ||
getSuperTypeIndex() { | ||
return (((this.value & 16776960) >> 8) | 0); | ||
}; | ||
} | ||
/** | ||
@@ -259,5 +259,5 @@ * Returns the index of the formal parameter whose type is referenced by | ||
*/ | ||
TypeReference.prototype.getFormalParameterIndex = function () { | ||
getFormalParameterIndex() { | ||
return (this.value & 16711680) >> 16; | ||
}; | ||
} | ||
/** | ||
@@ -270,5 +270,5 @@ * Returns the index of the exception, in a 'throws' clause of a method, | ||
*/ | ||
TypeReference.prototype.getExceptionIndex = function () { | ||
getExceptionIndex() { | ||
return (this.value & 16776960) >> 8; | ||
}; | ||
} | ||
/** | ||
@@ -282,5 +282,5 @@ * Returns the index of the try catch block (using the order in which they | ||
*/ | ||
TypeReference.prototype.getTryCatchBlockIndex = function () { | ||
getTryCatchBlockIndex() { | ||
return (this.value & 16776960) >> 8; | ||
}; | ||
} | ||
/** | ||
@@ -298,5 +298,5 @@ * Returns the index of the type argument referenced by this type reference. | ||
*/ | ||
TypeReference.prototype.getTypeArgumentIndex = function () { | ||
getTypeArgumentIndex() { | ||
return this.value & 255; | ||
}; | ||
} | ||
/** | ||
@@ -308,118 +308,117 @@ * Returns the int encoded value of this type reference, suitable for use in | ||
*/ | ||
TypeReference.prototype.getValue = function () { | ||
getValue() { | ||
return this.value; | ||
}; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* class. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CLASS_TYPE_PARAMETER = 0; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_TYPE_PARAMETER = 1; | ||
/** | ||
* The sort of type references that target the super class of a class or one | ||
* of the interfaces it implements. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CLASS_EXTENDS = 16; | ||
/** | ||
* The sort of type references that target a bound of a type parameter of a | ||
* generic class. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CLASS_TYPE_PARAMETER_BOUND = 17; | ||
/** | ||
* The sort of type references that target a bound of a type parameter of a | ||
* generic method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_TYPE_PARAMETER_BOUND = 18; | ||
/** | ||
* The sort of type references that target the type of a field. See | ||
* {@link #getSort getSort}. | ||
*/ | ||
TypeReference.FIELD = 19; | ||
/** | ||
* The sort of type references that target the return type of a method. See | ||
* {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_RETURN = 20; | ||
/** | ||
* The sort of type references that target the receiver type of a method. | ||
* See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_RECEIVER = 21; | ||
/** | ||
* The sort of type references that target the type of a formal parameter of | ||
* a method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_FORMAL_PARAMETER = 22; | ||
/** | ||
* The sort of type references that target the type of an exception declared | ||
* in the throws clause of a method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.THROWS = 23; | ||
/** | ||
* The sort of type references that target the type of a local variable in a | ||
* method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.LOCAL_VARIABLE = 64; | ||
/** | ||
* The sort of type references that target the type of a resource variable | ||
* in a method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.RESOURCE_VARIABLE = 65; | ||
/** | ||
* The sort of type references that target the type of the exception of a | ||
* 'catch' clause in a method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.EXCEPTION_PARAMETER = 66; | ||
/** | ||
* The sort of type references that target the type declared in an | ||
* 'instanceof' instruction. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.INSTANCEOF = 67; | ||
/** | ||
* The sort of type references that target the type of the object created by | ||
* a 'new' instruction. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.NEW = 68; | ||
/** | ||
* The sort of type references that target the receiver type of a | ||
* constructor reference. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CONSTRUCTOR_REFERENCE = 69; | ||
/** | ||
* The sort of type references that target the receiver type of a method | ||
* reference. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_REFERENCE = 70; | ||
/** | ||
* The sort of type references that target the type declared in an explicit | ||
* or implicit cast instruction. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CAST = 71; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* constructor in a constructor call. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 72; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* method in a method call. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT = 73; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* constructor in a constructor reference. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 74; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* method in a method reference. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT = 75; | ||
return TypeReference; | ||
}()); | ||
} | ||
} | ||
exports.TypeReference = TypeReference; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* class. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CLASS_TYPE_PARAMETER = 0; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_TYPE_PARAMETER = 1; | ||
/** | ||
* The sort of type references that target the super class of a class or one | ||
* of the interfaces it implements. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CLASS_EXTENDS = 16; | ||
/** | ||
* The sort of type references that target a bound of a type parameter of a | ||
* generic class. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CLASS_TYPE_PARAMETER_BOUND = 17; | ||
/** | ||
* The sort of type references that target a bound of a type parameter of a | ||
* generic method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_TYPE_PARAMETER_BOUND = 18; | ||
/** | ||
* The sort of type references that target the type of a field. See | ||
* {@link #getSort getSort}. | ||
*/ | ||
TypeReference.FIELD = 19; | ||
/** | ||
* The sort of type references that target the return type of a method. See | ||
* {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_RETURN = 20; | ||
/** | ||
* The sort of type references that target the receiver type of a method. | ||
* See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_RECEIVER = 21; | ||
/** | ||
* The sort of type references that target the type of a formal parameter of | ||
* a method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_FORMAL_PARAMETER = 22; | ||
/** | ||
* The sort of type references that target the type of an exception declared | ||
* in the throws clause of a method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.THROWS = 23; | ||
/** | ||
* The sort of type references that target the type of a local variable in a | ||
* method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.LOCAL_VARIABLE = 64; | ||
/** | ||
* The sort of type references that target the type of a resource variable | ||
* in a method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.RESOURCE_VARIABLE = 65; | ||
/** | ||
* The sort of type references that target the type of the exception of a | ||
* 'catch' clause in a method. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.EXCEPTION_PARAMETER = 66; | ||
/** | ||
* The sort of type references that target the type declared in an | ||
* 'instanceof' instruction. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.INSTANCEOF = 67; | ||
/** | ||
* The sort of type references that target the type of the object created by | ||
* a 'new' instruction. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.NEW = 68; | ||
/** | ||
* The sort of type references that target the receiver type of a | ||
* constructor reference. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CONSTRUCTOR_REFERENCE = 69; | ||
/** | ||
* The sort of type references that target the receiver type of a method | ||
* reference. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_REFERENCE = 70; | ||
/** | ||
* The sort of type references that target the type declared in an explicit | ||
* or implicit cast instruction. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CAST = 71; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* constructor in a constructor call. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 72; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* method in a method call. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT = 73; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* constructor in a constructor reference. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 74; | ||
/** | ||
* The sort of type references that target a type parameter of a generic | ||
* method in a method reference. See {@link #getSort getSort}. | ||
*/ | ||
TypeReference.METHOD_REFERENCE_TYPE_ARGUMENT = 75; | ||
TypeReference["__class"] = "TypeReference"; |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var asm_1 = require("../src/asm"); | ||
var fs = require("fs"); | ||
var AVisitor = /** @class */ (function (_super) { | ||
__extends(AVisitor, _super); | ||
function AVisitor() { | ||
return _super.call(this, asm_1.Opcodes.ASM5) || this; | ||
const asm_1 = require("../src/asm"); | ||
const fs = require("fs"); | ||
class AVisitor extends asm_1.AnnotationVisitor { | ||
constructor() { | ||
super(asm_1.Opcodes.ASM5); | ||
} | ||
AVisitor.prototype.visit = function (s, o) { | ||
visit(s, o) { | ||
console.log(s + ' ' + o); | ||
}; | ||
return AVisitor; | ||
}(asm_1.AnnotationVisitor)); | ||
var AnnoVisitor = /** @class */ (function (_super) { | ||
__extends(AnnoVisitor, _super); | ||
function AnnoVisitor() { | ||
return _super.call(this, asm_1.Opcodes.ASM5) || this; | ||
} | ||
AnnoVisitor.prototype.visitAnnotation = function (desc, visible) { | ||
} | ||
class AnnoVisitor extends asm_1.ClassVisitor { | ||
constructor() { | ||
super(asm_1.Opcodes.ASM5); | ||
} | ||
visitAnnotation(desc, visible) { | ||
console.log('visit annotation'); | ||
@@ -35,6 +22,5 @@ if (desc == "Lnet/minecraftforge/fml/common/Mod;") | ||
return null; | ||
}; | ||
return AnnoVisitor; | ||
}(asm_1.ClassVisitor)); | ||
fs.readFile('test.class', function (err, buff) { | ||
} | ||
} | ||
fs.readFile('test.class', (err, buff) => { | ||
if (err) { | ||
@@ -45,5 +31,5 @@ console.log(err); | ||
console.log('read into buffer'); | ||
var reader = new asm_1.ClassReader(buff); | ||
let reader = new asm_1.ClassReader(buff); | ||
reader.accept(new AnnoVisitor()); | ||
} | ||
}); |
{ | ||
"name": "java-asm", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "The migration of the Java ASM framework", | ||
@@ -5,0 +5,0 @@ "main": "./build/src/asm.js", |
{ | ||
"compilerOptions": { | ||
/* Basic Options */ | ||
"target": "es5", | ||
"target": "es2018", | ||
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ | ||
@@ -6,0 +6,0 @@ "module": "commonjs", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1145234
28322