Commit ff6f8ac1 authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Closure: use @closurePrimitive and move away from coding conventions

There are duplicate names in ChromeCodingConvention.java inside of
third_party/closure_compiler/compiler/compiler.jar that match assert,
assertNotReached, and cr.ui.decorate.

Recently, @closurePrimitive {...} was created in order to annotate
these methods instead of needing to duplicate their names in Java.

Use this syntax in Chrome while concurrently removing it from the
compiler's Java internally (eventually released externally).

R=dpapad@chromium.org
BUG=970885

Change-Id: I24f7bad0f52cf9c5af8984b9f8e4c063743c35e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729835
Commit-Queue: Dan Beam <dbeam@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682926}
parent 437ff4e7
......@@ -14,6 +14,7 @@
* to force a cast to Boolean.
* @param {string=} opt_message A message to show on failure.
* @return {T} A non-null |condition|.
* @closurePrimitive {asserts.truthy}
*/
/* #export */ function assert(condition, opt_message) {
if (!condition) {
......@@ -56,6 +57,7 @@
* unexpected input.
*
* @param {string=} opt_message A message to show when this is hit.
* @closurePrimitive {asserts.fail}
*/
/* #export */ function assertNotReached(opt_message) {
assert(false, opt_message || 'Unreachable code hit');
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
cr.define('cr.ui', function() {
/**
* Decorates elements as an instance of a class.
* @param {string|!Element} source The way to find the element(s) to decorate.
......@@ -11,6 +10,7 @@ cr.define('cr.ui', function() {
* elements to decorate.
* @param {!Function} constr The constructor to decorate with. The constr
* needs to have a {@code decorate} function.
* @closurePrimitive {asserts.matchesReturn}
*/
function decorate(source, constr) {
let elements;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment