internal override void CheckSemantic(CompileMessageManager cmm) { if (Exp == null) { cmm.CompileError("require-expression", this); } }
internal override void CheckSemantic(CompileMessageManager cmm) { if (CallRoutine is ErrorRoutineSymbol && !TypeSymbol.HasAnyErrorType(Exp.ReturnType)) { cmm.CompileError("undefined-monadic-operator", this); } }
internal override void CheckSemantic(CompileMessageManager cmm) { if (CallRoutine is ErrorRoutineSymbol && !TypeSymbol.HasAnyErrorType(Left.ReturnType, Right.ReturnType)) { cmm.CompileError("impossible-calculate", this); } }
internal override void CheckSemantic(CompileMessageManager cmm) { if (CallRoutine is ErrorRoutineSymbol) { cmm.CompileError("undefined-monadic-operator", this); } }
internal override void CheckSemantic(CompileMessageManager cmm) { foreach (var v in Values) { if (BaseType != v.ReturnType) { cmm.CompileError("disagree-array-type", this); } } }
public static string Build(CompileMessageManager manager) { var builder = new StringBuilder(); foreach(var v in manager) { builder.AppendLine(Build(v)); } builder.Append(manager); return builder.ToString(); }
internal override void CheckSemantic(CompileMessageManager cmm) { foreach (Element v in this) { if (v == null) { cmm.CompileError("require-expression", this); continue; } } }
internal override void CheckSemantic(CompileMessageManager cmm) { if(Right != null && Right is RightPipeline) { cmm.CompileError("not-collide-assign", this); } if (Left != null && Left is RightPipeline) { cmm.CompileError("not-collide-assign", this); } base.CheckSemantic(cmm); }
internal override void CheckSemantic(CompileMessageManager cmm) { foreach (Token v in ErrorToken) { if (v.TokenType == TokenType.OtherString) { cmm.CompileError("invalid-token", v); } else { cmm.CompileError("error-token", v); } } }
public Root() { Name = "global"; EmbedList = new NameSpaceSymbol(); MessageManager = new CompileMessageManager(); SimplexManager = new OverLoadSimplexManager(); ClassManager = new ClassTemplateInstanceManager(); RoutineManager = new RoutineTemplateInstanceManager(); ConvManager = new ConversionManager(this); OpManager = new OperationManager(this); UndefinedOverLord = new OverLoadChain(this, null); AppendChild(EmbedList); AppendChild(ClassManager); AppendChild(RoutineManager); CreateEmbedIdentifier(); }
private BigInteger Parse(string text, CompileMessageManager cmm = null) { int count, b; return Parse(text, out count, out b, cmm); }
internal override void CheckSemantic(CompileMessageManager cmm) { if(IsConnectPipeline) { return; } switch (Match.Result) { case CallMatchResult.NotCallable: cmm.CompileError("not-callable", this); break; case CallMatchResult.UnmatchArgumentCount: cmm.CompileError("unmatch-overload-count", this); break; case CallMatchResult.UnmatchArgumentType: cmm.CompileError("unmatch-overload-type", this); break; case CallMatchResult.UnmatchGenericCount: cmm.CompileError("unmatch-generic-count", this); break; case CallMatchResult.UnmatchGenericType: cmm.CompileError("unmatch-generic-type", this); break; case CallMatchResult.AmbiguityMatch: cmm.CompileError("ambiguity-match", this); break; } if (IsImmutableCall && !IsConstructorLocation && !(Access is VariantDeclaration)) { cmm.CompileError("not-mutable", this); } //todo 副作用のある関数を呼べないようにする。 if (IsFunctionLocation && CallRoutine is PropertySymbol) { cmm.CompileError("forbit-side-effect", this); } if (IsCalculate && CalculateCallScope is ErrorRoutineSymbol) { cmm.CompileError("impossible-calculate", this); } }
internal override void CheckSemantic(CompileMessageManager cmm) { if(CallReturnType is GenericSymbol) { return; } if (Block.IsInline) { var ret = Block[0]; if (CallReturnType != ret.ReturnType) { cmm.CompileError("disagree-return-type", this); } } else { var ret = Block.FindElements<ReturnStatement>(); foreach (var v in ret) { if (CallReturnType != v.Exp.ReturnType) { cmm.CompileError("disagree-return-type", this); } } } }
internal override void CheckSemantic(CompileMessageManager cmm) { foreach (var v in InheritAccess) { var dt = v.OverLoad.FindDataType(); if (!(dt.Type is ClassSymbol)) { cmm.CompileError("not-datatype-inherit", this); } } foreach(var v in Block) { if(!v.IsConstant) { cmm.CompileError("not-constant-expression", v); } } }
internal override void CheckSemantic(CompileMessageManager cmm) { if (ReturnType is UnknownSymbol) { cmm.CompileError("require-type", this); } }
internal override void CheckSemantic(CompileMessageManager cmm) { Parse(Integral, cmm); if (string.IsNullOrEmpty(Fraction)) { Parse(Fraction, cmm); } }
internal override void CheckSemantic(CompileMessageManager cmm) { }
internal override void CheckSemantic(CompileMessageManager cmm) { if (OverLoad.IsUndefined) { cmm.CompileError("undefined-identifier", this); return; } if (AccessSymbol.IsStaticMember && !ContainClass(AccessSymbol.GetParent<ClassSymbol>(), Access.ReturnType)) { cmm.CompileError("undefined-identifier", this); return; } if (IsConnectCalls || !IsExecutionLocation) { return; } //todo より適切なエラーメッセージを出す。 switch (Match.Result) { case CallMatchResult.NotCallable: cmm.CompileError("not-callable", this); break; case CallMatchResult.UnmatchArgumentCount: cmm.CompileError("unmatch-overload-count", this); break; case CallMatchResult.UnmatchArgumentType: cmm.CompileError("unmatch-overload-type", this); break; case CallMatchResult.UnmatchGenericCount: cmm.CompileError("unmatch-generic-count", this); break; case CallMatchResult.UnmatchGenericType: cmm.CompileError("unmatch-generic-type", this); break; case CallMatchResult.AmbiguityMatch: cmm.CompileError("ambiguity-match", this); break; } if (AccessSymbol.Attribute.HasAnyAttribute(AttributeType.Private) && !HasCurrentAccess(AccessSymbol.GetParent<ClassSymbol>())) { cmm.CompileError("not-accessable", this); } if (AccessSymbol.Attribute.HasAnyAttribute(AttributeType.Protected) && !HasCurrentAccess(AccessSymbol.GetParent<ClassSymbol>())) { cmm.CompileError("not-accessable", this); } if (AccessSymbol.IsInstanceMember && ModifyTypeSymbol.HasContainModify(Access.ReturnType, ModifyType.Typeof)) { cmm.CompileError("not-accessable", this); } if (AccessSymbol.IsStaticMember && !ModifyTypeSymbol.HasContainModify(Access.ReturnType, ModifyType.Typeof)) { cmm.CompileError("not-accessable", this); } }
private BigInteger Parse(string text, out int count, out int b, CompileMessageManager cmm = null) { b = CheckPrefix(ref text); count = 0; BigInteger number = 0; foreach (char v in text) { if (v == '_') { continue; } checked { number *= b; int temp = ToNum(v); if (temp >= b) { if (cmm != null) { cmm.CompileError("number-parse-error", this); } return 0; } number += temp; count++; } } return number; }