Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 901bace

Browse files
committed
Add position to Argument.
1 parent dda12ea commit 901bace

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/shell/Parser2.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,18 @@ class ArgumentList extends BranchNode {
112112

113113
@memoizeAccessor
114114
get children(): ASTNode[] {
115-
return this.childTokens.map(token => new Argument(token, this.command));
115+
return this.childTokens.map((token, index) => new Argument(token, this.command, index + 1));
116116
}
117117
}
118118

119119
export class Argument extends LeafNode {
120+
readonly position: number;
120121
private readonly command: Command;
121122

122-
constructor(token: Token, command: Command) {
123+
constructor(token: Token, command: Command, position: number) {
123124
super(token);
124125
this.command = command;
126+
this.position = position;
125127
}
126128

127129
suggestions(context: PreliminarySuggestionContext): Promise<Suggestion[]> {

0 commit comments

Comments
 (0)