mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Address more suggestions and bugs from @rlim's code review.
This commit is contained in:
1 parent
1c52d2eeaf
commit
91487e3a6a
2 files changed
+42
-43
No files matched your search
@@ -189,21 +189,23 @@ define(function (require, exports, module) {
|
||||
}
|
||||
}
|
||||
|
||||
obj2.forEach(function (token) { addToObj(obj1, token); });
|
||||
obj2.forEach(function (token) {
|
||||
addToObj(obj1, token);
|
||||
});
|
||||
}
|
||||
|
||||
var stateMap = getFileState(dir),
|
||||
propobj = merge(stateMap, "properties", addPropObjs),
|
||||
proplist = [],
|
||||
propname;
|
||||
propObj = merge(stateMap, "properties", addPropObjs),
|
||||
propList = [],
|
||||
propName;
|
||||
|
||||
for (propname in propobj) {
|
||||
if (Object.prototype.hasOwnProperty.call(propobj, propname)) {
|
||||
proplist.push(propobj[propname]);
|
||||
for (propName in propObj) {
|
||||
if (Object.prototype.hasOwnProperty.call(propObj, propName)) {
|
||||
propList.push(propObj[propName]);
|
||||
}
|
||||
}
|
||||
|
||||
return proplist;
|
||||
return propList;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -463,24 +465,24 @@ define(function (require, exports, module) {
|
||||
// relocate scope information on file rename
|
||||
$(DocumentManager)
|
||||
.on(HintUtils.eventName("fileNameChange"),
|
||||
function (event, oldname, newname) {
|
||||
var oldsplit = HintUtils.splitPath(oldname),
|
||||
olddir = oldsplit.dir,
|
||||
oldfile = oldsplit.file,
|
||||
newsplit = HintUtils.splitPath(newname),
|
||||
newdir = newsplit.dir,
|
||||
newfile = newsplit.file;
|
||||
function (event, oldName, newName) {
|
||||
var oldSplit = HintUtils.splitPath(oldName),
|
||||
oldDir = oldSplit.dir,
|
||||
oldFile = oldSplit.file,
|
||||
newSplit = HintUtils.splitPath(newName),
|
||||
newDir = newSplit.dir,
|
||||
newFile = newSplit.file;
|
||||
|
||||
/*
|
||||
* Move property obj[olddir][oldfile] to obj[newdir][newfile]
|
||||
*/
|
||||
function moveProp(obj) {
|
||||
if (obj.hasOwnProperty(olddir) && obj[olddir].hasOwnProperty(oldfile)) {
|
||||
if (!obj.hasOwnProperty(newdir)) {
|
||||
obj[newdir] = {};
|
||||
if (obj.hasOwnProperty(oldDir) && obj[oldDir].hasOwnProperty(oldFile)) {
|
||||
if (!obj.hasOwnProperty(newDir)) {
|
||||
obj[newDir] = {};
|
||||
}
|
||||
obj[newdir][newfile] = obj[olddir][oldfile];
|
||||
delete obj[olddir][oldfile];
|
||||
obj[newDir][newFile] = obj[oldDir][oldFile];
|
||||
delete obj[oldDir][oldFile];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ function require(url) {
|
||||
HintUtils = require("HintUtils.js"),
|
||||
esprima = require("thirdparty/esprima/esprima.js");
|
||||
|
||||
var MAX_RETRIES = 100;
|
||||
var MAX_RETRIES = 10;
|
||||
|
||||
function _log(msg) {
|
||||
self.postMessage({log: msg });
|
||||
@@ -135,30 +135,27 @@ function require(url) {
|
||||
|
||||
if (comments) {
|
||||
comments.forEach(function (c) {
|
||||
if (c.type === "Block") {
|
||||
if (c.value) {
|
||||
if (c.value.indexOf("global") === 0) {
|
||||
c.value.substring(7).split(",").forEach(function (g) {
|
||||
var index = g.indexOf(":");
|
||||
if (c.type === "Block" && c.value) {
|
||||
if (c.value.indexOf("global") === 0) {
|
||||
c.value.substring(7).split(",").forEach(function (g) {
|
||||
var index = g.indexOf(":");
|
||||
|
||||
if (index >= 0) {
|
||||
g = g.substring(0, index);
|
||||
}
|
||||
globals.push(HintUtils.makeToken(g.trim()));
|
||||
});
|
||||
} else if (c.value.indexOf("jslint") === 0) {
|
||||
c.value.substring(7).split(",").forEach(function (e) {
|
||||
var index = e.indexOf(":"),
|
||||
prop = (index >= 0) ? e.substring(0, index).trim() : "",
|
||||
val = (index >= 0) ? e.substring(index + 1, e.length).trim() : "";
|
||||
if (index >= 0) {
|
||||
g = g.substring(0, index);
|
||||
}
|
||||
globals.push(HintUtils.makeToken(g.trim()));
|
||||
});
|
||||
} else if (c.value.indexOf("jslint") === 0) {
|
||||
c.value.substring(7).split(",").forEach(function (e) {
|
||||
var index = e.indexOf(":"),
|
||||
prop = (index >= 0) ? e.substring(0, index).trim() : "",
|
||||
val = (index >= 0) ? e.substring(index + 1, e.length).trim() : "";
|
||||
|
||||
if (val === "true" && HintUtils.JSL_GLOBAL_DEFS.hasOwnProperty(prop)) {
|
||||
globals = globals.concat(HintUtils.JSL_GLOBAL_DEFS[prop]);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (val === "true" && HintUtils.JSL_GLOBAL_DEFS.hasOwnProperty(prop)) {
|
||||
globals = globals.concat(HintUtils.JSL_GLOBAL_DEFS[prop]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -242,7 +239,7 @@ function require(url) {
|
||||
removed = lines.splice(lineno, 1, newline);
|
||||
if (removed && removed.length > 0) {
|
||||
setTimeout(function () {
|
||||
parse(dir, file, text.length, lines.join("\n"), --retries);
|
||||
parse(dir, file, lines.join("\n"), --retries);
|
||||
}, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user