public override int GetSize(CompilerContext c) { c.Report.Error(2070, "'void': illegal sizeof operand"); return(0); }
bool HasRankGreaterThan(CBasicType otherBasicType, CompilerContext context) { return(false); }
public override int GetSize(CompilerContext c) { return(c.MachineInfo.PointerSize); }
/// <summary> /// Section 6.3.1.8 (page 53) of N1570 /// </summary> /// <returns> /// The converted type. /// </returns> /// <param name='otherType'> /// The other type participating in the arithmetic. /// </param> /// <param name='context'> /// Context. /// </param> public CBasicType ArithmeticConvert(CType otherType, CompilerContext context) { var otherBasicType = otherType as CBasicType; if (otherBasicType == null) { context.Report.Error(19, "Cannot perform arithmetic with " + otherType); return(CBasicType.SignedInt); } if (Name == "double" || otherBasicType.Name == "double") { return(Double); } else if (Name == "single" || otherBasicType.Name == "single") { return(Float); } else { var p1 = IntegerPromote(context); var size1 = p1.GetSize(context); var p2 = otherBasicType.IntegerPromote(context); var size2 = p2.GetSize(context); if (p1.Signedness == p2.Signedness) { return(size1 >= size2 ? p1 : p2); } else { if (p1.Signedness == Signedness.Unsigned) { if (size1 > size2) //p1.HasRankGreaterThan (p2, context)) { { return(p1); } else { if (size2 > size1) { return(p2); } else { return(new CBasicType(p2.Name, Signedness.Unsigned, p2.Size)); } } } else { if (size2 > size1) //p2.HasRankGreaterThan (p1, context)) { { return(p2); } else { if (size1 > size2) { return(p1); } else { return(new CBasicType(p1.Name, Signedness.Unsigned, p1.Size)); } } } } } }
public abstract int GetSize(CompilerContext c);
public Compiler(CompilerContext context) { this.context = context; tus = new List <TranslationUnit> (); }
public FunctionContext(Executable exe, FunctionDeclaration fdecl, CompiledFunction fexe, CompilerContext context) : base(context.MachineInfo, context.Report, fdecl) { this.exe = exe; this.fdecl = fdecl; this.fexe = fexe; this.context = context; blocks = new List <Block> (); blockLocals = new Dictionary <Block, BlockLocals> (); allLocals = new List <VariableDeclaration> (); }
public ResolveContext(CompilerContext c) { Compiler = c; }