PDA

View Full Version : [OPEN-538] fix inconsistent return points (patch included)



uwolfer
7 Feb 2010, 7:59 AM
The attached patch fixes some inconsistent return point issues. I have detected these issues with IntelliJ IDEA code inspection.

I have fixed these issues in a way which should make sense. In some case you might want to review / change documentation about @return.


fix-inconsistent-return-points.txt


fix inconsistent return points

---
src/core/Element.scroll-more.js | 2 +-
src/data/Tree.js | 1 +
src/state/Provider.js | 2 +-
src/widgets/BoxComponent.js | 4 ++--
src/widgets/Component.js | 2 +-
src/widgets/MessageBox.js | 2 +-
src/widgets/Panel.js | 4 ++--
7 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/core/Element.scroll-more.js b/src/core/Element.scroll-more.js
index 9c94bdd..051d733 100644
--- a/src/core/Element.scroll-more.js
+++ b/src/core/Element.scroll-more.js
@@ -86,7 +86,7 @@ Ext.Element.addMethods({
*/
scroll : function(direction, distance, animate){
if(!this.isScrollable()){
- return;
+ return false;
}
var el = this.dom,
l = el.scrollLeft, t = el.scrollTop,
diff --git a/src/data/Tree.js b/src/data/Tree.js
index f49b12d..55a9acb 100644
--- a/src/data/Tree.js
+++ b/src/data/Tree.js
@@ -412,6 +412,7 @@ Ext.extend(Ext.data.Node, Ext.util.Observable, {
}
return node;
}
+ return false;
},

/**
diff --git a/src/state/Provider.js b/src/state/Provider.js
index 9f936a3..e812e01 100644
--- a/src/state/Provider.js
+++ b/src/state/Provider.js
@@ -61,7 +61,7 @@ Ext.extend(Ext.state.Provider, Ext.util.Observable, {
decodeValue : function(cookie){
var re = /^(a|n|d|b|s|o)\:(.*)$/;
var matches = re.exec(unescape(cookie));
- if(!matches || !matches[1]) return; // non state cookie
+ if(!matches || !matches[1]) return null; // non state cookie
var type = matches[1];
var v = matches[2];
switch(type){
diff --git a/src/widgets/BoxComponent.js b/src/widgets/BoxComponent.js
index c6fd2f5..0ae64b3 100644
--- a/src/widgets/BoxComponent.js
+++ b/src/widgets/BoxComponent.js
@@ -497,10 +497,10 @@ var myPanel = new Ext.Panel({
this.pageX = x;
this.pageY = y;
if(!this.boxReady){
- return;
+ return null;
}
if(x === undefined || y === undefined){ // cannot translate undefined points
- return;
+ return null;
}
var p = this.getPositionEl().translatePoints(x, y);
this.setPosition(p.left, p.top);
diff --git a/src/widgets/Component.js b/src/widgets/Component.js
index 01b0042..e1b7730 100644
--- a/src/widgets/Component.js
+++ b/src/widgets/Component.js
@@ -1348,7 +1348,7 @@ new Ext.Panel({
focus : function(selectText, delay){
if(delay){
this.focus.defer(Ext.isNumber(delay) ? delay : 10, this, [selectText, false]);
- return;
+ return null;
}
if(this.rendered){
this.el.focus();
diff --git a/src/widgets/MessageBox.js b/src/widgets/MessageBox.js
index 7bf830c..5e77d7a 100644
--- a/src/widgets/MessageBox.js
+++ b/src/widgets/MessageBox.js
@@ -415,7 +415,7 @@ Ext.MessageBox.ERROR
setIcon : function(icon){
if(!dlg){
bufferIcon = icon;
- return;
+ return null;
}
bufferIcon = undefined;
if(icon && icon != ''){
diff --git a/src/widgets/Panel.js b/src/widgets/Panel.js
index dbef98a..65bf9e5 100644
--- a/src/widgets/Panel.js
+++ b/src/widgets/Panel.js
@@ -1346,7 +1346,7 @@ new Ext.Panel({
*/
collapse : function(animate){
if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){
- return;
+ return null;
}
var doAnim = animate === true || (animate !== false && this.animCollapse);
this.beforeEffect(doAnim);
@@ -1383,7 +1383,7 @@ new Ext.Panel({
*/
expand : function(animate){
if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){
- return;
+ return null;
}
var doAnim = animate === true || (animate !== false && this.animCollapse);
this.el.removeClass(this.collapsedCls);
--
1.6.6.1