public virtual bool VisitLabelStmt(LabelStmt stmt) { if (!VisitStmt(stmt)) { return(false); } return(true); }
/// <summary> /// Visit LabelStmt, stores the label in dictionary and creates new basic block. /// </summary> /// <param name="x">LabelStmt</param> public override void VisitLabelStmt(LabelStmt x) { BasicBlock labelBlock = new BasicBlock(); labelDictionary.GetOrCreateLabelData(x.Name, x.Position) .AsociateLabel(labelBlock, x.Position); BasicBlockEdge.ConnectDirectEdge(currentBasicBlock, labelBlock); currentBasicBlock = labelBlock; //Next line could be used for label visualization, label statement shouldnt be in resulting cgf //labelBlock.AddElement(x); }
public override void VisitLabelStmt(LabelStmt x) { var /*!*/ label = GetLabelBlock(x.Name.Name.Value); if ((label.Flags & ControlFlowGraph.LabelBlockFlags.Defined) != 0) { label.Flags |= ControlFlowGraph.LabelBlockFlags.Redefined; // label was defined already return; // ignore label redefinition } label.Flags |= ControlFlowGraph.LabelBlockFlags.Defined; // label is defined label.LabelSpan = x.Span; _current = WithNewOrdinal(Connect(_current, label.TargetBlock)); }
internal override Statement Analyze(GotoStmt node, Analyzer analyzer) { // // TODO: analyze reachability, restrict jumps inside blocks, ... // // goto x; // // unreachable // x: // if (analyzer.IsThisCodeUnreachable()) { analyzer.ReportUnreachableCode(node.Span); return(EmptyStmt.Unreachable); } Dictionary <VariableName, Statement> labels = analyzer.CurrentLabels; Statement stmt; if (labels.TryGetValue(node.LabelName, out stmt)) { LabelStmt label = stmt as LabelStmt; if (label != null) { label.IsReferred = true; } } else { // add a stub (this node): labels.Add(node.LabelName, node); } return(node); }
public override void VisitLabelStmt(LabelStmt x) { ConsumeToken(Tokens.T_STRING, x.Name.Name.Value, x.Name.Span.Start); ConsumeToken(Tokens.T_COLON, ":", x.Span.End - 1); }
public bool VisitLabelStmt(LabelStmt stmt) { throw new NotImplementedException(); }
virtual public void VisitLabelStmt(LabelStmt x) { // x.Name }
override public void VisitLabelStmt(LabelStmt x) { _serializer.Serialize(typeof(LabelStmt).Name, SerializeSpan(x.Span), new NodeObj("Name", x.Name.Name.Value)); }