All files Owner.js

95% Statements 19/20
75% Branches 6/8
100% Functions 4/4
95% Lines 19/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33  38x   38x 38x 38x 38x 38x 23x     38x 23x 23x 23x     23x     38x   42x 42x 5x   37x     38x 14x    
// Owner is the `to` for a message or the name in the creation.
const sequenceParser = require('../generated-parser/sequenceParser')
 
const seqParser = sequenceParser.sequenceParser;
const CreationContext = seqParser.CreationContext;
const MessageContext = seqParser.MessageContext
const AsyncMessageContext = seqParser.AsyncMessageContext
CreationContext.prototype.Assignee = function () {
  return this.creationBody()?.assignment()?.assignee()?.getText();
}
 
CreationContext.prototype.Owner = function () {
  const assignee = this.Assignee();
  const type = this.creationBody()?.construct()?.getText();
  Iif (!type) {
    return 'Missing Constructor'
  }
  return assignee ? `${assignee}:${type}`: type;
}
 
MessageContext.prototype.Owner = function () {
  // Note: It may still be a self message if it has a `to` and `to === from`.
  const isImpliedSelf = !this.messageBody()?.to();
  if (isImpliedSelf) {
    return this.parentCtx.Origin();
  }
  return this.messageBody().to().getTextWithoutQuotes();
}
 
AsyncMessageContext.prototype.Owner = function () {
  return this.to()?.getTextWithoutQuotes() || this.parentCtx.Origin();
}