kopia lustrzana https://github.com/c9/core
include classes in javascript outline
rodzic
bf954c2617
commit
e21ed3a696
|
@ -86,7 +86,7 @@ var outlineSync = outlineHandler.outlineSync = function(doc, node, includeProps)
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
// x : function(...) { ... } -> name is x
|
// x : function(...) { ... } -> name is x
|
||||||
'PropertyInit(x, Function(name, fargs, body))', function(b) {
|
'PropertyInit(x, Function(name, fargs, body))', 'Method(x, Function(name, fargs, body))', function(b) {
|
||||||
results.push({
|
results.push({
|
||||||
icon: 'method',
|
icon: 'method',
|
||||||
name: b.x.value + fargsToString(b.fargs),
|
name: b.x.value + fargsToString(b.fargs),
|
||||||
|
@ -153,6 +153,16 @@ var outlineSync = outlineHandler.outlineSync = function(doc, node, includeProps)
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
'Class(x, y, body)', function(b) {
|
||||||
|
results.push({
|
||||||
|
icon: 'event',
|
||||||
|
name: b.x.value + (b.y.value ? " extends " + b.y.value : ""),
|
||||||
|
pos: this.getPos(),
|
||||||
|
displayPos: b.x.getPos(),
|
||||||
|
items: b.body && outlineSync(doc, b.body, includeProps)
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
},
|
||||||
/* UNDONE: callbacks in outline
|
/* UNDONE: callbacks in outline
|
||||||
// intelligently name callback functions for method calls
|
// intelligently name callback functions for method calls
|
||||||
// setTimeout(function() { ... }, 200) -> name is setTimeout [callback]
|
// setTimeout(function() { ... }, 200) -> name is setTimeout [callback]
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
if (typeof define === "undefined") {
|
if (typeof define === "undefined") {
|
||||||
require("amd-loader");
|
require("amd-loader");
|
||||||
require("../../test/setup_paths");
|
require("../../test/setup_paths");
|
||||||
|
require("c9/inline-mocha")(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
function outlineSync(handler, document, node) {
|
function outlineSync(handler, document, node) {
|
||||||
|
@ -35,6 +36,9 @@ define(function(require, exports, module) {
|
||||||
assert.equal(outline[1].items[0].name, 'nested(c)');
|
assert.equal(outline[1].items[0].name, 'nested(c)');
|
||||||
assert.equal(outline[2].name, 'someFunction(a, b)');
|
assert.equal(outline[2].name, 'someFunction(a, b)');
|
||||||
assert.equal(outline[3].name, 'someFunction.bla()');
|
assert.equal(outline[3].name, 'someFunction.bla()');
|
||||||
|
assert.equal(outline[4].name, 'SomeClass');
|
||||||
|
assert.equal(outline[4].items[0].name, 'method(x)');
|
||||||
|
assert.equal(outline.length, 5);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,10 @@ function simpleFunctionNested(a, b) {
|
||||||
|
|
||||||
someFunction.bla = function() {
|
someFunction.bla = function() {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
class SomeClass {
|
||||||
|
method(x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Ładowanie…
Reference in New Issue