Implement string, number literal and completion record

This commit is contained in:
2020-08-13 12:22:09 +05:30
parent e4423fa1b5
commit cb24c79a58
10 changed files with 182 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
import { LanguageType } from '../language-types/allTypes';
export const TypeString = '[[Type]]';
export const ValueString = '[[Value]]';
export const TargetString = '[[Target]]';
export type TType = 'normal' | 'break' | 'continue' | 'return' | 'throw';
export type TValue = LanguageType | undefined;
export type TTarget = string | undefined;
export interface TCompletionRecord {
[TypeString]: TType;
[ValueString]: TValue;
[TargetString]: TTarget;
}
export class CompletionRecord implements TCompletionRecord {
[TypeString]: TType;
[ValueString]: TValue;
[TargetString]: TTarget;
constructor(type: TType, value?: TValue, target?: TTarget) {
this[TypeString] = type;
this[ValueString] = value;
this[TargetString] = target;
}
}
export function NormalCompletion(value?: TValue) {
return new CompletionRecord('normal', value);
}