From acd4252d6bd0589586039eb46f6cc62f44155d34 Mon Sep 17 00:00:00 2001 From: MrCoder Date: Fri, 1 Nov 2024 22:56:11 +1100 Subject: [PATCH] Removed IsInitedFromOccurrence.js. Replaced with ArrowMixin. --- .../Block/Statement/Creation/Creation.vue | 3 -- src/parser/IsInitedFromOccurrence.js | 43 ------------------- src/parser/index.js | 1 - 3 files changed, 47 deletions(-) delete mode 100644 src/parser/IsInitedFromOccurrence.js diff --git a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Creation/Creation.vue b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Creation/Creation.vue index dcd677bd..7e31709f 100644 --- a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Creation/Creation.vue +++ b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Creation/Creation.vue @@ -120,9 +120,6 @@ export default { isCurrent() { return this.creation.isCurrent(this.cursor); }, - isInitedFromOccurrence: function () { - return this.creation.isInitedFromOccurrence(this.from); - }, messageTextStyle() { return this.commentObj?.messageStyle; }, diff --git a/src/parser/IsInitedFromOccurrence.js b/src/parser/IsInitedFromOccurrence.js deleted file mode 100644 index 63b04300..00000000 --- a/src/parser/IsInitedFromOccurrence.js +++ /dev/null @@ -1,43 +0,0 @@ -import { default as sequenceParser } from "../generated-parser/sequenceParser"; -const seqParser = sequenceParser; - -const CreationContext = seqParser.CreationContext; -CreationContext.prototype.Body = CreationContext.prototype.creationBody; -CreationContext.prototype.isInitedFromOccurrence = function (from) { - return isInitedFromOccurrence.bind(this)(from); -}; - -const MessageContext = seqParser.MessageContext; -MessageContext.prototype.Body = MessageContext.prototype.messageBody; -MessageContext.prototype.isInitedFromOccurrence = function (from) { - return isInitedFromOccurrence.bind(this)(from); -}; - -const AsyncMessageContext = seqParser.AsyncMessageContext; -AsyncMessageContext.prototype.isInitedFromOccurrence = function (from) { - return isInitedFromOccurrence.bind(this)(from); -}; - -/** - * if a message is sent from a participant who is also a target of a message, we can - * say that the message is inited from an occurrence - **/ -function isInitedFromOccurrence(from) { - // eslint-disable-next-line @typescript-eslint/no-this-alias - let current = this; - while (current != null) { - if (current instanceof seqParser.StatContext) { - let participant; - if (current.message && current.message()) { - participant = current.message().Owner(); - } else if (current.creation && current.creation()) { - participant = current.creation().Owner(); - } - if (participant === from) { - return true; - } - } - current = current.parentCtx; - } - return false; -} diff --git a/src/parser/index.js b/src/parser/index.js index 768911d9..62f14a0c 100644 --- a/src/parser/index.js +++ b/src/parser/index.js @@ -15,7 +15,6 @@ import "./SignatureText"; import "./Messages/MessageContext"; import "./From"; import "./key/Key"; -import "./IsInitedFromOccurrence"; import "./utils/cloest-ancestor/ClosestAncestor"; import { formatText } from "../utils/StringUtil";