Merge pull request #2169 from Microsoft/withANameLikeUnicodeYoudThinkThereWouldntBeSoManyWaysToDoIt
Add support for extended Unicode escape sequences in strings and templates
This commit is contained in:
commit
7212912307
|
@ -623,29 +623,6 @@ module ts {
|
|||
"\u0085": "\\u0085" // nextLine
|
||||
};
|
||||
|
||||
/**
|
||||
* Based heavily on the abstract 'Quote'/ 'QuoteJSONString' operation from ECMA-262 (24.3.2.2),
|
||||
* but augmented for a few select characters.
|
||||
* Note that this doesn't actually wrap the input in double quotes.
|
||||
*/
|
||||
export function escapeString(s: string): string {
|
||||
// Prioritize '"' and '\'
|
||||
s = backslashOrDoubleQuote.test(s) ? s.replace(backslashOrDoubleQuote, getReplacement) : s;
|
||||
s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;
|
||||
|
||||
return s;
|
||||
|
||||
function getReplacement(c: string) {
|
||||
return escapedCharsMap[c] || unicodeEscape(c);
|
||||
}
|
||||
|
||||
function unicodeEscape(c: string): string {
|
||||
var hexCharCode = c.charCodeAt(0).toString(16);
|
||||
var paddedHexCode = ("0000" + hexCharCode).slice(-4);
|
||||
return "\\u" + paddedHexCode;
|
||||
}
|
||||
}
|
||||
|
||||
export function getDefaultLibFileName(options: CompilerOptions): string {
|
||||
return options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts";
|
||||
}
|
||||
|
|
|
@ -155,6 +155,8 @@ module ts {
|
|||
Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." },
|
||||
Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." },
|
||||
Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." },
|
||||
An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." },
|
||||
Unterminated_Unicode_escape_sequence: { code: 1199, category: DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
|
|
|
@ -611,7 +611,14 @@
|
|||
"category": "Error",
|
||||
"code": 1197
|
||||
},
|
||||
|
||||
"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.": {
|
||||
"category": "Error",
|
||||
"code": 1198
|
||||
},
|
||||
"Unterminated Unicode escape sequence.": {
|
||||
"category": "Error",
|
||||
"code": 1199
|
||||
},
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
|
|
|
@ -2223,36 +2223,70 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function isBinaryOrOctalIntegerLiteral(text: string): boolean {
|
||||
if (text.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (text.charCodeAt(1) === CharacterCodes.B || text.charCodeAt(1) === CharacterCodes.b ||
|
||||
text.charCodeAt(1) === CharacterCodes.O || text.charCodeAt(1) === CharacterCodes.o) {
|
||||
return true;
|
||||
function isBinaryOrOctalIntegerLiteral(node: LiteralExpression, text: string): boolean {
|
||||
if (node.kind === SyntaxKind.NumericLiteral && text.length > 1) {
|
||||
switch (text.charCodeAt(1)) {
|
||||
case CharacterCodes.b:
|
||||
case CharacterCodes.B:
|
||||
case CharacterCodes.o:
|
||||
case CharacterCodes.O:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitLiteral(node: LiteralExpression) {
|
||||
var text = languageVersion < ScriptTarget.ES6 && isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) :
|
||||
node.parent ? getSourceTextOfNodeFromSourceFile(currentSourceFile, node) :
|
||||
node.text;
|
||||
var text = getLiteralText(node);
|
||||
|
||||
if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) {
|
||||
writer.writeLiteral(text);
|
||||
}
|
||||
// For version below ES6, emit binary integer literal and octal integer literal in canonical form
|
||||
else if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.NumericLiteral && isBinaryOrOctalIntegerLiteral(text)) {
|
||||
// For versions below ES6, emit binary & octal literals in their canonical decimal form.
|
||||
else if (languageVersion < ScriptTarget.ES6 && isBinaryOrOctalIntegerLiteral(node, text)) {
|
||||
write(node.text);
|
||||
}
|
||||
else {
|
||||
write(text);
|
||||
}
|
||||
}
|
||||
|
||||
function getTemplateLiteralAsStringLiteral(node: LiteralExpression): string {
|
||||
return '"' + escapeString(node.text) + '"';
|
||||
|
||||
function getLiteralText(node: LiteralExpression) {
|
||||
// Any template literal or string literal with an extended escape
|
||||
// (e.g. "\u{0067}") will need to be downleveled as a escaped string literal.
|
||||
if (languageVersion < ScriptTarget.ES6 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {
|
||||
return getQuotedEscapedLiteralText('"', node.text, '"');
|
||||
}
|
||||
|
||||
// If we don't need to downlevel and we can reach the original source text using
|
||||
// the node's parent reference, then simply get the text as it was originally written.
|
||||
if (node.parent) {
|
||||
return getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
|
||||
}
|
||||
|
||||
// If we can't reach the original source text, use the canonical form if it's a number,
|
||||
// or an escaped quoted form of the original text if it's string-like.
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.StringLiteral:
|
||||
return getQuotedEscapedLiteralText('"', node.text, '"');
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
return getQuotedEscapedLiteralText('`', node.text, '`');
|
||||
case SyntaxKind.TemplateHead:
|
||||
return getQuotedEscapedLiteralText('`', node.text, '${');
|
||||
case SyntaxKind.TemplateMiddle:
|
||||
return getQuotedEscapedLiteralText('}', node.text, '${');
|
||||
case SyntaxKind.TemplateTail:
|
||||
return getQuotedEscapedLiteralText('}', node.text, '`');
|
||||
case SyntaxKind.NumericLiteral:
|
||||
return node.text;
|
||||
}
|
||||
|
||||
Debug.fail(`Literal kind '${node.kind}' not accounted for.`);
|
||||
}
|
||||
|
||||
function getQuotedEscapedLiteralText(leftQuote: string, text: string, rightQuote: string) {
|
||||
return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote;
|
||||
}
|
||||
|
||||
function emitDownlevelRawTemplateLiteral(node: LiteralExpression) {
|
||||
|
|
|
@ -2163,6 +2163,10 @@ module ts {
|
|||
var text = scanner.getTokenValue();
|
||||
node.text = internName ? internIdentifier(text) : text;
|
||||
|
||||
if (scanner.hasExtendedUnicodeEscape()) {
|
||||
node.hasExtendedUnicodeEscape = true;
|
||||
}
|
||||
|
||||
if (scanner.isUnterminated()) {
|
||||
node.isUnterminated = true;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ module ts {
|
|||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
|
@ -556,6 +557,7 @@ module ts {
|
|||
var token: SyntaxKind;
|
||||
var tokenValue: string;
|
||||
var precedingLineBreak: boolean;
|
||||
var hasExtendedUnicodeEscape: boolean;
|
||||
var tokenIsUnterminated: boolean;
|
||||
|
||||
function error(message: DiagnosticMessage, length?: number): void {
|
||||
|
@ -606,11 +608,27 @@ module ts {
|
|||
}
|
||||
return +(text.substring(start, pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the given number of hexadecimal digits in the text,
|
||||
* returning -1 if the given number is unavailable.
|
||||
*/
|
||||
function scanExactNumberOfHexDigits(count: number): number {
|
||||
return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans as many hexadecimal digits as are available in the text,
|
||||
* returning -1 if the given number of digits was unavailable.
|
||||
*/
|
||||
function scanMinimumNumberOfHexDigits(count: number): number {
|
||||
return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true);
|
||||
}
|
||||
|
||||
function scanHexDigits(count: number, mustMatchCount?: boolean): number {
|
||||
function scanHexDigits(minCount: number, scanAsManyAsPossible: boolean): number {
|
||||
var digits = 0;
|
||||
var value = 0;
|
||||
while (digits < count || !mustMatchCount) {
|
||||
while (digits < minCount || scanAsManyAsPossible) {
|
||||
var ch = text.charCodeAt(pos);
|
||||
if (ch >= CharacterCodes._0 && ch <= CharacterCodes._9) {
|
||||
value = value * 16 + ch - CharacterCodes._0;
|
||||
|
@ -627,7 +645,7 @@ module ts {
|
|||
pos++;
|
||||
digits++;
|
||||
}
|
||||
if (digits < count) {
|
||||
if (digits < minCount) {
|
||||
value = -1;
|
||||
}
|
||||
return value;
|
||||
|
@ -764,16 +782,20 @@ module ts {
|
|||
return "\'";
|
||||
case CharacterCodes.doubleQuote:
|
||||
return "\"";
|
||||
case CharacterCodes.x:
|
||||
case CharacterCodes.u:
|
||||
var ch = scanHexDigits(ch === CharacterCodes.x ? 2 : 4, /*mustMatchCount*/ true);
|
||||
if (ch >= 0) {
|
||||
return String.fromCharCode(ch);
|
||||
}
|
||||
else {
|
||||
error(Diagnostics.Hexadecimal_digit_expected);
|
||||
return ""
|
||||
// '\u{DDDDDDDD}'
|
||||
if (pos < len && text.charCodeAt(pos) === CharacterCodes.openBrace) {
|
||||
hasExtendedUnicodeEscape = true;
|
||||
pos++;
|
||||
return scanExtendedUnicodeEscape();
|
||||
}
|
||||
|
||||
// '\uDDDD'
|
||||
return scanHexadecimalEscape(/*numDigits*/ 4)
|
||||
|
||||
case CharacterCodes.x:
|
||||
// '\xDD'
|
||||
return scanHexadecimalEscape(/*numDigits*/ 2)
|
||||
|
||||
// when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),
|
||||
// the line terminator is interpreted to be "the empty code unit sequence".
|
||||
|
@ -790,6 +812,66 @@ module ts {
|
|||
return String.fromCharCode(ch);
|
||||
}
|
||||
}
|
||||
|
||||
function scanHexadecimalEscape(numDigits: number): string {
|
||||
var escapedValue = scanExactNumberOfHexDigits(numDigits);
|
||||
|
||||
if (escapedValue >= 0) {
|
||||
return String.fromCharCode(escapedValue);
|
||||
}
|
||||
else {
|
||||
error(Diagnostics.Hexadecimal_digit_expected);
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
function scanExtendedUnicodeEscape(): string {
|
||||
var escapedValue = scanMinimumNumberOfHexDigits(1);
|
||||
var isInvalidExtendedEscape = false;
|
||||
|
||||
// Validate the value of the digit
|
||||
if (escapedValue < 0) {
|
||||
error(Diagnostics.Hexadecimal_digit_expected)
|
||||
isInvalidExtendedEscape = true;
|
||||
}
|
||||
else if (escapedValue > 0x10FFFF) {
|
||||
error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
|
||||
isInvalidExtendedEscape = true;
|
||||
}
|
||||
|
||||
if (pos >= len) {
|
||||
error(Diagnostics.Unexpected_end_of_text);
|
||||
isInvalidExtendedEscape = true;
|
||||
}
|
||||
else if (text.charCodeAt(pos) == CharacterCodes.closeBrace) {
|
||||
// Only swallow the following character up if it's a '}'.
|
||||
pos++;
|
||||
}
|
||||
else {
|
||||
error(Diagnostics.Unterminated_Unicode_escape_sequence);
|
||||
isInvalidExtendedEscape = true;
|
||||
}
|
||||
|
||||
if (isInvalidExtendedEscape) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return utf16EncodeAsString(escapedValue);
|
||||
}
|
||||
|
||||
// Derived from the 10.1.1 UTF16Encoding of the ES6 Spec.
|
||||
function utf16EncodeAsString(codePoint: number): string {
|
||||
Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);
|
||||
|
||||
if (codePoint <= 65535) {
|
||||
return String.fromCharCode(codePoint);
|
||||
}
|
||||
|
||||
var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;
|
||||
var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;
|
||||
|
||||
return String.fromCharCode(codeUnit1, codeUnit2);
|
||||
}
|
||||
|
||||
// Current character is known to be a backslash. Check for Unicode escape of the form '\uXXXX'
|
||||
// and return code point value if valid Unicode escape is found. Otherwise return -1.
|
||||
|
@ -797,7 +879,7 @@ module ts {
|
|||
if (pos + 5 < len && text.charCodeAt(pos + 1) === CharacterCodes.u) {
|
||||
var start = pos;
|
||||
pos += 2;
|
||||
var value = scanHexDigits(4, /*mustMatchCount*/ true);
|
||||
var value = scanExactNumberOfHexDigits(4);
|
||||
pos = start;
|
||||
return value;
|
||||
}
|
||||
|
@ -869,6 +951,7 @@ module ts {
|
|||
|
||||
function scan(): SyntaxKind {
|
||||
startPos = pos;
|
||||
hasExtendedUnicodeEscape = false;
|
||||
precedingLineBreak = false;
|
||||
tokenIsUnterminated = false;
|
||||
while (true) {
|
||||
|
@ -1034,7 +1117,7 @@ module ts {
|
|||
case CharacterCodes._0:
|
||||
if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.X || text.charCodeAt(pos + 1) === CharacterCodes.x)) {
|
||||
pos += 2;
|
||||
var value = scanHexDigits(1, /*mustMatchCount*/ false);
|
||||
var value = scanMinimumNumberOfHexDigits(1);
|
||||
if (value < 0) {
|
||||
error(Diagnostics.Hexadecimal_digit_expected);
|
||||
value = 0;
|
||||
|
@ -1336,6 +1419,7 @@ module ts {
|
|||
getTokenPos: () => tokenPos,
|
||||
getTokenText: () => text.substring(tokenPos, pos),
|
||||
getTokenValue: () => tokenValue,
|
||||
hasExtendedUnicodeEscape: () => hasExtendedUnicodeEscape,
|
||||
hasPrecedingLineBreak: () => precedingLineBreak,
|
||||
isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord,
|
||||
isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord,
|
||||
|
|
|
@ -655,6 +655,7 @@ module ts {
|
|||
export interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
|
||||
export interface StringLiteralExpression extends LiteralExpression {
|
||||
|
|
|
@ -1136,7 +1136,7 @@ module ts {
|
|||
newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
|
||||
}
|
||||
|
||||
return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength: */newEndN - oldStartN);
|
||||
return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN);
|
||||
}
|
||||
|
||||
export function nodeStartsNewLexicalEnvironment(n: Node): boolean {
|
||||
|
@ -1255,4 +1255,55 @@ module ts {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This consists of the first 19 unprintable ASCII characters, canonical escapes, lineSeparator,
|
||||
// paragraphSeparator, and nextLine. The latter three are just desirable to suppress new lines in
|
||||
// the language service. These characters should be escaped when printing, and if any characters are added,
|
||||
// the map below must be updated. Note that this regexp *does not* include the 'delete' character.
|
||||
// There is no reason for this other than that JSON.stringify does not handle it either.
|
||||
var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
|
||||
var escapedCharsMap: Map<string> = {
|
||||
"\0": "\\0",
|
||||
"\t": "\\t",
|
||||
"\v": "\\v",
|
||||
"\f": "\\f",
|
||||
"\b": "\\b",
|
||||
"\r": "\\r",
|
||||
"\n": "\\n",
|
||||
"\\": "\\\\",
|
||||
"\"": "\\\"",
|
||||
"\u2028": "\\u2028", // lineSeparator
|
||||
"\u2029": "\\u2029", // paragraphSeparator
|
||||
"\u0085": "\\u0085" // nextLine
|
||||
};
|
||||
|
||||
/**
|
||||
* Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2),
|
||||
* but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine)
|
||||
* Note that this doesn't actually wrap the input in double quotes.
|
||||
*/
|
||||
export function escapeString(s: string): string {
|
||||
s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;
|
||||
|
||||
return s;
|
||||
|
||||
function getReplacement(c: string) {
|
||||
return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));
|
||||
}
|
||||
}
|
||||
|
||||
function get16BitUnicodeEscapeSequence(charCode: number): string {
|
||||
var hexCharCode = charCode.toString(16).toUpperCase();
|
||||
var paddedHexCode = ("0000" + hexCharCode).slice(-4);
|
||||
return "\\u" + paddedHexCode;
|
||||
}
|
||||
|
||||
var nonAsciiCharacters = /[^\u0000-\u007F]/g;
|
||||
export function escapeNonAsciiCharacters(s: string): string {
|
||||
// Replace non-ASCII characters with '\uNNNN' escapes if any exist.
|
||||
// Otherwise just return the original string.
|
||||
return nonAsciiCharacters.test(s) ?
|
||||
s.replace(nonAsciiCharacters, c => get16BitUnicodeEscapeSequence(c.charCodeAt(0))) :
|
||||
s;
|
||||
}
|
||||
}
|
|
@ -552,6 +552,7 @@ declare module "typescript" {
|
|||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
_stringLiteralExpressionBrand: any;
|
||||
|
@ -1422,6 +1423,7 @@ declare module "typescript" {
|
|||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
|
|
|
@ -1664,6 +1664,9 @@ declare module "typescript" {
|
|||
|
||||
isUnterminated?: boolean;
|
||||
>isUnterminated : boolean
|
||||
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
>hasExtendedUnicodeEscape : boolean
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
>StringLiteralExpression : StringLiteralExpression
|
||||
|
@ -4485,6 +4488,9 @@ declare module "typescript" {
|
|||
getTokenValue(): string;
|
||||
>getTokenValue : () => string
|
||||
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
>hasExtendedUnicodeEscape : () => boolean
|
||||
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
>hasPrecedingLineBreak : () => boolean
|
||||
|
||||
|
|
|
@ -583,6 +583,7 @@ declare module "typescript" {
|
|||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
_stringLiteralExpressionBrand: any;
|
||||
|
@ -1453,6 +1454,7 @@ declare module "typescript" {
|
|||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
|
|
|
@ -1810,6 +1810,9 @@ declare module "typescript" {
|
|||
|
||||
isUnterminated?: boolean;
|
||||
>isUnterminated : boolean
|
||||
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
>hasExtendedUnicodeEscape : boolean
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
>StringLiteralExpression : StringLiteralExpression
|
||||
|
@ -4631,6 +4634,9 @@ declare module "typescript" {
|
|||
getTokenValue(): string;
|
||||
>getTokenValue : () => string
|
||||
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
>hasExtendedUnicodeEscape : () => boolean
|
||||
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
>hasPrecedingLineBreak : () => boolean
|
||||
|
||||
|
|
|
@ -584,6 +584,7 @@ declare module "typescript" {
|
|||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
_stringLiteralExpressionBrand: any;
|
||||
|
@ -1454,6 +1455,7 @@ declare module "typescript" {
|
|||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
|
|
|
@ -1760,6 +1760,9 @@ declare module "typescript" {
|
|||
|
||||
isUnterminated?: boolean;
|
||||
>isUnterminated : boolean
|
||||
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
>hasExtendedUnicodeEscape : boolean
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
>StringLiteralExpression : StringLiteralExpression
|
||||
|
@ -4581,6 +4584,9 @@ declare module "typescript" {
|
|||
getTokenValue(): string;
|
||||
>getTokenValue : () => string
|
||||
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
>hasExtendedUnicodeEscape : () => boolean
|
||||
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
>hasPrecedingLineBreak : () => boolean
|
||||
|
||||
|
|
|
@ -621,6 +621,7 @@ declare module "typescript" {
|
|||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
_stringLiteralExpressionBrand: any;
|
||||
|
@ -1491,6 +1492,7 @@ declare module "typescript" {
|
|||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
|
|
|
@ -1933,6 +1933,9 @@ declare module "typescript" {
|
|||
|
||||
isUnterminated?: boolean;
|
||||
>isUnterminated : boolean
|
||||
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
>hasExtendedUnicodeEscape : boolean
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
>StringLiteralExpression : StringLiteralExpression
|
||||
|
@ -4754,6 +4757,9 @@ declare module "typescript" {
|
|||
getTokenValue(): string;
|
||||
>getTokenValue : () => string
|
||||
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
>hasExtendedUnicodeEscape : () => boolean
|
||||
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
>hasPrecedingLineBreak : () => boolean
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapes.ts(4,7): error TS1125: Hexadecimal digit expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapes.ts (1 errors) ====
|
||||
function f(...args: any[]) {
|
||||
}
|
||||
|
||||
f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`;
|
||||
|
||||
!!! error TS1125: Hexadecimal digit expected.
|
|
@ -11,5 +11,5 @@ function f() {
|
|||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
(_a = ["'{1f4a9}'", "'💩'"], _a.raw = ["'\\u{1f4a9}'", "'\\uD83D\\uDCA9'"], f(_a, " should be converted to "));
|
||||
(_a = ["'\uD83D\uDCA9'", "'\uD83D\uDCA9'"], _a.raw = ["'\\u{1f4a9}'", "'\\uD83D\\uDCA9'"], f(_a, " should be converted to "));
|
||||
var _a;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
=== tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapes.ts ===
|
||||
function f(...args: any[]) {
|
||||
>f : (...args: any[]) => void
|
||||
>args : any[]
|
||||
}
|
||||
|
||||
f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`;
|
||||
>f : (...args: any[]) => void
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapesES6.ts(4,7): error TS1125: Hexadecimal digit expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapesES6.ts (1 errors) ====
|
||||
function f(...args: any[]) {
|
||||
}
|
||||
|
||||
f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`;
|
||||
|
||||
!!! error TS1125: Hexadecimal digit expected.
|
|
@ -0,0 +1,9 @@
|
|||
=== tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapesES6.ts ===
|
||||
function f(...args: any[]) {
|
||||
>f : (...args: any[]) => void
|
||||
>args : any[]
|
||||
}
|
||||
|
||||
f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`;
|
||||
>f : (...args: any[]) => void
|
||||
|
|
@ -4,4 +4,4 @@
|
|||
var x = `\x1F\u001f 1F 1f`;
|
||||
|
||||
//// [templateStringControlCharacterEscapes03.js]
|
||||
var x = "\u001f\u001f 1F 1f";
|
||||
var x = "\u001F\u001F 1F 1f";
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
|
||||
//// [templateStringWhitespaceEscapes2.js]
|
||||
// <TAB>, <VT>, <FF>, <SP>, <NBSP>, <BOM>
|
||||
"\t\v\f ";
|
||||
"\t\v\f \u00A0\uFEFF";
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions01_ES5.ts]
|
||||
|
||||
var x = /\u{0}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions01_ES5.js]
|
||||
var x = /\u{0}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions01_ES5.ts ===
|
||||
|
||||
var x = /\u{0}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions01_ES6.ts]
|
||||
|
||||
var x = /\u{0}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions01_ES6.js]
|
||||
var x = /\u{0}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions01_ES6.ts ===
|
||||
|
||||
var x = /\u{0}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions02_ES5.ts]
|
||||
|
||||
var x = /\u{00}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions02_ES5.js]
|
||||
var x = /\u{00}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions02_ES5.ts ===
|
||||
|
||||
var x = /\u{00}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions02_ES6.ts]
|
||||
|
||||
var x = /\u{00}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions02_ES6.js]
|
||||
var x = /\u{00}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions02_ES6.ts ===
|
||||
|
||||
var x = /\u{00}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions03_ES5.ts]
|
||||
|
||||
var x = /\u{0000}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions03_ES5.js]
|
||||
var x = /\u{0000}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions03_ES5.ts ===
|
||||
|
||||
var x = /\u{0000}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions03_ES6.ts]
|
||||
|
||||
var x = /\u{0000}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions03_ES6.js]
|
||||
var x = /\u{0000}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions03_ES6.ts ===
|
||||
|
||||
var x = /\u{0000}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions04_ES5.ts]
|
||||
|
||||
var x = /\u{00000000}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions04_ES5.js]
|
||||
var x = /\u{00000000}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions04_ES5.ts ===
|
||||
|
||||
var x = /\u{00000000}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions04_ES6.ts]
|
||||
|
||||
var x = /\u{00000000}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions04_ES6.js]
|
||||
var x = /\u{00000000}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions04_ES6.ts ===
|
||||
|
||||
var x = /\u{00000000}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions05_ES5.ts]
|
||||
|
||||
var x = /\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions05_ES5.js]
|
||||
var x = /\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions05_ES5.ts ===
|
||||
|
||||
var x = /\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions05_ES6.ts]
|
||||
|
||||
var x = /\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions05_ES6.js]
|
||||
var x = /\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions05_ES6.ts ===
|
||||
|
||||
var x = /\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions06_ES5.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{10FFFF}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions06_ES5.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{10FFFF}/g;
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions06_ES5.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{10FFFF}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions06_ES6.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{10FFFF}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions06_ES6.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{10FFFF}/g;
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions06_ES6.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{10FFFF}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions07_ES5.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{110000}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions07_ES5.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{110000}/g;
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions07_ES5.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{110000}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions07_ES6.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{110000}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions07_ES6.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{110000}/g;
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions07_ES6.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
|
||||
var x = /\u{110000}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions08_ES5.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (FFFF == 65535)
|
||||
var x = /\u{FFFF}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions08_ES5.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (FFFF == 65535)
|
||||
var x = /\u{FFFF}/g;
|
|
@ -0,0 +1,8 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions08_ES5.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (FFFF == 65535)
|
||||
var x = /\u{FFFF}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions08_ES6.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (FFFF == 65535)
|
||||
var x = /\u{FFFF}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions08_ES6.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (FFFF == 65535)
|
||||
var x = /\u{FFFF}/g;
|
|
@ -0,0 +1,8 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions08_ES6.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (FFFF == 65535)
|
||||
var x = /\u{FFFF}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions09_ES5.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (10000 == 65536)
|
||||
var x = /\u{10000}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions09_ES5.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (10000 == 65536)
|
||||
var x = /\u{10000}/g;
|
|
@ -0,0 +1,8 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions09_ES5.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (10000 == 65536)
|
||||
var x = /\u{10000}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions09_ES6.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (10000 == 65536)
|
||||
var x = /\u{10000}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions09_ES6.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (10000 == 65536)
|
||||
var x = /\u{10000}/g;
|
|
@ -0,0 +1,8 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions09_ES6.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. If cp ≤ 65535, return cp.
|
||||
// (10000 == 65536)
|
||||
var x = /\u{10000}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions10_ES5.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu1 be floor((cp – 65536) / 1024) + 0xD800.
|
||||
// Although we should just get back a single code point value of 0xD800,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{D800}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions10_ES5.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu1 be floor((cp – 65536) / 1024) + 0xD800.
|
||||
// Although we should just get back a single code point value of 0xD800,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{D800}/g;
|
|
@ -0,0 +1,9 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions10_ES5.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu1 be floor((cp – 65536) / 1024) + 0xD800.
|
||||
// Although we should just get back a single code point value of 0xD800,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{D800}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions10_ES6.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu1 be floor((cp – 65536) / 1024) + 0xD800.
|
||||
// Although we should just get back a single code point value of 0xD800,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{D800}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions10_ES6.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu1 be floor((cp – 65536) / 1024) + 0xD800.
|
||||
// Although we should just get back a single code point value of 0xD800,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{D800}/g;
|
|
@ -0,0 +1,9 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions10_ES6.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu1 be floor((cp – 65536) / 1024) + 0xD800.
|
||||
// Although we should just get back a single code point value of 0xD800,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{D800}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions11_ES5.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu2 be ((cp – 65536) modulo 1024) + 0xDC00.
|
||||
// Although we should just get back a single code point value of 0xDC00,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{DC00}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions11_ES5.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu2 be ((cp – 65536) modulo 1024) + 0xDC00.
|
||||
// Although we should just get back a single code point value of 0xDC00,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{DC00}/g;
|
|
@ -0,0 +1,9 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions11_ES5.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu2 be ((cp – 65536) modulo 1024) + 0xDC00.
|
||||
// Although we should just get back a single code point value of 0xDC00,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{DC00}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions11_ES6.ts]
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu2 be ((cp – 65536) modulo 1024) + 0xDC00.
|
||||
// Although we should just get back a single code point value of 0xDC00,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{DC00}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions11_ES6.js]
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu2 be ((cp – 65536) modulo 1024) + 0xDC00.
|
||||
// Although we should just get back a single code point value of 0xDC00,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{DC00}/g;
|
|
@ -0,0 +1,9 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions11_ES6.ts ===
|
||||
|
||||
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
|
||||
// 2. Let cu2 be ((cp – 65536) modulo 1024) + 0xDC00.
|
||||
// Although we should just get back a single code point value of 0xDC00,
|
||||
// this is a useful edge-case test.
|
||||
var x = /\u{DC00}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions12_ES5.ts]
|
||||
|
||||
var x = /\u{FFFFFFFF}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions12_ES5.js]
|
||||
var x = /\u{FFFFFFFF}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions12_ES5.ts ===
|
||||
|
||||
var x = /\u{FFFFFFFF}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions12_ES6.ts]
|
||||
|
||||
var x = /\u{FFFFFFFF}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions12_ES6.js]
|
||||
var x = /\u{FFFFFFFF}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions12_ES6.ts ===
|
||||
|
||||
var x = /\u{FFFFFFFF}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions13_ES5.ts]
|
||||
|
||||
var x = /\u{DDDDD}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions13_ES5.js]
|
||||
var x = /\u{DDDDD}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions13_ES5.ts ===
|
||||
|
||||
var x = /\u{DDDDD}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions13_ES6.ts]
|
||||
|
||||
var x = /\u{DDDDD}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions13_ES6.js]
|
||||
var x = /\u{DDDDD}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions13_ES6.ts ===
|
||||
|
||||
var x = /\u{DDDDD}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions14_ES5.ts]
|
||||
|
||||
// Shouldn't work, negatives are not allowed.
|
||||
var x = /\u{-DDDD}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions14_ES5.js]
|
||||
// Shouldn't work, negatives are not allowed.
|
||||
var x = /\u{-DDDD}/g;
|
|
@ -0,0 +1,6 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions14_ES5.ts ===
|
||||
|
||||
// Shouldn't work, negatives are not allowed.
|
||||
var x = /\u{-DDDD}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions14_ES6.ts]
|
||||
|
||||
// Shouldn't work, negatives are not allowed.
|
||||
var x = /\u{-DDDD}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions14_ES6.js]
|
||||
// Shouldn't work, negatives are not allowed.
|
||||
var x = /\u{-DDDD}/g;
|
|
@ -0,0 +1,6 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions14_ES6.ts ===
|
||||
|
||||
// Shouldn't work, negatives are not allowed.
|
||||
var x = /\u{-DDDD}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions15_ES5.ts]
|
||||
|
||||
var x = /\u{abcd}\u{ef12}\u{3456}\u{7890}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions15_ES5.js]
|
||||
var x = /\u{abcd}\u{ef12}\u{3456}\u{7890}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions15_ES5.ts ===
|
||||
|
||||
var x = /\u{abcd}\u{ef12}\u{3456}\u{7890}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions15_ES6.ts]
|
||||
|
||||
var x = /\u{abcd}\u{ef12}\u{3456}\u{7890}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions15_ES6.js]
|
||||
var x = /\u{abcd}\u{ef12}\u{3456}\u{7890}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions15_ES6.ts ===
|
||||
|
||||
var x = /\u{abcd}\u{ef12}\u{3456}\u{7890}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions16_ES5.ts]
|
||||
|
||||
var x = /\u{ABCD}\u{EF12}\u{3456}\u{7890}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions16_ES5.js]
|
||||
var x = /\u{ABCD}\u{EF12}\u{3456}\u{7890}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions16_ES5.ts ===
|
||||
|
||||
var x = /\u{ABCD}\u{EF12}\u{3456}\u{7890}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions16_ES6.ts]
|
||||
|
||||
var x = /\u{ABCD}\u{EF12}\u{3456}\u{7890}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions16_ES6.js]
|
||||
var x = /\u{ABCD}\u{EF12}\u{3456}\u{7890}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions16_ES6.ts ===
|
||||
|
||||
var x = /\u{ABCD}\u{EF12}\u{3456}\u{7890}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions17_ES5.ts]
|
||||
|
||||
var x = /\u{r}\u{n}\u{t}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions17_ES5.js]
|
||||
var x = /\u{r}\u{n}\u{t}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions17_ES5.ts ===
|
||||
|
||||
var x = /\u{r}\u{n}\u{t}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions17_ES6.ts]
|
||||
|
||||
var x = /\u{r}\u{n}\u{t}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions17_ES6.js]
|
||||
var x = /\u{r}\u{n}\u{t}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions17_ES6.ts ===
|
||||
|
||||
var x = /\u{r}\u{n}\u{t}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions18_ES5.ts]
|
||||
|
||||
var x = /\u{65}\u{65}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions18_ES5.js]
|
||||
var x = /\u{65}\u{65}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions18_ES5.ts ===
|
||||
|
||||
var x = /\u{65}\u{65}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions18_ES6.ts]
|
||||
|
||||
var x = /\u{65}\u{65}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions18_ES6.js]
|
||||
var x = /\u{65}\u{65}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions18_ES6.ts ===
|
||||
|
||||
var x = /\u{65}\u{65}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions19_ES5.ts]
|
||||
|
||||
var x = /\u{}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions19_ES5.js]
|
||||
var x = /\u{}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions19_ES5.ts ===
|
||||
|
||||
var x = /\u{}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInRegularExpressions19_ES6.ts]
|
||||
|
||||
var x = /\u{}/g;
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInRegularExpressions19_ES6.js]
|
||||
var x = /\u{}/g;
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInRegularExpressions19_ES6.ts ===
|
||||
|
||||
var x = /\u{}/g;
|
||||
>x : RegExp
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [unicodeExtendedEscapesInStrings01_ES5.ts]
|
||||
|
||||
var x = "\u{0}";
|
||||
|
||||
|
||||
//// [unicodeExtendedEscapesInStrings01_ES5.js]
|
||||
var x = "\0";
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue