-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use evaluator for isolatedModules enum restrictions #57966
Changes from 5 commits
b90b2d8
79b5ff1
392976d
ed0ea55
2035fc6
4f69ba7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5626,6 +5626,7 @@ export interface EmitResolver { | |
isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult; | ||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant | ||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this still need to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not, but the same signature is public API on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, |
||
getEnumMemberValue(node: EnumMember): EvaluatorResult | undefined; | ||
getReferencedValueDeclaration(reference: Identifier): Declaration | undefined; | ||
getReferencedValueDeclarations(reference: Identifier): Declaration[] | undefined; | ||
getTypeReferenceSerializationKind(typeName: EntityName, location?: Node): TypeReferenceSerializationKind; | ||
|
@@ -5958,6 +5959,13 @@ export const enum NodeCheckFlags { | |
InCheckIdentifier = 1 << 22, | ||
} | ||
|
||
/** @internal */ | ||
export interface EvaluatorResult<T extends string | number | undefined = string | number | undefined> { | ||
value: T; | ||
isSyntacticallyString: boolean; | ||
resolvedOtherFiles: boolean; | ||
} | ||
|
||
// dprint-ignore | ||
/** @internal */ | ||
export interface NodeLinks { | ||
|
@@ -5968,7 +5976,7 @@ export interface NodeLinks { | |
resolvedSymbol?: Symbol; // Cached name resolution result | ||
resolvedIndexInfo?: IndexInfo; // Cached indexing info resolution result | ||
effectsSignature?: Signature; // Signature with possible control flow effects | ||
enumMemberValue?: string | number; // Constant value of enum member | ||
enumMemberValue?: EvaluatorResult; // Constant value of enum member | ||
isVisible?: boolean; // Is this node visible | ||
containsArgumentsReference?: boolean; // Whether a function-like declaration contains an 'arguments' reference | ||
hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context | ||
|
@@ -10074,6 +10082,6 @@ export interface Queue<T> { | |
|
||
/** @internal */ | ||
export interface EvaluationResolver { | ||
evaluateEntityNameExpression(expr: EntityNameExpression, location: Declaration | undefined): string | number | undefined; | ||
evaluateElementAccessExpression(expr: ElementAccessExpression, location: Declaration | undefined): string | number | undefined; | ||
evaluateEntityNameExpression(expr: EntityNameExpression, location: Declaration | undefined): EvaluatorResult; | ||
evaluateElementAccessExpression(expr: ElementAccessExpression, location: Declaration | undefined): EvaluatorResult; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nit but we haven't really used type imports anywhere else quite yet (besides that protocol.ts blunder); I don't think we've set the settings in settings.json yet that would allow sorting to be inline either... Maybe we just avoid type imports until we can switch them all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me, but this is what auto-imports did automatically 😬My bad, that’s my own setting; I guess I was testing it a while back. It works!