From fb890b2c8a5e3f303bb587a4880c2da89d58a278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rg=20Lehni?= Date: Sun, 28 Dec 2014 18:03:19 +0100 Subject: [PATCH] Implement Symbol#equals() --- src/project/Symbol.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/project/Symbol.js b/src/project/Symbol.js index e4c806ff..a75f407a 100644 --- a/src/project/Symbol.js +++ b/src/project/Symbol.js @@ -147,5 +147,17 @@ var Symbol = Base.extend(/** @lends Symbol# */{ */ clone: function() { return new Symbol(this._definition.clone(false)); + }, + + /** + * Checks whether the symbol's definition is equal to the supplied symbol. + * + * @param {Symbol} symbol + * @return {Boolean} {@true if they are equal} + */ + equals: function(symbol) { + return symbol === this + || symbol && this.definition.equals(symbol.definition) + || false; } });