public void VisitNodeVariableJump(NodeVariableJump nvj) { if (nvj.Variable == null) { _report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "A conditional jump node has no variable.", nvj); } if (nvj.Target == null || !_nodeMap.ContainsKey(nvj.Target)) { _report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "A conditional jump node has an invalid target.", nvj); } else if (nvj.Target == nvj) { _report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "A conditional jump node has itself as the target.", nvj); } else { var jumpOriginScene = _nodeMap[nvj].SceneId; var jumpTargetScene = _nodeMap[nvj.Target].SceneId; if (jumpOriginScene != jumpTargetScene) { _report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "Please refer to https://xkcd.com/292/ for additional help.", nvj); } } }
private string FormatVariableJump(NodeVariableJump nvj) { if (nvj.Variable.Binary) { return(nvj.Variable.Name); } else { return($"{nvj.Variable.Name} {_converter.Convert(nvj.Type, null, null, null)} {nvj.Value}"); } }
public void VisitNodeVariableJump(NodeVariableJump nvj) { UsedVariables.Add(nvj.Variable); if (nvj.Target == null) { return; } // We set this in this module if (OutputState.Variables.ContainsKey(nvj.Variable)) { if (nvj.Value != OutputState.Variables[nvj.Variable]) { return; } } else if (InputState.Variables.ContainsKey(nvj.Variable)) // We decided on this beforehand but from caller { if (nvj.Value != InputState.Variables[nvj.Variable]) { return; } } else // May have been set in caller { InputState.Variables[nvj.Variable] = nvj.Value; // Current branch jumps // New branch skips var clone = Clone(); // TODO: Fix //clone.InputState.Variables[nvj.Variable] = !nvj.Value; _parent.AddInterpreter(clone); } var targetIndexVJ = _scene.Nodes.IndexOf(nvj.Target); if (targetIndexVJ == -1) { Report.AddMessage(ProjectReportMessage.MessageSeverity.Error, "Variable raptors dispatched.", nvj); Running = false; } else if (targetIndexVJ < Position) { Report.AddMessage(ProjectReportMessage.MessageSeverity.Info, "Detected jump backwards (potential loop), aborting analysis of this branch.", nvj); Running = false; } Position = targetIndexVJ; }
public void VisitNodeVariableJump(NodeVariableJump nvj) { _writer.WriteStartElement("NodeVariableJump"); if (nvj.Target != null) { var nodeIdvj = _nodeMapping[nvj.Target]; _writer.WriteAttributeString("TargetNode", nodeIdvj.ToString()); } if (nvj.Variable != null) { _writer.WriteAttributeString("Variable", nvj.Variable.Name); } _writer.WriteAttributeString("ComparisonType", nvj.Type.ToString()); _writer.WriteAttributeString("Value", nvj.Value.ToString()); _writer.WriteEndElement(); }
public void VisitNodeVariableJump(NodeVariableJump nvj) { _writer.WriteStartElement("NodeVariableJump"); if (nvj.Target != null && _nodeMap.ContainsKey(nvj.Target)) { var(sceneIdvj, nodeIdvj) = _nodeMap[nvj.Target]; _writer.WriteAttributeString("TargetScene", sceneIdvj.ToString()); _writer.WriteAttributeString("TargetNode", nodeIdvj.ToString()); } if (nvj.Variable != null) { _writer.WriteAttributeString("Variable", _projectService.Variables.IndexOf(nvj.Variable).ToString()); } _writer.WriteAttributeString("ComparisonType", nvj.Type.ToString()); _writer.WriteAttributeString("Value", nvj.Value.ToString()); _writer.WriteEndElement(); }
public void VisitNodeVariableJump(NodeVariableJump nvj) { }