[ 
https://issues.apache.org/jira/browse/TINKERPOP-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15422824#comment-15422824
 ] 

ASF GitHub Bot commented on TINKERPOP-1405:
-------------------------------------------

Github user dkuppitz commented on the issue:

    https://github.com/apache/tinkerpop/pull/381
  
    Lots of calls to ` traversal.asAdmin().getEndStep()`. Maybe it's smarter to 
call it only once..? More like this:
    
    ```
    // The ProfileSideEffectStep must be the last step, 2nd last step when 
accompanied by the cap step,
    // or 3rd to last when the traversal ends with a RequirementsStep.
    Step endStep;
    if (TraversalHelper.hasStepOfClass(ProfileSideEffectStep.class, traversal) 
&&
            !((endStep = traversal.asAdmin().getEndStep()) instanceof 
ProfileSideEffectStep ||
                    (endStep instanceof SideEffectCapStep && 
endStep.getPreviousStep() instanceof ProfileSideEffectStep) ||
                    (endStep instanceof RequirementsStep && (
                            endStep.getPreviousStep() instanceof 
SideEffectCapStep ||
                            endStep.getPreviousStep() instanceof 
ProfileSideEffectStep)))) {
        throw new VerificationException("When specified, the profile()-Step 
must be the last step or followed only by the cap()-step and/or requirements 
step.", traversal);
    }
    ```
    
    ^ I also removed all the negations, which makes the chained conditions a 
bit easier to read IMO.
    
    But all in all this PR looks good to me.
    
    VOTE: +1


> profile() doesn't like withPath()
> ---------------------------------
>
>                 Key: TINKERPOP-1405
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1405
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.2.1
>            Reporter: Daniel Kuppitz
>            Assignee: Ted Wilmes
>             Fix For: 3.2.2
>
>
> {{profile()}} fails when used in conjunction with {{withPath()}}:
> {code}
> gremlin> g.withPath().V().profile()
> When specified, the profile()-Step must be the last step or followed only by 
> the cap()-step.
> Display stack trace? [yN]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to