public override void CheckSemantics(Scope scope, List <SemanticError> errors) { //-------------------------------------------------- // Hacer 'CheckSemantics' A Los Hijos. //-------------------------------------------------- this.Size.CheckSemantics(scope, errors); this.Value.CheckSemantics(scope, errors); //-------------------------------------------------- // Poner El Valor De Retorno De La Expresión A 'Error' // Por Default. //-------------------------------------------------- this.ExpressionType = PredefinedTypes.ErrorType; //-------------------------------------------------- // Si Ha Ocurrido Un Error En Alguno De Los Hijos, // Parar De Reportar Errores. //-------------------------------------------------- if (this.Size.ExpressionType == PredefinedTypes.ErrorType || this.Value.ExpressionType == PredefinedTypes.ErrorType) { return; } //-------------------------------------------------- // Buscar Por El Tipo Del Array //-------------------------------------------------- var TI = scope.FindTypeInfo(this.TypeID.Name); //-------------------------------------------------- // Si El Tipo No Está Definido, Reportar Error. //-------------------------------------------------- if (TI == null) { errors.Add(SemanticError.TypeDoesNotExist(this.TypeID.Name, this.TypeID)); return; } var ArrayType = TI.TypeNode as ArrayTypeNode; //-------------------------------------------------- // Si El Tipo No Es Un Array. //-------------------------------------------------- if (ArrayType == null) { errors.Add(SemanticError.ArrayTypeExpected(TI.TypeNode, this.TypeID)); return; } //-------------------------------------------------- // 'Size' Debe Ser De Tipo <int>. //-------------------------------------------------- if (this.Size.ExpressionType != PredefinedTypes.IntType) { errors.Add(SemanticError.ExpectedType(PredefinedTypes.IntType, this.Size.ExpressionType, this.Size)); return; } //-------------------------------------------------- // 'Value' Debe Ser Del Mismo Tipo Que El Array. //-------------------------------------------------- if (!SemanticError.CompatibleTypes(ArrayType.ArrayOf, this.Value.ExpressionType)) { errors.Add(SemanticError.ExpectedType(ArrayType.ArrayOf, this.Value.ExpressionType, this.Value)); return; } this.ExpressionType = ArrayType; }