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

Side by Side Diff: ui/webui/resources/js/assert.js

Issue 443553002: Typecheck chrome://help using CompilerPass.java, everything except dependency to options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: rebase to master, compile everything but dependency to options Created 6 years, 4 months 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium 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 /** 5 /**
6 * @fileoverview Assertion support. 6 * @fileoverview Assertion support.
7 */ 7 */
8 8
9 /** 9 /**
10 * Simple common assertion API 10 * Simple common assertion API
(...skipping 29 matching lines...) Expand all
40 * } 40 * }
41 * 41 *
42 * This code should only be hit in the case of serious programmer error or 42 * This code should only be hit in the case of serious programmer error or
43 * unexpected input. 43 * unexpected input.
44 * 44 *
45 * @param {string=} opt_message A message to show when this is hit. 45 * @param {string=} opt_message A message to show when this is hit.
46 */ 46 */
47 function assertNotReached(opt_message) { 47 function assertNotReached(opt_message) {
48 throw new Error(opt_message || "Unreachable code hit"); 48 throw new Error(opt_message || "Unreachable code hit");
49 } 49 }
50
51 /**
52 * @param {*} value The value to check.
53 * @param {function(new: T, ...)} type A user-defined constructor.
54 * @return {!T}
55 * @template T
56 */
57 function assertInstanceof(value, type) {
58 if (!(value instanceof type)) {
Dan Beam 2014/08/13 22:20:08 nit: no curlies
Vitaly Pavlenko 2014/08/14 00:01:02 Done.
59 throw new Error('assertInstanceof');
Dan Beam 2014/08/13 22:20:07 throw new Error(value + ' is not a[n] ' + (type.na
Vitaly Pavlenko 2014/08/14 00:01:02 Done.
60 }
61 return value;
62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698