protected override int GetPriority(CiExpr expr) { CiPropertyAccess pa = expr as CiPropertyAccess; if (pa != null) { if (pa.Property == CiLibrary.SByteProperty) { return(GetPriority(pa.Obj)); } if (pa.Property == CiLibrary.LowByteProperty) { return(2); } } else if (expr is CiCoercion) { CiCoercion c = (CiCoercion)expr; if (c.ResultType == CiByteType.Value && c.Inner.Type == CiIntType.Value) { return(2); } if (c.ResultType == CiIntType.Value && c.Inner.Type == CiByteType.Value) { return(8); } } return(base.GetPriority(expr)); }
protected override void Write(CiPropertyAccess expr) { if (expr.Property == CiLibrary.SByteProperty) { Write(expr.Obj); } else if (expr.Property == CiLibrary.LowByteProperty) { Write("(byte) "); WriteChild(expr, expr.Obj); } else if (expr.Property == CiLibrary.StringLengthProperty) { WriteChild(expr, expr.Obj); Write(".length()"); } else { throw new ArgumentException(expr.Property.Name); } }
protected override void Write(CiPropertyAccess expr) { if (expr.Property == CiLibrary.SByteProperty) { Write('('); WriteChild(9, expr.Obj); Write(" ^ 128) - 128"); } else if (expr.Property == CiLibrary.LowByteProperty) { WriteChild(expr, expr.Obj); Write(" & 0xff"); } else if (expr.Property == CiLibrary.StringLengthProperty) { Write("length("); Write(expr.Obj); Write(')'); } else { throw new ArgumentException(expr.Property.Name); } }
protected override void Write(CiPropertyAccess expr) { if (expr.Property == CiLibrary.SByteProperty) Write(expr.Obj); else if (expr.Property == CiLibrary.LowByteProperty) { Write("(byte) "); WriteChild(expr, expr.Obj); } else if (expr.Property == CiLibrary.StringLengthProperty) { WriteChild(expr, expr.Obj); Write(".length()"); } else throw new ArgumentException(expr.Property.Name); }
protected override void Write(CiPropertyAccess expr) { if (expr.Property == CiLibrary.SByteProperty) { Write('('); WriteChild(CiPriority.Xor, expr.Obj); Write(" ^ 128) - 128"); } else if (expr.Property == CiLibrary.LowByteProperty) { WriteChild(expr, expr.Obj); Write(" & 0xff"); } else if (expr.Property == CiLibrary.StringLengthProperty) { WriteChild(expr, expr.Obj); Write(".length"); } else throw new ArgumentException(expr.Property.Name); }
protected abstract void Write(CiPropertyAccess expr);
protected override void Write(CiPropertyAccess expr) { if (expr.Property == CiLibrary.SByteProperty) { Write("(signed char) "); WriteChild(expr, expr.Obj); } else if (expr.Property == CiLibrary.LowByteProperty) { Write("(unsigned char) "); WriteChild(expr, expr.Obj); } else if (expr.Property == CiLibrary.StringLengthProperty) { Write("(int) strlen("); WriteChild(expr, expr.Obj); Write(')'); } else throw new ArgumentException(expr.Property.Name); }