use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex.PointerDescriptor in project TrufflePascal by Aspect26.
the class StringBuiltinUnit method importTo.
@Override
public void importTo(UnitLexicalScope scope) {
super.importTo(scope);
try {
scope.registerType("pchar", new PointerDescriptor(PCharDesriptor.getInstance()));
} catch (LexicalException e) {
throw new PascalRuntimeException("Could not import string unit: " + e.getMessage());
}
scope.markAllIdentifiersPublic();
}
use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex.PointerDescriptor in project TrufflePascal by Aspect26.
the class BinaryExpressionNode method verifyBothCompatiblePointerTypes.
protected boolean verifyBothCompatiblePointerTypes(TypeDescriptor leftType, TypeDescriptor rightType) {
if (!(leftType instanceof PointerDescriptor && rightType instanceof PointerDescriptor)) {
return false;
}
TypeDescriptor leftInnerType = ((PointerDescriptor) leftType).getInnerTypeDescriptor();
TypeDescriptor rightInnerType = ((PointerDescriptor) rightType).getInnerTypeDescriptor();
return (leftInnerType == null) || (rightInnerType == null) || (rightInnerType.equals(leftInnerType));
}
use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex.PointerDescriptor in project TrufflePascal by Aspect26.
the class NodeFactory method createReadDereferenceNode.
public ReadDereferenceNode createReadDereferenceNode(ExpressionNode pointerExpression) {
PointerDescriptor pointerDescriptor = null;
TypeDescriptor actualType = this.getActualType(pointerExpression.getType());
if (actualType instanceof PointerDescriptor) {
pointerDescriptor = (PointerDescriptor) actualType;
} else {
parser.SemErr("Can not dereference this type");
}
TypeDescriptor returnType = (pointerDescriptor != null) ? pointerDescriptor.getInnerTypeDescriptor() : null;
return ReadDereferenceNodeGen.create(pointerExpression, returnType);
}
Aggregations