Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: test/mjsunit/harmony/super.js

Issue 766663003: harmony-classes: Implement 'super(...)' call syntactic restriction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Patch for landing Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Flags: --harmony-classes 5 // Flags: --harmony-classes
6 6
7 7
8 (function TestSuperNamedLoads() { 8 (function TestSuperNamedLoads() {
9 function Base() { } 9 function Base() { }
10 function Derived() { 10 function Derived() {
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 // we throw TypeError. 1854 // we throw TypeError.
1855 // Filed https://bugs.ecmascript.org/show_bug.cgi?id=3282 1855 // Filed https://bugs.ecmascript.org/show_bug.cgi?id=3282
1856 assertThrows(function() { new T(); }, TypeError); 1856 assertThrows(function() { new T(); }, TypeError);
1857 1857
1858 function T1() { 1858 function T1() {
1859 var b = new super(); 1859 var b = new super();
1860 } 1860 }
1861 T1.__proto = null; 1861 T1.__proto = null;
1862 assertThrows(function() { new T1(); }, TypeError); 1862 assertThrows(function() { new T1(); }, TypeError);
1863 }()); 1863 }());
1864
1865
1866 (function TestSuperCallSyntacticRestriction() {
1867 assertThrows(function() {
1868 function C() {
1869 var y;
1870 super();
1871 }
1872 new C();
1873 }, TypeError);
1874 assertThrows(function() {
1875 function C() {
1876 super(this.x);
1877 }
1878 new C();
1879 }, TypeError);
1880 assertThrows(function() {
1881 function C() {
1882 super(this);
1883 }
1884 new C();
1885 }, TypeError);
1886 assertThrows(function() {
1887 function C() {
1888 super(1, 2, Object.getPrototypeOf(this));
1889 }
1890 new C();
1891 }, TypeError);
1892 assertThrows(function() {
1893 function C() {
1894 { super(1, 2); }
1895 }; new C();
1896 }, TypeError);
1897 assertThrows(function() {
1898 function C() {
1899 if (1) super();
1900 }; new C();
1901 }, TypeError);
1902
1903 function C1() {
1904 'use strict';
1905 super();
1906 };
1907 new C1();
1908
1909 function C2() {
1910 ; 'use strict';;;;;
1911 super();
1912 };
1913 new C2();
1914
1915 function C3() {
1916 ; 'use strict';;;;;
1917 // This is a comment.
1918 super();
1919 }
1920 new C3();
1921 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698