Skip to content

Commit d580e01

Browse files
committed
Switch to using constructors
1 parent 11ac090 commit d580e01

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/TL_filerefs.tl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ callOp method:string args:Vector<TypedOpArg> = ActionOp;
1111
getMessageOp flags:# peer:TypedOp id:TypedOp from_scheduled:flags.0?TypedOp = ActionOp;
1212

1313
// Field extraction path
14-
pathPart flags:# constructor:string param:string flag_abort_if_empty:flags.0?true flag_fallback_if_empty:flags.1?TypedOp flag_passthrough:flags.2?true = PathPart;
14+
paramNotFlag = ParamFlag;
15+
paramIsFlagAbortIfEmpty = ParamFlag;
16+
paramIsFlagFallback fallback:TypedOp = ParamFlag;
17+
paramIsFlagPassthrough = ParamFlag;
18+
19+
pathPart flags:# constructor:string param:string flag:ParamFlag = PathPart;
1520

1621
path parts:Vector<PathPart> = Path;
1722
pathParent parts:Vector<PathPart> = Path;

src/file_ref_map.dat

420 Bytes
Binary file not shown.

tools/FileRefExtractor/FieldExtractorOp.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ final protected function buildPath(TLContext $tl): array
6363
'_' => 'pathPart',
6464
'constructor' => $part[0],
6565
'param' => $part[1],
66+
'flag' => ['_' => 'paramNotFlag'],
6667
];
6768
if (isset($part[2])) {
6869
if ($part[2] instanceof TypedOp) {
69-
$newPart['flag_fallback_if_empty'] = $part[2]->build($tl);
70+
$newPart['flag'] = ['_' => 'paramIsFlagFallback', 'fallback' => $part[2]->build($tl)];
7071
} elseif (\is_int($part[2])) {
7172
if ($part[2] & self::FLAG_UNPACK_ARRAY) {
7273
if ($tl->buildMode instanceof Ast && !$tl->buildMode->allowUnpacking) {
@@ -75,10 +76,10 @@ final protected function buildPath(TLContext $tl): array
7576
$newPart['unpack_vector'] = true;
7677
}
7778
if ($part[2] & self::FLAG_IF_ABSENT_ABORT) {
78-
$newPart['flag_abort_if_empty'] = true;
79+
$newPart['flag'] = ['_' => 'paramIsFlagAbortIfEmpty'];
7980
}
8081
if ($part[2] & self::FLAG_PASSTHROUGH) {
81-
$newPart['flag_passthrough'] = true;
82+
$newPart['flag'] = ['_' => 'paramIsFlagPassthrough'];
8283
}
8384
}
8485
}

0 commit comments

Comments
 (0)