C#: Improved CIL instruction types to pass type consistency checks

This commit is contained in:
Calum Grant 2019-11-13 20:11:08 +00:00
Родитель 4f9b747a13
Коммит e752e45361
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -167,7 +167,11 @@ module Opcodes {
class Neg extends UnaryExpr, @cil_neg {
override string getOpcodeName() { result = "neg" }
override NumericType getType() { result = getOperand(0).getType() }
override NumericType getType() {
result = getOperand().getType()
or
getOperand().getType() instanceof Enum and result instanceof IntType
}
}
// Binary operations
@ -1176,7 +1180,9 @@ module Opcodes {
class Localloc extends Expr, @cil_localloc {
override string getOpcodeName() { result = "localloc" }
override int getPopCount() { result = 1 } // ??
override int getPopCount() { result = 1 }
override PointerType getType() { result.getReferentType() instanceof ByteType }
}
class Readonly extends Instruction, @cil_readonly {