| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others |
| 2 | -// Distributed under an MIT license: https://codemirror.net/LICENSE | |
| 2 | +// Distributed under an MIT license: http://codemirror.net/LICENSE | |
| 3 | 3 | |
| 4 | 4 | (function() { |
| 5 | 5 | var mode = CodeMirror.getMode({indentUnit: 2}, "javascript"); |
| 6 | 6 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } |
| @@ -62,14 +62,8 @@ | ||
| 62 | 62 | |
| 63 | 63 | MT("import_trailing_comma", |
| 64 | 64 | "[keyword import] {[def foo], [def bar],} [keyword from] [string 'baz']") |
| 65 | 65 | |
| 66 | - MT("import_dynamic", | |
| 67 | - "[keyword import]([string 'baz']).[property then]") | |
| 68 | - | |
| 69 | - MT("import_dynamic", | |
| 70 | - "[keyword const] [def t] [operator =] [keyword import]([string 'baz']).[property then]") | |
| 71 | - | |
| 72 | 66 | MT("const", |
| 73 | 67 | "[keyword function] [def f]() {", |
| 74 | 68 | " [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];", |
| 75 | 69 | "}"); |
| @@ -76,11 +70,8 @@ | ||
| 76 | 70 | |
| 77 | 71 | MT("for/of", |
| 78 | 72 | "[keyword for]([keyword let] [def of] [keyword of] [variable something]) {}"); |
| 79 | 73 | |
| 80 | - MT("for await", | |
| 81 | - "[keyword for] [keyword await]([keyword let] [def of] [keyword of] [variable something]) {}"); | |
| 82 | - | |
| 83 | 74 | MT("generator", |
| 84 | 75 | "[keyword function*] [def repeat]([def n]) {", |
| 85 | 76 | " [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])", |
| 86 | 77 | " [keyword yield] [variable-2 i];", |
| @@ -85,37 +76,8 @@ | ||
| 85 | 76 | " [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])", |
| 86 | 77 | " [keyword yield] [variable-2 i];", |
| 87 | 78 | "}"); |
| 88 | 79 | |
| 89 | - MT("let_scoping", | |
| 90 | - "[keyword function] [def scoped]([def n]) {", | |
| 91 | - " { [keyword var] [def i]; } [variable-2 i];", | |
| 92 | - " { [keyword let] [def j]; [variable-2 j]; } [variable j];", | |
| 93 | - " [keyword if] ([atom true]) { [keyword const] [def k]; [variable-2 k]; } [variable k];", | |
| 94 | - "}"); | |
| 95 | - | |
| 96 | - MT("switch_scoping", | |
| 97 | - "[keyword switch] ([variable x]) {", | |
| 98 | - " [keyword default]:", | |
| 99 | - " [keyword let] [def j];", | |
| 100 | - " [keyword return] [variable-2 j]", | |
| 101 | - "}", | |
| 102 | - "[variable j];") | |
| 103 | - | |
| 104 | - MT("leaving_scope", | |
| 105 | - "[keyword function] [def a]() {", | |
| 106 | - " {", | |
| 107 | - " [keyword const] [def x] [operator =] [number 1]", | |
| 108 | - " [keyword if] ([atom true]) {", | |
| 109 | - " [keyword let] [def y] [operator =] [number 2]", | |
| 110 | - " [keyword var] [def z] [operator =] [number 3]", | |
| 111 | - " [variable console].[property log]([variable-2 x], [variable-2 y], [variable-2 z])", | |
| 112 | - " }", | |
| 113 | - " [variable console].[property log]([variable-2 x], [variable y], [variable-2 z])", | |
| 114 | - " }", | |
| 115 | - " [variable console].[property log]([variable x], [variable y], [variable-2 z])", | |
| 116 | - "}") | |
| 117 | - | |
| 118 | 80 | MT("quotedStringAddition", |
| 119 | 81 | "[keyword let] [def f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];"); |
| 120 | 82 | |
| 121 | 83 | MT("quotedFatArrow", |
| @@ -126,11 +88,8 @@ | ||
| 126 | 88 | "[variable a];", // No longer in scope |
| 127 | 89 | "[keyword let] [def f] [operator =] ([[ [def a], [def b] ]], [def c]) [operator =>] [variable-2 a] [operator +] [variable-2 c];", |
| 128 | 90 | "[variable c];"); |
| 129 | 91 | |
| 130 | - MT("fatArrow_stringDefault", | |
| 131 | - "([def a], [def b] [operator =] [string 'x\\'y']) [operator =>] [variable-2 a] [operator +] [variable-2 b]") | |
| 132 | - | |
| 133 | 92 | MT("spread", |
| 134 | 93 | "[keyword function] [def f]([def a], [meta ...][def b]) {", |
| 135 | 94 | " [variable something]([variable-2 a], [meta ...][variable-2 b]);", |
| 136 | 95 | "}"); |
| @@ -228,14 +187,8 @@ | ||
| 228 | 187 | "[keyword function] [def foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {", |
| 229 | 188 | " [keyword return] [variable-2 x];", |
| 230 | 189 | "}"); |
| 231 | 190 | |
| 232 | - MT( | |
| 233 | - "param_destructuring", | |
| 234 | - "[keyword function] [def foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {", | |
| 235 | - " [keyword return] [variable-2 x];", | |
| 236 | - "}"); | |
| 237 | - | |
| 238 | 191 | MT("new_target", |
| 239 | 192 | "[keyword function] [def F]([def target]) {", |
| 240 | 193 | " [keyword if] ([variable-2 target] [operator &&] [keyword new].[keyword target].[property name]) {", |
| 241 | 194 | " [keyword return] [keyword new]", |
| @@ -276,10 +229,8 @@ | ||
| 276 | 229 | MT("async_variable", |
| 277 | 230 | "[keyword const] [def async] [operator =] {[property a]: [number 1]};", |
| 278 | 231 | "[keyword const] [def foo] [operator =] [string-2 `bar ${][variable async].[property a][string-2 }`];") |
| 279 | 232 | |
| 280 | - MT("bigint", "[number 1n] [operator +] [number 0x1afn] [operator +] [number 0o064n] [operator +] [number 0b100n];") | |
| 281 | - | |
| 282 | 233 | MT("async_comment", |
| 283 | 234 | "[keyword async] [comment /**/] [keyword function] [def foo]([def args]) { [keyword return] [atom true]; }"); |
| 284 | 235 | |
| 285 | 236 | MT("indent_switch", |
| @@ -300,32 +251,8 @@ | ||
| 300 | 251 | MT("return_eol", |
| 301 | 252 | "[keyword return]", |
| 302 | 253 | "{} [string-2 /5/]") |
| 303 | 254 | |
| 304 | - MT("numeric separator", | |
| 305 | - "[number 123_456];", | |
| 306 | - "[number 0xdead_c0de];", | |
| 307 | - "[number 0o123_456];", | |
| 308 | - "[number 0b1101_1101];", | |
| 309 | - "[number .123_456e0_1];", | |
| 310 | - "[number 1E+123_456];", | |
| 311 | - "[number 12_34_56n];") | |
| 312 | - | |
| 313 | - MT("underscore property", | |
| 314 | - "[variable something].[property _property];", | |
| 315 | - "[variable something].[property _123];", | |
| 316 | - "[variable something].[property _for];", | |
| 317 | - "[variable _for];", | |
| 318 | - "[variable _123];") | |
| 319 | - | |
| 320 | - MT("private properties", | |
| 321 | - "[keyword class] [def C] {", | |
| 322 | - " [property #x] [operator =] [number 2];", | |
| 323 | - " [property #read]() {", | |
| 324 | - " [keyword return] [keyword this].[property #x]", | |
| 325 | - " }", | |
| 326 | - "}") | |
| 327 | - | |
| 328 | 255 | var ts_mode = CodeMirror.getMode({indentUnit: 2}, "application/typescript") |
| 329 | 256 | function TS(name) { |
| 330 | 257 | test.mode(name, ts_mode, Array.prototype.slice.call(arguments, 1)) |
| 331 | 258 | } |
| @@ -453,33 +380,8 @@ | ||
| 453 | 380 | " [keyword static] [property assertApple]([def fruit]: [type Fruit]): [variable-2 fruit] [keyword is] [type Apple] {", |
| 454 | 381 | " [keyword if] ([operator !]([variable-2 fruit] [keyword instanceof] [variable Apple]))", |
| 455 | 382 | " [keyword throw] [keyword new] [variable Error]();", |
| 456 | 383 | " }", |
| 457 | - "}") | |
| 458 | - | |
| 459 | - TS("type as variable", | |
| 460 | - "[variable type] [operator =] [variable x] [keyword as] [type Bar];"); | |
| 461 | - | |
| 462 | - TS("enum body", | |
| 463 | - "[keyword export] [keyword const] [keyword enum] [def CodeInspectionResultType] {", | |
| 464 | - " [def ERROR] [operator =] [string 'problem_type_error'],", | |
| 465 | - " [def WARNING] [operator =] [string 'problem_type_warning'],", | |
| 466 | - " [def META],", | |
| 467 | - "}") | |
| 468 | - | |
| 469 | - TS("parenthesized type", | |
| 470 | - "[keyword class] [def Foo] {", | |
| 471 | - " [property x] [operator =] [keyword new] [variable A][operator <][type B], [type string][operator |](() [operator =>] [type void])[operator >]();", | |
| 472 | - " [keyword private] [property bar]();", | |
| 473 | - "}") | |
| 474 | - | |
| 475 | - TS("abstract class", | |
| 476 | - "[keyword export] [keyword abstract] [keyword class] [def Foo] {}") | |
| 477 | - | |
| 478 | - TS("interface without semicolons", | |
| 479 | - "[keyword interface] [def Foo] {", | |
| 480 | - " [property greet]([def x]: [type int]): [type blah]", | |
| 481 | - " [property bar]: [type void]", | |
| 482 | 384 | "}") |
| 483 | 385 | |
| 484 | 386 | var jsonld_mode = CodeMirror.getMode( |
| 485 | 387 | {indentUnit: 2}, |