public override bool Equals(BType p) { if ((object)p == null) { return(false); } return(this.GetType() == p.GetType() && (p as BTypeStack).StackSize == StackSize); }
public virtual bool Equals(BType p) { if ((object)p == null) { return(false); } return(GetType() == p.GetType()); }
public override bool Equals(BType p) { if ((object)p == null) { return(false); } return(this.GetType() == p.GetType() && (p as BTypeArray).ArraySize == ArraySize); }
public Method(SourceCodePosition pos, BType t, string id, List <VarDeclaration> p, List <VarDeclaration> v, StatementStatementList b) : base(pos) { this.ResultType = t; this.Identifier = id; this.Parameter = p; this.Variables = v; this.Body = b; Variables.AddRange(Parameter); }
public MethodHeader(SourceCodePosition pos, BType t, string ident, List <VarDeclaration> p) : base(pos) { this.ResultType = t; this.Identifier = ident; this.Parameter = p; if (ASTObject.IsKeyword(ident)) { throw new IllegalIdentifierException(Position, ident); } }
private static VarDeclaration CreateAstDeclarationFromValues(BType type, string ident, Literal initArr, SourceCodePosition p) { if (initArr != null) { if (type is BTypeArray) { return(new VarDeclarationArray(p, (BTypeArray)type, ident, (LiteralArray)initArr)); } else if (type is BTypeValue) { return(new VarDeclarationValue(p, (BTypeValue)type, ident, (LiteralValue)initArr)); } else if (type is BTypeStack) { if (initArr != null) { throw new CannotInitStackException(p); } return(new VarDeclarationStack(p, (BTypeStack)type, ident)); } else { return(null); } } else { if (type is BTypeArray) { return(new VarDeclarationArray(p, (BTypeArray)type, ident)); } else if (type is BTypeValue) { return(new VarDeclarationValue(p, (BTypeValue)type, ident)); } else if (type is BTypeStack) { return(new VarDeclarationStack(p, (BTypeStack)type, ident)); } else { return(null); } } }
public VarDeclaration(SourceCodePosition pos, BType t, string ident, Literal init) : base(pos) { this.Type = t; this.Identifier = ident; this.ID = V_ID_COUNTER; this.IsConstant = false; if (ASTObject.IsKeyword(ident)) { throw new IllegalIdentifierException(Position, ident); } if (init == null) { this.Initial = t.GetDefaultValue(); HasCompleteUserDefiniedInitialValue = false; } else { this.Initial = init; HasCompleteUserDefiniedInitialValue = true; } }
public override bool IsImplicitCastableTo(BType other) { return(other is BTypeStack && (other as BTypeStack).StackSize == StackSize && (other is BTypeBoolStack)); }
public override bool IsImplicitCastableTo(BType other) { return(other is BTypeArray && (other as BTypeArray).ArraySize == ArraySize && (other is BTypeBoolArr)); }
public abstract bool IsImplicitCastableTo(BType other);
public override bool IsImplicitCastableTo(BType other) { return(other is BTypeBool); }
public override bool IsImplicitCastableTo(BType other) { return(other is BTypeDigit || other is BTypeInt); }
public override bool IsImplicitCastableTo(BType other) { return(true); }