Merge pull request +15422 from c9/pull/core/427

Pull/core/427
pull/428/head
Harutyun Amirjanyan 2017-05-24 16:26:11 +04:00 zatwierdzone przez GitHub
commit c69358c651
16 zmienionych plików z 33 dodań i 61 usunięć

Wyświetl plik

@ -471,7 +471,7 @@ define(function(require, exports, module) {
function getNumber(query) { function getNumber(query) {
var double = get(query); var double = get(query);
return parseFloat(double, 10); return parseFloat(double);
} }
function getNode(query) { function getNode(query) {

Wyświetl plik

@ -98,9 +98,7 @@ define(function(require, exports, module) {
if (accessInfo.private && (!accessInfo.member || accessInfo.pending)) if (accessInfo.private && (!accessInfo.member || accessInfo.pending))
return console.warn("Don't have read access - You can't use chat"); return console.warn("Don't have read access - You can't use chat");
var chatHistory = workspace.chatHistory || []; var chatHistory = workspace.chatHistory || [];
chatHistory.forEach(function(msg) { chatHistory.forEach(addMessage);
addMessage(msg, msg.increment);
});
scrollDown(); scrollDown();
chatCounter.innerHTML = chatHistory.length; chatCounter.innerHTML = chatHistory.length;
} }
@ -402,4 +400,4 @@ define(function(require, exports, module) {
}); });
} }
}); });

Wyświetl plik

@ -49,7 +49,7 @@ function IndexCache(doc) {
if (check) { if (check) {
var slowPos = doc.indexToPositionSlow(index); var slowPos = doc.indexToPositionSlow(index);
if (slowPos.row !== pos.row && slowPos.column !== slowPos.column) if (slowPos.row !== pos.row && slowPos.column !== pos.column)
reportError("Inconsistency in indexToPosition"); reportError("Inconsistency in indexToPosition");
return slowPos; return slowPos;
} }

Wyświetl plik

@ -826,9 +826,9 @@ function endTime(t, message, indent) {
var posInPart = syntaxDetector.posToRegion(part.region, pos); var posInPart = syntaxDetector.posToRegion(part.region, pos);
this.parse(part, function(ast) { this.parse(part, function(ast) {
if (!ast) if (!ast)
return callHandlers(ast, null, posInPart); return callHandlers(ast, null);
_self.findNode(ast, pos, function(currentNode) { _self.findNode(ast, pos, function(currentNode) {
callHandlers(ast, currentNode, posInPart); callHandlers(ast, currentNode);
}); });
}, true, true); }, true, true);
@ -1932,4 +1932,4 @@ function endTime(t, message, indent) {
}).call(LanguageWorker.prototype); }).call(LanguageWorker.prototype);
}); });

Wyświetl plik

@ -51,8 +51,6 @@ completer.complete = function(doc, fullAst, pos, options, callback) {
return null; return null;
var iconMap = { var iconMap = {
"variable": "property", "variable": "property",
"constant": "property",
"function": "method",
"type": "property2", "type": "property2",
"constant": "method2", "constant": "method2",
"color": "method2", "color": "method2",

Wyświetl plik

@ -89,7 +89,7 @@ define(function(require, exports, module) {
if (newAST[j].cons !== "Var") if (newAST[j].cons !== "Var")
return false; return false;
// Var(x) was just inserted // Var(x) was just inserted
copyAnnos(findScopeNode(oldAST), newAST[j], dryRun); copyAnnos(findScopeNode(oldAST), newAST[j]);
if (!newAST[j].annos) if (!newAST[j].annos)
return false; return false;
continue; continue;
@ -97,17 +97,17 @@ define(function(require, exports, module) {
if (oldAST[i].cons !== newAST[j].cons) { if (oldAST[i].cons !== newAST[j].cons) {
// Var(x) became PropAccess(Var(x), y) // Var(x) became PropAccess(Var(x), y)
if (oldAST[i].cons === "Var" && newAST[j].isMatch("PropAccess(Var(_),_)")) { if (oldAST[i].cons === "Var" && newAST[j].isMatch("PropAccess(Var(_),_)")) {
copyAnnos(oldAST[i], newAST[j][0], dryRun); copyAnnos(oldAST[i], newAST[j][0]);
continue; continue;
} }
// PropAccess(Var(x), y) became Var(x) // PropAccess(Var(x), y) became Var(x)
if (newAST[j].cons === "Var" && oldAST[i].isMatch("PropAccess(Var(_),_)")) { if (newAST[j].cons === "Var" && oldAST[i].isMatch("PropAccess(Var(_),_)")) {
copyAnnos(oldAST[i][0], newAST[j], dryRun); copyAnnos(oldAST[i][0], newAST[j]);
continue; continue;
} }
// PropAccess became Call(PropAccess, _) // PropAccess became Call(PropAccess, _)
if (oldAST[i].isMatch("PropAccess(Var(_),_)") && newAST[j].isMatch("Call(PropAccess(Var(_),_),_)")) { if (oldAST[i].isMatch("PropAccess(Var(_),_)") && newAST[j].isMatch("Call(PropAccess(Var(_),_),_)")) {
copyAnnos(oldAST[i][0], newAST[j][0][0], dryRun); copyAnnos(oldAST[i][0], newAST[j][0][0]);
var oldTemplate = new tree.ListNode([oldAST[i][0]]); var oldTemplate = new tree.ListNode([oldAST[i][0]]);
oldTemplate.parent = oldAST; oldTemplate.parent = oldAST;
copyAnnosTop(oldTemplate, newAST[j][1], dryRun); copyAnnosTop(oldTemplate, newAST[j][1], dryRun);
@ -115,12 +115,12 @@ define(function(require, exports, module) {
} }
// Call(PropAccess, _) became PropAccess // Call(PropAccess, _) became PropAccess
if (newAST[j].isMatch("PropAccess(Var(_),_)") && oldAST[i].isMatch("Call(PropAccess(Var(_),_),_)")) { if (newAST[j].isMatch("PropAccess(Var(_),_)") && oldAST[i].isMatch("Call(PropAccess(Var(_),_),_)")) {
copyAnnos(oldAST[i][0][0], newAST[j][0], dryRun); copyAnnos(oldAST[i][0][0], newAST[j][0]);
continue; continue;
} }
// Var(x) was (possibly) inserted // Var(x) was (possibly) inserted
if (newAST[j].cons === "Var" && newAST[j + 1] && newAST[j + 1].cons === oldAST[i].cons) { if (newAST[j].cons === "Var" && newAST[j + 1] && newAST[j + 1].cons === oldAST[i].cons) {
copyAnnos(findScopeNode(oldAST), newAST[j], dryRun); copyAnnos(findScopeNode(oldAST), newAST[j]);
if (!newAST[j].annos) if (!newAST[j].annos)
return false; return false;
i--; i--;
@ -128,7 +128,7 @@ define(function(require, exports, module) {
} }
// Var(x) was (possibly) added // Var(x) was (possibly) added
if (oldAST[i].cons === "None" && newAST[j].cons === "Var") { if (oldAST[i].cons === "None" && newAST[j].cons === "Var") {
copyAnnos(findScopeNode(oldAST), newAST[j], dryRun); copyAnnos(findScopeNode(oldAST), newAST[j]);
if (!newAST[j].annos) if (!newAST[j].annos)
return false; return false;
i--; i--;
@ -143,7 +143,7 @@ define(function(require, exports, module) {
if (["If", "Return", "Throw"].indexOf(newAST[j].cons) > -1 && (!newAST[j][1] || newAST[j][1].isMatch("Block([])"))) { if (["If", "Return", "Throw"].indexOf(newAST[j].cons) > -1 && (!newAST[j][1] || newAST[j][1].isMatch("Block([])"))) {
var cond = newAST[j][0].toString(); var cond = newAST[j][0].toString();
if (cond === oldAST[i].toString()) { if (cond === oldAST[i].toString()) {
copyAnnos(oldAST[i], newAST[j][0], dryRun); copyAnnos(oldAST[i], newAST[j][0]);
continue; continue;
} }
else if (!oldAST[i + 1]) { else if (!oldAST[i + 1]) {
@ -151,7 +151,7 @@ define(function(require, exports, module) {
} }
else if (cond === oldAST[i + 1].toString()) { else if (cond === oldAST[i + 1].toString()) {
i++; i++;
copyAnnos(oldAST[i], newAST[j][0], dryRun); copyAnnos(oldAST[i], newAST[j][0]);
continue; continue;
} }
} }
@ -161,10 +161,10 @@ define(function(require, exports, module) {
var newCond = newAST[0]; var newCond = newAST[0];
var newBody = newAST[1]; var newBody = newAST[1];
if (oldCond.toString() === newBody.toString()) { if (oldCond.toString() === newBody.toString()) {
copyAnnos(findScopeNode(oldAST), newCond, dryRun); copyAnnos(findScopeNode(oldAST), newCond);
if (!newCond.annos) if (!newCond.annos)
return false; return false;
copyAnnos(oldCond, newBody, dryRun); copyAnnos(oldCond, newBody);
continue; continue;
} }
} }
@ -234,4 +234,4 @@ define(function(require, exports, module) {
} }
}); });

Wyświetl plik

@ -164,7 +164,7 @@ function extractProperty(item, results, isConstructor) {
} }
function extractSignature(item, signature, result) { function extractSignature(item, signature, result) {
var returns = extractType(signature.returns ? signature.returns[0].type : null, true); var returns = extractType(signature.returns ? signature.returns[0].type : null);
if (item.type === "class property") { if (item.type === "class property") {
result.properties.___proto__ = returns; result.properties.___proto__ = returns;
@ -191,7 +191,7 @@ function extractSignatureArgs(signature, results) {
var argFargs = arg.args && extractSignatureArgs(arg, []); var argFargs = arg.args && extractSignatureArgs(arg, []);
results.push({ results.push({
id: arg.name, id: arg.name,
type: extractType(arg.type, true), type: extractType(arg.type),
doc: arg.description, doc: arg.description,
opt: arg.optional, opt: arg.optional,
fargs: argFargs fargs: argFargs

Wyświetl plik

@ -392,7 +392,7 @@ define(function(require, exports, module) {
tries.push(Date.now()); tries.push(Date.now());
var trySeriesStart = tries[tries.length - 1 - maxTrySeriesLength]; var trySeriesStart = tries[tries.length - 1 - maxTrySeriesLength];
if (!trySeriesStart || trySeriesStart < Date.now() - maxTrySeriesTime) if (!trySeriesStart || trySeriesStart < Date.now() - maxTrySeriesTime)
return setupCall(value); return setupCall();
var err = new Error("Too many disconnects. Server crashing?"); var err = new Error("Too many disconnects. Server crashing?");
err.code = "EFATAL"; err.code = "EFATAL";

Wyświetl plik

@ -30,7 +30,7 @@ handler.init = function(options, callback) {
}; };
handler.invoke = function(path, doc, ast, options, callback) { handler.invoke = function(path, doc, ast, options, callback) {
options.mode == options.mode || "stdin"; options.mode = options.mode || "stdin";
if (options.overrideLine != null) { if (options.overrideLine != null) {
var lines = doc.toString().split(/\r\n|\n|\r/); var lines = doc.toString().split(/\r\n|\n|\r/);
if (lines[options.overrideLineRow] !== options.overrideLine) { if (lines[options.overrideLineRow] !== options.overrideLine) {

Wyświetl plik

@ -115,7 +115,7 @@ function GitGraph(editor) {
var p = d.parent2; var p = d.parent2;
var k = 0; var k = 0;
for (var j = 0; k < p.length; j++) { for (var j = 0; k < p.length; j++) {
while (k <= p.length) { while (k < p.length) {
var parent = p[k]; var parent = p[k];
if (parent) { if (parent) {
if (parent.row - d.row < MAX_GAP) { if (parent.row - d.row < MAX_GAP) {

Wyświetl plik

@ -94,7 +94,7 @@ define(function(require, exports, module) {
menuPath = new Menu({ menuPath = new Menu({
items: menuItems, items: menuItems,
onitemclick: function(e) { onitemclick: function(e) {
var info = buildPath(lastLink, true); var info = buildPath(lastLink);
if (e.value == "open") if (e.value == "open")
open(lastLink); open(lastLink);

Wyświetl plik

@ -638,7 +638,7 @@ define(function(require, exports, module) {
*/ */
CursorLeftCommand.tryCreate = function(inputText) { CursorLeftCommand.tryCreate = function(inputText) {
if (inputText === INPUT_LEFT) if (inputText === INPUT_LEFT)
return new CursorLeftCommand(inputText); return new CursorLeftCommand();
}; };
function CursorLeftCommand() { function CursorLeftCommand() {
var noChange = false; var noChange = false;
@ -680,7 +680,7 @@ define(function(require, exports, module) {
if (INPUTS_HOME.indexOf(inputText) > -1 if (INPUTS_HOME.indexOf(inputText) > -1
// Only attempt home if we'd jump to the start of a prompt // Only attempt home if we'd jump to the start of a prompt
&& (peek(-predictIndex - 1) === "$" || peek(-predictIndex - 2) === "$")) && (peek(-predictIndex - 1) === "$" || peek(-predictIndex - 2) === "$"))
return new HomeCommand(inputText); return new HomeCommand();
}; };
function HomeCommand() { function HomeCommand() {
var oldIndex; var oldIndex;
@ -762,4 +762,4 @@ define(function(require, exports, module) {
register(null, { "terminal.predict_echo": plugin }); register(null, { "terminal.predict_echo": plugin });
} }
}); });

Wyświetl plik

@ -1533,7 +1533,7 @@ define(function(require, exports, module) {
function findSnapPos(pos, dir, side) { function findSnapPos(pos, dir, side) {
var snapPos = margin[dir === "v" ? 0 : 3]; var snapPos = margin[dir === "v" ? 0 : 3];
var rows = sizes[dir]; var rows = sizes[dir];
for (var i = 0; i <= rows.length; i++) { for (var i = 0; i < rows.length; i++) {
if (side > 0 && i > 1) if (side > 0 && i > 1)
snapPos += padding; snapPos += padding;
if (Math.abs(pos - snapPos) < SNAP_DIST) if (Math.abs(pos - snapPos) < SNAP_DIST)

Wyświetl plik

@ -1811,25 +1811,6 @@ defineProp(Array.prototype, "pushUnique", function(){
return this; return this;
}); });
/*
* @todo: Ruben: could you please comment on this function? Seems to serve a very
* specific purpose...
*
* I also could not find an occurrence in our codebase.
*/
defineProp(Array.prototype, "search", function(){
for (var i = 0, length = arguments.length; i < length; i++) {
if (typeof this[i] != "array")
continue;
for (var j = 0; j < length; j++) {
if (this[i][j] != arguments[j])
break;
else if (j == (length - 1))
return this[i];
}
}
});
/* /*
* Iterate through each value of an array instance from left to right (front to * Iterate through each value of an array instance from left to right (front to
* back) and execute a callback Function for each value. * back) and execute a callback Function for each value.
@ -3725,8 +3706,7 @@ apf.setNodeValue = function(xmlNode, nodeValue) {
} }
else { else {
var oldValue = xmlNode.nodeValue; var oldValue = xmlNode.nodeValue;
xmlNode.nodeValue = nodeValue === undefined || nodeValue === null || xmlNode.nodeValue = nodeValue == null ? "" : String(nodeValue);
nodeValue == NaN ? "" : String(nodeValue);
//AML support - getters/setters would be awesome //AML support - getters/setters would be awesome
if (xmlNode.$triggerUpdate) if (xmlNode.$triggerUpdate)
@ -3953,9 +3933,6 @@ apf.extend(apf.config, {
debug: false, debug: false,
disableSpace: true,
allowSelect: false,
allowBlur: true,
// initdelay: false, // initdelay: false,
@ -20836,7 +20813,7 @@ apf.textbox.masking = function(){
"107": "+", "107": "+",
"109": "-", "109": "-",
"110": ".", "110": ".",
"110": "/" "111": "/"
}; };
this.addEventListener("keydown", function(e) { this.addEventListener("keydown", function(e) {

Wyświetl plik

@ -82,7 +82,6 @@ define(function(require, exports, module) {
scrollbarVisibilityChanged: acetree.renderer, scrollbarVisibilityChanged: acetree.renderer,
afterRender: acetree.renderer, afterRender: acetree.renderer,
resize: acetree.renderer, resize: acetree.renderer,
afterRender: acetree.renderer,
expand: model, expand: model,
collapse: model, collapse: model,
check: model, check: model,

Wyświetl plik

@ -988,7 +988,7 @@ function findCssRule(name, stylesheet) {
* @param {Object} [win] A reference to a window * @param {Object} [win] A reference to a window
*/ */
function setStyleRule(name, type, value, stylesheet, win) { function setStyleRule(name, type, value, stylesheet, win) {
var rule = findCssRule(name, stylesheet, win); var rule = findCssRule(name, stylesheet);
if (rule) { if (rule) {
if (value.indexOf("!important") > -1) { if (value.indexOf("!important") > -1) {
rule.style.cssText = type + ":" + value; rule.style.cssText = type + ":" + value;
@ -1027,4 +1027,4 @@ window.addEventListener("message", function(e) {
if (parent != window) if (parent != window)
init(id); init(id);
})(); })();