public ASTCILTypeNode(CoolType type, IEnumerable <CoolMethod> virtualTable, IEnumerable <ASTCILFuncNode> methods) : base() { Type = type; Methods = methods.ToImmutableList(); VirtualTable = virtualTable.ToImmutableList(); }
internal void EnsureReturnType(CoolType type) { if (Correct) { Type = type; } }
public void CheckSemantic(CaseNode node, IScope scope = null) { CheckSemantic(node.Expression, scope); IType type = null; foreach (var caseOptionNode in node.CaseOptionNodes) { CheckSemantic(caseOptionNode, scope); type = type is null ? caseOptionNode.ComputedType : CoolType.Lca((CoolType)type, (CoolType)caseOptionNode.ComputedType); } node.ComputedType = type; }
public void CheckSemantic(IfNode node, IScope scope = null) { CheckSemantic(node.Condition, scope); if (node.Condition.ComputedType.Name != "Bool") { Logger.LogError(node.Line, node.CharPositionInLine, $"Cannot implicitly convert type '{node.Condition.ComputedType}' to 'Bool'"); } CheckSemantic(node.ThenExpression, scope); if (node.ElseExpression == null) { node.ComputedType = node.ThenExpression.ComputedType; } else { CheckSemantic(node.ElseExpression, scope); node.ComputedType = CoolType.Lca((CoolType)node.ThenExpression.ComputedType, (CoolType)node.ElseExpression.ComputedType); } }
public ASTCILFuncNode(string Tag, CoolMethod method, IEnumerable <ASTCILExpressionNode> body, bool boxing, CoolType boxingType) : this(Tag, method, body) { this.Boxing = boxing; this.BoxingType = boxingType; }
public ASTCILBoxingNode(ASTCILExpressionNode expression, CoolType type) : base() { this.Expression = expression; this.Type = type; }
public ASTCILFuncStaticCallNode(string methodName, CoolType type, IEnumerable <ASTCILExpressionNode> arguments) : base() { this.Type = type; MethodName = methodName; Arguments = arguments.ToList(); }
public ASTCILFuncVirtualCallNode(CoolType type, string methodName, IEnumerable <ASTCILExpressionNode> arguments) : base() { MethodName = methodName; Arguments = arguments.ToList(); Type = type; }
public ASTCILAllocateNode(CoolType type) : base( ) { this.Type = type; }