code stringlengths 1 2.08M | language stringclasses 1
value |
|---|---|
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2012 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2012 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2012 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2012 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2012 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2012 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | JavaScript |
// Example 1. Writing an iterator over an array
function iterateElements(array) {
return {
__iterator__: function() {
var index = 0;
var current;
return {
get current() {
return current;
},
moveNext: function() {
if (index < array.length) {
... | JavaScript |
module a from 'test_a.js';
module b from 'test_b.js';
module c from 'test_c.js';
export {name: a} from a;
export {name: b} from b;
export {name: c} from c;
export var name = 'test';
| JavaScript |
export var name = 'A';
| JavaScript |
module c from 'test_c.js';
export var name = 'B';
| JavaScript |
export var name = 'C';
| JavaScript |
export var name = 'E';
| JavaScript |
export module e from 'test_e.js';
export var name = 'D';
| JavaScript |
var fs = require('fs');
var path = require('path');
/**
* Reads a script and eval's it into the global scope.
* TODO: this is needed for now because of how our scripts are designed.
* Change this once we have a module system.
* @param {string} filename
*/
function importScript(filename) {
// TODO(rnystrom): Hac... | JavaScript |
// Should not compile.
// Options: --arrowFunctions=false
var identity = (x) -> x;
| JavaScript |
// Skip. Not implemented.
// TODO: needs the intialiser shorthand implemented for arrow functions
// Object intialiser shorthand: "method" = function-valued property with dynamic ''this''
const obj = {
method() -> {
return => this;
}
};
assert(obj.method() === obj);
assert(obj.method.call(u) === u);
// Name... | JavaScript |
// These tests are from:
// http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax
let empty = () => undefined;
assertEquals(empty(), undefined);
// Expression bodies needs no parentheses or braces
let identity = (x) => x;
assertEquals(identity(empty), empty);
// Object literals needs to be wrapped in... | JavaScript |
// Should not compile.
var identity = (identityParam) -> missingIdentifier;
| JavaScript |
var identity = (identityParam) => identityParam;
assertEquals(1234, identity(1234));
| JavaScript |
// Skip. Not implemented.
// TODO: needs # prefix implemented for freezing
// Use # to freeze and join to nearest relevant closure
function return_pure() {
return #(a) -> a * a;
}
let p = return_pure(),
q = return_pure();
assert(p === q);
function check_frozen(o) {
try {
o.x = "expando";
assert(! "re... | JavaScript |
// These tests are from:
// http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax
const obj = {
method: function () {
return () => this;
}
};
assertEquals(obj.method()(), obj);
let fake = {steal: obj.method()};
assertEquals(fake.steal(), obj);
let real = {borrow: obj.method};
assertEquals(rea... | JavaScript |
// Should not compile.
// Error: (6, 17): ')' expected
// Error: (6, 19): '=>' expected
{
let f = (...xs, x) => xs;
} | JavaScript |
// Skip. Not implemented.
// TODO: needs soft bind and ??= implemented
// A special form based on the default operator proposal
const self_default_bound = (this ??= self, a, b) -> {
this.c = a * b;
}
self_default_bound(6, 7);
assert(self.c === 42);
self_default_bound.call(other, 8, 9);
assert(other.c === 72);
asse... | JavaScript |
// Should not compile.
// Error: primary expression expected
{
let f = (x, ...xs);
} | JavaScript |
// Should not compile.
// Error: (4, 20): Semi-colon expected
var f = (a, b + 5) => a + b;
| JavaScript |
// Should not compile.
// Options: --concise-body=false
// Error: (6, 7): '{' expected
var object = {
m() 1
get x() 1,
set y(value) void 0
};
| JavaScript |
var object = {
set x(value) this._x = value,
set y(value) this._y = value
set z(value) this._z = value
};
object.x = 1;
object.y = 2;
object.z = 3;
assertEquals(1, object._x);
assertEquals(2, object._y);
assertEquals(3, object._z);
| JavaScript |
var object = {
get x() 1,
get y() 2
get z() 3
};
assertEquals(1, object.x);
assertEquals(2, object.y);
assertEquals(3, object.z);
| JavaScript |
var object = {
m() 'm',
n(x) x
o(y) y
};
assertEquals('m', object.m());
assertEquals(42, object.n(42));
assertEquals(43, object.o(43));
| JavaScript |
assertTrue('Hello World!'.contains('or'));
assertFalse('Hello World!'.contains('and'));
assertTrue('Hello World!'.contains(''));
| JavaScript |
assertTrue('Hello World!'.startsWith('Hello '));
assertFalse('Hello World!'.startsWith('World!'));
assertTrue('Hello World!'.startsWith(''));
assertFalse('Hello World!'.startsWith('h'));
| JavaScript |
assertArrayEquals('Cats'.toArray(), ['C', 'a', 't', 's']);
assertArrayEquals(''.toArray(), []);
| JavaScript |
assertTrue('Hello World!'.endsWith('World!'));
assertFalse('Hello World!'.endsWith('Hello'));
assertFalse('Hello World'.endsWith('D'));
assertTrue('Hello World!'.endsWith(''));
| JavaScript |
import Name from '@name';
var n = new Name;
var object = {};
object[n] = 42;
assertEquals(42, object[n]);
assertUndefined(object[n.public]);
assertUndefined(object[n + '']);
assertArrayEquals([], Object.getOwnPropertyNames(object));
assertFalse(object.hasOwnProperty(n));
assertEquals(32, object[n] -= 10);
assertEquals... | JavaScript |
import Name from '@name';
var n = new Name;
var p = {};
Object.defineProperty(p, n, {
get: function() {
return 42;
},
configurable: true
});
var o = Object.create(p);
assertEquals(42, o[n]);
assertThrows(function() {
o[n] = 1;
});
var val;
Object.defineProperty(p, n, {
set: function(v) {
val = v;
... | JavaScript |
function assertFrozen(obj) {
assertTrue(Object.isFrozen(obj));
}
function assertNameFrozen(n) {
[
n,
n.toString,
n.toString.prototype,
n.public,
n.public.toString,
n.public.toString.prototype
].forEach(assertFrozen);
}
import {Name, isName} from '@name';
var n = new Name;
assertTrue(isN... | JavaScript |
// Should not compile.
var object = {
"notNamedField"() {
return notNamedField;
}
};
| JavaScript |
// Should not compile.
// Options: --propertyMethods=false
var object = {
method() {
return 42;
}
};
| JavaScript |
var object = {
x: {
j() {
return j;
}
},
f() {
return f;
},
'g'() {},
"h"() {},
42() {},
null() {},
true() {},
false() {},
function() {},
var() {},
'class'() {} // NodeJS incorrectly flags {class: ...} as an error.
};
// -----------------------------------------------------... | JavaScript |
// Should not compile.
// Options: --quasi=false
`abc`;
| JavaScript |
// Should not compile.
function f() {}
f `no whitespace allowed between the identifier and the \``
| JavaScript |
// Should not compile.
function f() {}
f`a${ `
| JavaScript |
// Should not compile.
function f() {}
f`a${ }`
| JavaScript |
assertEquals('a', `a`);
assertEquals('"', `"`);
assertEquals("'", `'`);
assertEquals("`", `\``);
assertEquals('"', `\"`);
assertEquals('\\"', `\\"`);
assertEquals('"\\', `"\\`);
assertEquals('\n', `\n`);
assertEquals('\r', `\r`);
assertEquals('\r\n', `\r\n`);
assertEquals('\t', `\t`);
assertEquals('\u2028', `\u2028`)... | JavaScript |
{
function expose(callSite, var_args) {
assertTrue(Object.isFrozen(callSite));
assertTrue(callSite.hasOwnProperty('raw'));
assertTrue(Object.isFrozen(callSite.raw));
assertTrue(callSite.hasOwnProperty('cooked'));
assertTrue(Object.isFrozen(callSite.cooked));
assertEquals(callSite.raw.length, c... | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.