public override void Dump(SourceBuilder builder) { // first dump check if (Type == CheckMaximumMatchesType.Action) { builder.AppendFront("CheckContinueMatching MaximumMatchesReached at Action level "); } else if (Type == CheckMaximumMatchesType.Subpattern) { builder.AppendFront("CheckContinueMatching MaximumMatchesReached at Subpattern level "); } else if (Type == CheckMaximumMatchesType.Iterated) { builder.AppendFront("CheckContinueMatching MaximumMatchesReached if Iterated "); } if (ListHeadAdjustment) { builder.Append("ListHeadAdjustment "); } if (InParallelizedBody) { builder.Append("InParallelizedBody "); } builder.Append("\n"); // then operations for case check failed if (CheckFailedOperations != null) { builder.Indent(); CheckFailedOperations.Dump(builder); builder.Unindent(); } }
public static void Load(this IMethodModel @this, ICodeTextWriter writer, SourceBuilder builder, IMethodSymbol method, ScopeInfo scope, IEnumerable <IMemberInfo> references) { var methodScope = new ScopeInfo(scope); if (method.IsGenericMethod) { methodScope.CreateAliases(method.TypeArguments); } (bool isAsync, bool methodReturnsValue) = SemanticFacts.IsAsyncAndGetReturnType(writer.Compilation, method); bool canUseAsync = true; { SourceBuilder builder2 = builder.AppendNewBuilder(false); writer.WriteIdentifier(builder2, method); if (method.IsGenericMethod) { builder2.Append('<'); writer.WriteTypeArgumentsCall(builder2, method.TypeArguments, methodScope); builder2.Append('>'); } @this.Name = builder2.ToString(); } { SourceBuilder builder2 = builder.AppendNewBuilder(false); writer.WriteTypeReference(builder2, method.ReturnType, methodScope); @this.ReturnType = builder2.ToString(); } { SourceBuilder builder2 = builder.AppendNewBuilder(false); writer.WriteParameterDefinition(builder2, methodScope, method.Parameters); @this.ArgumentsDefinition = builder2.ToString(); } { SourceBuilder builder2 = builder.AppendNewBuilder(false); writer.WriteCallParameters(builder2, method.Parameters); @this.CallArguments = builder2.ToString(); } @this.IsAsync = isAsync && canUseAsync; @this.ReturnExpected = (isAsync && methodReturnsValue == false) ? canUseAsync == false : methodReturnsValue; foreach (IMemberInfo reference in references) { SourceBuilder builder2 = builder.AppendNewBuilder(false); if (isAsync && canUseAsync) { writer.WriteMethodCall(builder2, reference, method, methodScope, false, false, false); } else { writer.WriteMethodCall(builder2, reference, method, methodScope, false, SemanticFacts.IsNullable(writer.Compilation, method.ReturnType), reference.PreferCoalesce); } @this.Expressions.Add(builder2.ToString()); } }
public override void Dump(SourceBuilder builder) { builder.AppendFront("FinalizeNegativeIndependentMatching "); if (Parallel) { builder.AppendFront("Parallel "); } builder.Append("\n"); }
public override void Dump(SourceBuilder builder) { builder.AppendFront("AcceptCandidate "); builder.AppendFormat("on {0} negNamePrefix:{1} node:{2}", PatternElementName, NegativeIndependentNamePrefix, IsNode); builder.AppendFormat("parallel:{0} all:{1} ", Parallel, LockForAllThreads); builder.Append("\n"); }
public override void Dump(SourceBuilder builder) { // first dump check builder.AppendFront("CheckContinueMatching OfIndependentFailed "); builder.Append(IsIterationBreaking ? "IterationBreaking\n" : "\n"); // then operations for case check failed if (CheckFailedOperations != null) { builder.Indent(); CheckFailedOperations.Dump(builder); builder.Unindent(); } }
public override void Dump(SourceBuilder builder) { builder.AppendFront("InitializeNegativeIndependentMatching "); if (SetupSubpatternMatching) { builder.AppendFront("SetupSubpatternMatching "); } if (Parallel) { builder.AppendFront("Parallel "); } builder.Append("\n"); }
public override void Dump(SourceBuilder builder) { // first dump local content builder.AppendFront("GetType ByIteration "); if (Type == GetTypeByIterationType.ExplicitelyGiven) { builder.Append("ExplicitelyGiven "); builder.AppendFormat("on {0} in {1} node:{2}\n", PatternElementName, TypeName, IsNode); } else // Type==GetTypeByIterationType.AllCompatible { builder.Append("AllCompatible "); builder.AppendFormat("on {0} in {1} node:{2}\n", PatternElementName, RulePatternTypeName, IsNode); } // then nested content if (NestedOperationsList != null) { builder.Indent(); NestedOperationsList.Dump(builder); builder.Unindent(); } }
public static void Load(this IEventModel @this, ICodeTextWriter writer, SourceBuilder builder, IEventSymbol @event, ScopeInfo scope, IEnumerable <IMemberInfo> references) { { SourceBuilder builder2 = builder.AppendNewBuilder(false); writer.WriteIdentifier(builder2, @event); @this.Name = builder2.ToString(); } { SourceBuilder builder2 = builder.AppendNewBuilder(false); writer.WriteTypeReference(builder2, @event.Type, scope); @this.Type = builder2.ToString(); } foreach (IMemberInfo reference in references) { SourceBuilder builder2 = builder.AppendNewBuilder(false); writer.WriteMemberReference(builder2, reference, scope, false, false); builder2.Append('.'); writer.WriteIdentifier(builder2, @event); @this.Expressions.Add(builder2.ToString()); } }
public override void Emit(SourceBuilder sourceCode) { if (sourceCode.CommentSourceCode) { sourceCode.AppendFront("// Check whether the iterated pattern null match was found\n"); } sourceCode.Append("maxMatchesIterReached:\n"); if (IsIterationBreaking) { sourceCode.AppendFront("if(!patternFound && numMatchesIter>=minMatchesIter && !breakIteration)\n"); } else { sourceCode.AppendFront("if(!patternFound && numMatchesIter>=minMatchesIter)\n"); } sourceCode.AppendFront("{\n"); sourceCode.Indent(); CheckFailedOperations.Emit(sourceCode); sourceCode.Unindent(); sourceCode.AppendFront("}\n"); }
public override void Dump(SourceBuilder builder) { builder.AppendFront("PatternAndSubpatternsMatched "); if (InParallelizedBody) { builder.Append("InParallelizedBody "); } switch (Type) { case PatternAndSubpatternsMatchedType.Action: builder.Append("Action \n"); break; case PatternAndSubpatternsMatchedType.Iterated: builder.Append("Iterated \n"); break; case PatternAndSubpatternsMatchedType.IteratedNullMatch: builder.Append("IteratedNullMatch \n"); break; case PatternAndSubpatternsMatchedType.SubpatternOrAlternative: builder.Append("SubpatternOrAlternative \n"); break; default: builder.Append("INTERNAL ERROR\n"); break; } if (MatchBuildingOperations != null) { builder.Indent(); MatchBuildingOperations.Dump(builder); builder.Unindent(); } }
public override void Dump(SourceBuilder builder) { builder.AppendFront("IndependentPatternMatched "); builder.Append(Type == NegativeIndependentPatternMatchedType.WithoutSubpatterns ? "WithoutSubpatterns\n" : "ContainingSubpatterns\n"); }
public void WriteTypeReference(SourceBuilder builder, ITypeSymbol type, ScopeInfo scope) { if (scope.TryGetAlias(type, out string?typeName)) { if (typeName != null) { builder.Append(typeName); } } else { bool processed = false; if (type.SpecialType != SpecialType.None) { processed = true; switch (type.SpecialType) { default: processed = false; break; case SpecialType.System_Object: builder.Append("object"); break; case SpecialType.System_Void: builder.Append("void"); break; case SpecialType.System_Boolean: builder.Append("bool"); break; case SpecialType.System_Char: builder.Append("char"); break; case SpecialType.System_SByte: builder.Append("sbyte"); break; case SpecialType.System_Byte: builder.Append("byte"); break; case SpecialType.System_Int16: builder.Append("short"); break; case SpecialType.System_UInt16: builder.Append("ushort"); break; case SpecialType.System_Int32: builder.Append("int"); break; case SpecialType.System_UInt32: builder.Append("uint"); break; case SpecialType.System_Int64: builder.Append("long"); break; case SpecialType.System_UInt64: builder.Append("ulong"); break; case SpecialType.System_Decimal: builder.Append("decimal"); break; case SpecialType.System_Single: builder.Append("float"); break; case SpecialType.System_Double: builder.Append("double"); break; //case SpecialType.System_Half: builder.Append("half"); break; case SpecialType.System_String: builder.Append("string"); break; } } if (processed == false) { if (type is IArrayTypeSymbol array) { this.WriteTypeReference(builder, array.ElementType, scope); builder.Append('['); for (int i = 1; i < array.Rank; i++) { builder.Append(','); } builder.Append(']'); } else {