public override void VisitLabelStatement(ILabelStatement labelStatement)
 {
     Value = new Statement()
     {
         LabelStatement = new LabelStatementFactory(labelStatement).Value
     };
 }
示例#2
0
 private string GetFormat(string name, ILabelStatement label, bool declarePoint)
 {
     if (this.options != null &&
         this.options.Formatter != null)
     {
         name = this.options.Formatter.FormatLabelToken(name, label, this.Options, declarePoint);
     }
     return(name);
 }
 public override bool Visit(ILabelStatement statement, IStatement context)
 {
     _stack.Push(statement);
     try
     {
         return(base.Visit(statement, context));
     }
     finally
     {
         _stack.Pop();
     }
 }
示例#4
0
 public bool TryGetValue(string key, out ILabelStatement value)
 {
     foreach (var label in this.GetLabels())
     {
         if (label.Name == key)
         {
             value = label;
             return(true);
         }
     }
     value = null;
     return(false);
 }
        public override void VisitLabelStatement(ILabelStatement operation)
        {
            LogString(nameof(ILabelStatement));

            // TODO: Put a better workaround to skip compiler generated labels.
            if (!operation.Label.IsImplicitlyDeclared)
            {
                LogString($" (Label: {operation.Label.Name})");
            }

            LogCommonPropertiesAndNewLine(operation);

            base.VisitLabelStatement(operation);
        }
示例#6
0
        public virtual void TranslateConceptIdentifier(string identifierBase, ILabelStatement label, bool declarePoint)
        {
            string name = null;

            if (options.NameHandler.HandlesName(identifierBase))
            {
                name = options.NameHandler.HandleName(identifierBase);
            }
            else
            {
                name = identifierBase;
            }
            if (this.IsKeyword(name))
            {
                name = EscapeIdentifier(name);
            }
            name = this.GetFormat(name, label, declarePoint);
            this.Write(name, TranslatorFormatterTokenType.Preformatted);
        }
示例#7
0
            public string FormatLabelToken(string labelName, ILabelStatement label, IIntermediateCodeTranslatorOptions options, bool declarePoint)
            {
                var         parentTarget = label.SourceBlock;
                Stack <int> indices      = new Stack <int>();

                indices.Push(parentTarget.IndexOf(label));
                while (parentTarget.Parent is IStatementBlock)
                {
                    var oldTarget = parentTarget;
                    parentTarget = (IStatementBlock)parentTarget.Parent;
                    indices.Push(parentTarget.IndexOf((IStatement)oldTarget));
                }
                var    parentMember = parentTarget.Parent as IMember;
                string uniqueIdentifier;
                string result     = labelName;
                var    activeType = options.BuildTrail.FirstOrDefault(p => p is IDeclaredType) as IDeclaredType;

                if (parentMember == null)
                {
                    uniqueIdentifier = label.Name;
                }
                else
                {
                    uniqueIdentifier = string.Format("{0}::{{{1}}}", parentMember.GetUniqueIdentifier(), string.Join("}.{", (from i in indices
                                                                                                                             select i.ToString()).ToArray()));
                }
                if (declarePoint)
                {
                    result = string.Format("<a name=\"{0}\"></a>{1}", uniqueIdentifier, result);
                }
                string titleText = string.Format("(label) {0}", labelName);

                result = FormatMemberNameToken(result, TranslatorFormatterMemberType.Label);
                if (!declarePoint)
                {
                    result = string.Format("<a style=\"text-decoration:none;\" {3}href=\"{0}#{1}\">{2}</a>", options.GetFileNameOf(activeType), uniqueIdentifier, result, string.IsNullOrEmpty(titleText) ? string.Empty : string.Format("title=\"{0}\" ", titleText));
                }
                return(result);
            }
示例#8
0
 public string FormatLabelToken(string labelName, ILabelStatement label, IIntermediateCodeTranslatorOptions options, bool declarePoint)
 {
     return(labelName);
 }
示例#9
0
 TransformationImpact IStatementVisitor <TransformationImpact> .Visit(ILabelStatement statement)
 {
     return(CalculateRefactorImpact(statement));
 }
示例#10
0
 public abstract void TranslateStatement(ILabelStatement labelStatement);
示例#11
0
 public TestLinkerResult Visit(ILabelStatement statement, ICompilationContext context)
 {
     throw new NotImplementedException();
 }
示例#12
0
 public virtual void VisitLabelStatement(ILabelStatement operation)
 {
     DefaultVisit(operation);
 }
示例#13
0
 public static ILabelStatement Update(this ILabelStatement self, ILabelSymbol @label, IOperation @body) => self;
示例#14
0
 public abstract IStatement Transform(ILabelStatement statement);
 /// <inheritdoc />
 public override IOperation VisitLabelStatement(ILabelStatement operation, object argument)
 {
     return(base.VisitLabelStatement(operation, argument));
 }
示例#16
0
 public bool Visit(ILabelStatement statement, TContext context)
 {
     return(false);
 }
示例#17
0
 public void Add(ILabelStatement label)
 {
     SnapNodes.Add(new SnapNode(label));
 }
示例#18
0
 public override void TranslateStatement(ILabelStatement labelStatement)
 {
     this.Provider.GenerateCodeFromStatement(labelStatement.GenerateCodeDom(this.Options), base.Target, this.Options.Options);
 }
示例#19
0
        public override void VisitLabelStatement(ILabelStatement operation)
        {
            var label = operation.Label;

            base.VisitLabelStatement(operation);
        }
示例#20
0
 /// <summary><para>Creates a C&#9839; compiler warning, relative to the abstract model, (level 2) &#35;164:</para><para>This label has not been referenced</para></summary>
 /// <param name="unreferencedLabel">The <see cref="ILabelStatement"/> which was not referenced
 /// within the defining method body.</param>
 public static ICompilerSourceModelWarning <ILabelStatement> WarningCS0164(ILabelStatement unreferencedLabel)
 {
     return(new CompilerSourceModelWarning <ILabelStatement>(CS0164, unreferencedLabel, null, LineColumnPair.Zero, LineColumnPair.Zero));
 }
 public override void VisitLabelStatement([NotNull] ILabelStatement operation)
 {
     IncrementStatementCount(operation);
     base.VisitLabelStatement(operation);
 }
示例#22
0
 void IStatementVisitor.Visit(ILabelStatement statement)
 {
     this.Translate(statement);
 }
示例#23
0
 public override void VisitLabelStatement(ILabelStatement operation)
 {
 }
示例#24
0
 public static ILabelStatement Update(this ILabelStatement self, ILabelSymbol @label) => self;
 public virtual void VisitLabelStatement(ILabelStatement labelStatement)
 {
     Visit(labelStatement);
 }
示例#26
0
 public override void VisitLabelStatement(ILabelStatement operation)
 {
     Visit(operation.LabeledStatement);
 }
 public override bool Visit(ILabelStatement statement, IStatement context)
 {
     return(true);
 }
示例#28
0
 public virtual void VisitLabelStatement(ILabelStatement operation)
 {
     DefaultVisit(operation);
 }
示例#29
0
 public abstract TransformationImpact CalculateRefactorImpact(ILabelStatement statement);
 public GoToStatement(IStatementParent parent, ILabelStatement target)
     : base(parent, target)
 {
 }
示例#31
0
        protected virtual void Write(string token, TranslatorFormatterTokenType tokenType, ILabelStatement label, bool declarePoint)
        {
            string result = GetFormat(token, tokenType);

            target.Write(result);
        }
示例#32
0
 /// <inheritdoc />
 public override Expression VisitLabelStatement(ILabelStatement operation, LocalBinder argument)
 {
     return(Expression.Label(operation.LabeledStatement.Accept(this, argument)));
 }
示例#33
0
 public void Add(ILabelStatement label)
 {
     SnapNodes.Add(new SnapNode(label));
 }