mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-19 05:07:20 +02:00
Trois défauts sans rapport entre eux, tous visibles à l'écran. Jauge de contexte bloquée à « 0 / N (0 %) » : le comptage exact vient de usage.prompt_tokens (include_usage), qu'un llama-server récent a cessé de renvoyer. On note désormais si l'usage est arrivé ; sinon la fin de tour publie l'estimation qui pilote déjà la compaction — approximative, mais jamais absente. Et la souscription envoie la valeur courante juste après le rattrapage : une page rechargée affichait zéro sur une discussion pourtant pleine, faute d'événement ctx_used dans la fenêtre rejouée. Espace disque : « il ne reste que 11,9 Go » sur un partage Unraid qui en a des centaines. /mnt/user est servi par shfs, un FUSE qui agrège plusieurs disques — statfs y renvoie l'espace d'un seul, et ce chiffre REFUSAIT l'installation du modèle. Les systèmes de fichiers qui approximent (FUSE, overlay, NFS, CIFS, Ceph, Gluster) sont reconnus par leur magie : leur chiffre reste affiché, précédé d'un « ~ », mais ne bloque plus rien. Panneau Fichiers : le panneau entier défilait, emportant vers le haut l'en-tête, le fil d'Ariane et le pied (occupation disque, bouton .zip) dès qu'il y avait quelques fichiers. Seule la liste défile maintenant ; le pied reste en bas et l'état vide se centre. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
160 lines
4.2 KiB
JavaScript
160 lines
4.2 KiB
JavaScript
import {flowParseAssignableListItemTypes} from "../plugins/flow";
|
|
import {tsParseAssignableListItemTypes, tsParseModifiers} from "../plugins/typescript";
|
|
import {
|
|
eat,
|
|
IdentifierRole,
|
|
match,
|
|
next,
|
|
popTypeContext,
|
|
pushTypeContext,
|
|
} from "../tokenizer/index";
|
|
import {ContextualKeyword} from "../tokenizer/keywords";
|
|
import {TokenType, TokenType as tt} from "../tokenizer/types";
|
|
import {isFlowEnabled, isTypeScriptEnabled, state} from "./base";
|
|
import {parseIdentifier, parseMaybeAssign, parseObj} from "./expression";
|
|
import {expect, unexpected} from "./util";
|
|
|
|
export function parseSpread() {
|
|
next();
|
|
parseMaybeAssign(false);
|
|
}
|
|
|
|
export function parseRest(isBlockScope) {
|
|
next();
|
|
parseBindingAtom(isBlockScope);
|
|
}
|
|
|
|
export function parseBindingIdentifier(isBlockScope) {
|
|
parseIdentifier();
|
|
markPriorBindingIdentifier(isBlockScope);
|
|
}
|
|
|
|
export function parseImportedIdentifier() {
|
|
parseIdentifier();
|
|
state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ImportDeclaration;
|
|
}
|
|
|
|
export function markPriorBindingIdentifier(isBlockScope) {
|
|
let identifierRole;
|
|
if (state.scopeDepth === 0) {
|
|
identifierRole = IdentifierRole.TopLevelDeclaration;
|
|
} else if (isBlockScope) {
|
|
identifierRole = IdentifierRole.BlockScopedDeclaration;
|
|
} else {
|
|
identifierRole = IdentifierRole.FunctionScopedDeclaration;
|
|
}
|
|
state.tokens[state.tokens.length - 1].identifierRole = identifierRole;
|
|
}
|
|
|
|
// Parses lvalue (assignable) atom.
|
|
export function parseBindingAtom(isBlockScope) {
|
|
switch (state.type) {
|
|
case tt._this: {
|
|
// In TypeScript, "this" may be the name of a parameter, so allow it.
|
|
const oldIsType = pushTypeContext(0);
|
|
next();
|
|
popTypeContext(oldIsType);
|
|
return;
|
|
}
|
|
|
|
case tt._yield:
|
|
case tt.name: {
|
|
state.type = tt.name;
|
|
parseBindingIdentifier(isBlockScope);
|
|
return;
|
|
}
|
|
|
|
case tt.bracketL: {
|
|
next();
|
|
parseBindingList(tt.bracketR, isBlockScope, true /* allowEmpty */);
|
|
return;
|
|
}
|
|
|
|
case tt.braceL:
|
|
parseObj(true, isBlockScope);
|
|
return;
|
|
|
|
default:
|
|
unexpected();
|
|
}
|
|
}
|
|
|
|
export function parseBindingList(
|
|
close,
|
|
isBlockScope,
|
|
allowEmpty = false,
|
|
allowModifiers = false,
|
|
contextId = 0,
|
|
) {
|
|
let first = true;
|
|
|
|
let hasRemovedComma = false;
|
|
const firstItemTokenIndex = state.tokens.length;
|
|
|
|
while (!eat(close) && !state.error) {
|
|
if (first) {
|
|
first = false;
|
|
} else {
|
|
expect(tt.comma);
|
|
state.tokens[state.tokens.length - 1].contextId = contextId;
|
|
// After a "this" type in TypeScript, we need to set the following comma (if any) to also be
|
|
// a type token so that it will be removed.
|
|
if (!hasRemovedComma && state.tokens[firstItemTokenIndex].isType) {
|
|
state.tokens[state.tokens.length - 1].isType = true;
|
|
hasRemovedComma = true;
|
|
}
|
|
}
|
|
if (allowEmpty && match(tt.comma)) {
|
|
// Empty item; nothing further to parse for this item.
|
|
} else if (eat(close)) {
|
|
break;
|
|
} else if (match(tt.ellipsis)) {
|
|
parseRest(isBlockScope);
|
|
parseAssignableListItemTypes();
|
|
// Support rest element trailing commas allowed by TypeScript <2.9.
|
|
eat(TokenType.comma);
|
|
expect(close);
|
|
break;
|
|
} else {
|
|
parseAssignableListItem(allowModifiers, isBlockScope);
|
|
}
|
|
}
|
|
}
|
|
|
|
function parseAssignableListItem(allowModifiers, isBlockScope) {
|
|
if (allowModifiers) {
|
|
tsParseModifiers([
|
|
ContextualKeyword._public,
|
|
ContextualKeyword._protected,
|
|
ContextualKeyword._private,
|
|
ContextualKeyword._readonly,
|
|
ContextualKeyword._override,
|
|
]);
|
|
}
|
|
|
|
parseMaybeDefault(isBlockScope);
|
|
parseAssignableListItemTypes();
|
|
parseMaybeDefault(isBlockScope, true /* leftAlreadyParsed */);
|
|
}
|
|
|
|
function parseAssignableListItemTypes() {
|
|
if (isFlowEnabled) {
|
|
flowParseAssignableListItemTypes();
|
|
} else if (isTypeScriptEnabled) {
|
|
tsParseAssignableListItemTypes();
|
|
}
|
|
}
|
|
|
|
// Parses assignment pattern around given atom if possible.
|
|
export function parseMaybeDefault(isBlockScope, leftAlreadyParsed = false) {
|
|
if (!leftAlreadyParsed) {
|
|
parseBindingAtom(isBlockScope);
|
|
}
|
|
if (!eat(tt.eq)) {
|
|
return;
|
|
}
|
|
const eqIndex = state.tokens.length - 1;
|
|
parseMaybeAssign();
|
|
state.tokens[eqIndex].rhsEndIndex = state.tokens.length;
|
|
}
|