|
@@ -271,6 +271,11 @@ exports.Identdef = ChainedContext.extend({
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+function castCode(type, context){
|
|
|
|
+ var baseType = type instanceof Type.Pointer ? Type.pointerBase(type) : type;
|
|
|
|
+ return context.qualifyScope(Type.recordScope(baseType)) + Type.recordConstructor(baseType);
|
|
|
|
+}
|
|
|
|
+
|
|
exports.Designator = ChainedContext.extend({
|
|
exports.Designator = ChainedContext.extend({
|
|
init: function Context$Designator(context){
|
|
init: function Context$Designator(context){
|
|
ChainedContext.prototype.init.call(this, context);
|
|
ChainedContext.prototype.init.call(this, context);
|
|
@@ -383,9 +388,7 @@ exports.Designator = ChainedContext.extend({
|
|
|
|
|
|
checkTypeCast(this.__currentType, type, "invalid type cast");
|
|
checkTypeCast(this.__currentType, type, "invalid type cast");
|
|
|
|
|
|
- var baseType = type instanceof Type.Pointer ? Type.pointerBase(type) : type;
|
|
|
|
- var castName = this.qualifyScope(Type.recordScope(baseType)) + Type.recordConstructor(baseType);
|
|
|
|
- var code = this.rtl().typeGuard(this.__code, castName);
|
|
|
|
|
|
+ var code = this.rtl().typeGuard(this.__code, castCode(type, this));
|
|
this.__code = code;
|
|
this.__code = code;
|
|
|
|
|
|
this.__currentType = type;
|
|
this.__currentType = type;
|
|
@@ -1143,7 +1146,7 @@ exports.Expression = ChainedContext.extend({
|
|
|
|
|
|
checkTypeCast(leftType, rightType, "invalid type test");
|
|
checkTypeCast(leftType, rightType, "invalid type test");
|
|
|
|
|
|
- code = leftCode + " instanceof " + rightCode;
|
|
|
|
|
|
+ code = leftCode + " instanceof " + castCode(rightType, this);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
leftExpression = promoteTypeInExpression(leftExpression, rightType);
|
|
leftExpression = promoteTypeInExpression(leftExpression, rightType);
|