Home | History | Annotate | Download | only in src

Lines Matching defs:Mirror

32 // Mirror cache.
37 * Clear the mirror handle cache.
46 * Returns the mirror for a specified value or object.
48 * @param {value or Object} value the value or object to retreive the mirror for
50 * should not be added to the mirror cache. The default is not transient.
51 * @returns {Mirror} the mirror reflects the passed value or object
54 var mirror;
56 // Look for non transient mirrors in the mirror cache.
59 mirror = mirror_cache_[id];
60 if (mirror.value() === value) {
61 return mirror;
64 if (mirror.isNumber() && isNaN(mirror.value()) &&
66 return mirror;
72 mirror = new UndefinedMirror();
74 mirror = new NullMirror();
76 mirror = new BooleanMirror(value);
78 mirror = new NumberMirror(value);
80 mirror = new StringMirror(value);
82 mirror = new ArrayMirror(value);
84 mirror = new DateMirror(value);
86 mirror = new FunctionMirror(value);
88 mirror = new RegExpMirror(value);
90 mirror = new ErrorMirror(value);
92 mirror = new ScriptMirror(value);
94 mirror = new ObjectMirror(value, OBJECT_TYPE, opt_transient);
97 mirror_cache_[mirror.handle()] = mirror;
98 return mirror;
103 * Returns the mirror for a specified mirror handle.
105 * @param {number} handle the handle to find the mirror for
106 * @returns {Mirror or undefiend} the mirror with the requested handle or
107 * undefined if no mirror with the requested handle was found
115 * Returns the mirror for the undefined value.
117 * @returns {Mirror} the mirror reflects the undefined value
131 * expected during bootstrapping (see mirror.js in r114903).
201 // Mirror hierarchy:
202 // - Mirror
222 * Base class for all mirror objects.
223 * @param {string} type The type of the mirror
226 function Mirror(type) {
231 Mirror.prototype.type = function() {
237 * Check whether the mirror reflects a value.
238 * @returns {boolean} True if the mirror reflects a value.
240 Mirror.prototype.isValue = function() {
246 * Check whether the mirror reflects the undefined value.
247 * @returns {boolean} True if the mirror reflects the undefined value.
249 Mirror.prototype.isUndefined = function() {
255 * Check whether the mirror reflects the null value.
256 * @returns {boolean} True if the mirror reflects the null value
258 Mirror.prototype.isNull = function() {
264 * Check whether the mirror reflects a boolean value.
265 * @returns {boolean} True if the mirror reflects a boolean value
267 Mirror.prototype.isBoolean = function() {
273 * Check whether the mirror reflects a number value.
274 * @returns {boolean} True if the mirror reflects a number value
276 Mirror.prototype.isNumber = function() {
282 * Check whether the mirror reflects a string value.
283 * @returns {boolean} True if the mirror reflects a string value
285 Mirror.prototype.isString = function() {
291 * Check whether the mirror reflects an object.
292 * @returns {boolean} True if the mirror reflects an object
294 Mirror.prototype.isObject = function() {
300 * Check whether the mirror reflects a function.
301 * @returns {boolean} True if the mirror reflects a function
303 Mirror.prototype.isFunction = function() {
309 * Check whether the mirror reflects an unresolved function.
310 * @returns {boolean} True if the mirror reflects an unresolved function
312 Mirror.prototype.isUnresolvedFunction = function() {
318 * Check whether the mirror reflects an array.
319 * @returns {boolean} True if the mirror reflects an array
321 Mirror.prototype.isArray = function() {
327 * Check whether the mirror reflects a date.
328 * @returns {boolean} True if the mirror reflects a date
330 Mirror.prototype.isDate = function() {
336 * Check whether the mirror reflects a regular expression.
337 * @returns {boolean} True if the mirror reflects a regular expression
339 Mirror.prototype.isRegExp = function() {
345 * Check whether the mirror reflects an error.
346 * @returns {boolean} True if the mirror reflects an error
348 Mirror.prototype.isError = function() {
354 * Check whether the mirror reflects a property.
355 * @returns {boolean} True if the mirror reflects a property
357 Mirror.prototype.isProperty = function() {
363 * Check whether the mirror reflects an internal property.
364 * @returns {boolean} True if the mirror reflects an internal property
366 Mirror.prototype.isInternalProperty = function() {
372 * Check whether the mirror reflects a stack frame.
373 * @returns {boolean} True if the mirror reflects a stack frame
375 Mirror.prototype.isFrame = function() {
381 * Check whether the mirror reflects a script.
382 * @returns {boolean} True if the mirror reflects a script
384 Mirror.prototype.isScript = function() {
390 * Check whether the mirror reflects a context.
391 * @returns {boolean} True if the mirror reflects a context
393 Mirror.prototype.isContext = function() {
399 * Check whether the mirror reflects a scope.
400 * @returns {boolean} True if the mirror reflects a scope
402 Mirror.prototype.isScope = function() {
410 Mirror.prototype.allocateHandle_ = function() {
419 Mirror.prototype.allocateTransientHandle_ = function() {
424 Mirror.prototype.toText = function() {
431 * Base class for all value mirror objects.
432 * @param {string} type The type of the mirror
433 * @param {value} value The value reflected by this mirror
437 * @extends Mirror
440 %_CallFunction(this, type, Mirror);
448 inherits(ValueMirror, Mirror);
451 Mirror.prototype.handle = function() {
458 * @return {boolean} True if the mirror reflects a primitive value
471 * Get the actual value reflected by this mirror.
472 * @return {value} The value reflected by this mirror
480 * Mirror object for Undefined.
496 * Mirror object for null.
512 * Mirror object for boolean values.
513 * @param {boolean} value The boolean value reflected by this mirror
529 * Mirror object for number values.
530 * @param {number} value The number value reflected by this mirror
546 * Mirror object for string values.
547 * @param {string} value The string value reflected by this mirror
575 * Mirror object for objects.
576 * @param {object} value The object reflected by this mirror
737 * @param {Mirror} value The property value to look for
770 Mirror.prototype, opt_max_objects || 0);
828 * Mirror object for functions.
829 * @param {function} value The function object reflected by this mirror.
971 * Mirror object for unresolved functions.
973 * mirror.
1024 * Mirror object for arrays.
1025 * @param {Array} value The Array object reflected by this mirror
1061 * Mirror object for dates.
1062 * @param {Date} value The Date object reflected by this mirror
1079 * Mirror object for regular expressions.
1080 * @param {RegExp} value The RegExp object reflected by this mirror
1133 * Mirror object for error objects.
1134 * @param {Error} value The error object reflected by this mirror
1166 * Base mirror object for properties.
1167 * @param {ObjectMirror} mirror The mirror object having this property
1171 * @extends Mirror
1173 function PropertyMirror(mirror, name, details) {
1174 %_CallFunction(this, PROPERTY_TYPE, Mirror);
1175 this.mirror_ = mirror;
1185 inherits(PropertyMirror, Mirror);
1267 * @return {Mirror} FunctionMirror reflecting the getter function or
1281 * @return {Mirror} FunctionMirror reflecting the setter function or
1307 * Mirror object for internal properties. Internal property reflects properties
1313 * @extends Mirror
1316 %_CallFunction(this, INTERNAL_PROPERTY_TYPE, Mirror);
1320 inherits(InternalPropertyMirror, Mirror);
1518 * Mirror object for stack frames.
1523 * @extends Mirror
1526 %_CallFunction(this, FRAME_TYPE, Mirror);
1531 inherits(FrameMirror, Mirror);
1543 // Create a function mirror. NOTE: MakeMirror cannot be used here as the
1918 * Mirror object for scope of frame or function. Either frame or function must
1924 * @extends Mirror
1927 %_CallFunction(this, SCOPE_TYPE, Mirror);
1936 inherits(ScopeMirror, Mirror);
1955 // For local and closure scopes create a transient mirror as these objects are
1970 * Mirror object for script source.
1973 * @extends Mirror
1976 %_CallFunction(this, SCRIPT_TYPE, Mirror);
1981 inherits(ScriptMirror, Mirror);
2091 * Mirror object for context.
2094 * @extends Mirror
2097 %_CallFunction(this, CONTEXT_TYPE, Mirror);
2101 inherits(ContextMirror, Mirror);
2110 * Returns a mirror serializer
2116 * @returns {MirrorSerializer} mirror serializer
2124 * Object for serializing a mirror objects and its direct references.
2125 * @param {boolean} details Indicates whether to include details for the mirror
2140 * @param {Mirror} mirror The mirror to serialize
2143 JSONProtocolSerializer.prototype.serializeReference = function(mirror) {
2144 return this.serialize_(mirror, true, true);
2152 * @param {Mirror} mirror The mirror to serialize
2155 JSONProtocolSerializer.prototype.serializeValue = function(mirror) {
2156 var json = this.serialize_(mirror, false, true);
2164 * @param {Mirror} mirror The mirror to serialize.
2202 JSONProtocolSerializer.prototype.add_ = function(mirror) {
2203 // If this mirror is already in the list just return.
2205 if (this.mirrors_[i] === mirror) {
2210 // Add the mirror to the list of mirrors to be serialized.
2211 this.mirrors_.push(mirror);
2216 * Formats mirror object to protocol reference object with some data that can
2218 * @param {Mirror} mirror Mirror to serialize.
2222 function(mirror) {
2224 o.ref = mirror.handle();
2225 o.type = mirror.type();
2226 switch (mirror.type()) {
2231 o.value = mirror.value();
2234 o.value = mirror.getTruncatedValue(this.maxStringLength_());
2237 o.name = mirror.name();
2238 o.inferredName = mirror.inferredName();
2239 if (mirror.script()) {
2240 o.scriptId = mirror.script().id();
2245 o.value = mirror.toText();
2248 o.className = mirror.className();
2255 JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
2257 // If serializing a reference to a mirror just return the reference and add
2258 // the mirror to the referenced mirrors.
2260 (mirror.isValue() || mirror.isScript() || mirror.isContext())) {
2261 if (this.inlineRefs_() && mirror.isValue()) {
2262 return this.serializeReferenceWithDisplayData_(mirror);
2264 this.add_(mirror);
2265 return {'ref' : mirror.handle()};
2272 // Add the mirror handle.
2273 if (mirror.isValue() || mirror.isScript() || mirror.isContext()) {
2274 content.handle = mirror.handle();
2278 content.type = mirror.type();
2280 switch (mirror.type()) {
2288 content.value = mirror.value();
2293 content.value = NumberToJSON_(mirror.value());
2299 mirror.length() > this.maxStringLength_()) {
2300 var str = mirror.getTruncatedValue(this.maxStringLength_());
2305 content.value = mirror.value();
2307 content.length = mirror.length();
2315 this.serializeObject_(mirror, content, details);
2325 this.serializeFrame_(mirror, content);
2330 this.serializeScope_(mirror, content);
2335 if (mirror.name()) {
2336 content.name = mirror.name();
2338 content.id = mirror.id();
2339 content.lineOffset = mirror.lineOffset();
2340 content.columnOffset = mirror.columnOffset();
2341 content.lineCount = mirror.lineCount();
2342 if (mirror.data()) {
2343 content.data = mirror.data();
2346 content.source = mirror.source();
2348 var sourceStart = mirror.source().substring(0, 80);
2351 content.sourceLength = mirror.source().length;
2352 content.scriptType = mirror.scriptType();
2353 content.compilationType = mirror.compilationType();
2356 if (mirror.compilationType() == 1 &&
2357 mirror.evalFromScript()) {
2359 this.serializeReference(mirror.evalFromScript());
2360 var evalFromLocation = mirror.evalFromLocation();
2365 if (mirror.evalFromFunctionName()) {
2366 content.evalFromFunctionName = mirror.evalFromFunctionName();
2369 if (mirror.context()) {
2370 content.context = this.serializeReference(mirror.context());
2375 content.data = mirror.data();
2380 content.text = mirror.toText();
2399 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
2402 content.className = mirror.className();
2404 this.serializeReference(mirror.constructorFunction());
2405 content.protoObject = this.serializeReference(mirror.protoObject());
2406 content.prototypeObject = this.serializeReference(mirror.prototypeObject());
2409 if (mirror.hasNamedInterceptor()) {
2412 if (mirror.hasIndexedInterceptor()) {
2417 if (mirror.isFunction()) {
2419 content.name = mirror.name();
2420 if (!IS_UNDEFINED(mirror.inferredName())) {
2421 content.inferredName = mirror.inferredName();
2423 content.resolved = mirror.resolved();
2424 if (mirror.resolved()) {
2425 content.source = mirror.source();
2427 if (mirror.script()) {
2428 content.script = this.serializeReference(mirror.script());
2429 content.scriptId = mirror.script().id();
2431 serializeLocationFields(mirror.sourceLocation(), content);
2435 for (var i = 0; i < mirror.scopeCount(); i++) {
2436 var scope = mirror.scope(i);
2445 if (mirror.isDate()) {
2447 content.value = mirror.value();
2451 var propertyNames = mirror.propertyNames(PropertyKind.Named);
2452 var propertyIndexes = mirror.propertyNames(PropertyKind.Indexed);
2455 var propertyMirror = mirror.property(propertyNames[i]);
2462 var propertyMirror = mirror.property(propertyIndexes[i]);
2470 var internalProperties = mirror.internalProperties();
2572 JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) {
2573 content.index = mirror.index();
2574 content.receiver = this.serializeReference(mirror.receiver());
2575 var func = mirror.func();
2580 content.constructCall = mirror.isConstructCall();
2581 content.atReturn = mirror.isAtReturn();
2582 if (mirror.isAtReturn()) {
2583 content.returnValue = this.serializeReference(mirror.returnValue());
2585 content.debuggerFrame = mirror.isDebuggerFrame();
2586 var x = new Array(mirror.argumentCount());
2587 for (var i = 0; i < mirror.argumentCount(); i++) {
2589 var argument_name = mirror.argumentName(i);
2593 arg.value = this.serializeReference(mirror.argumentValue(i));
2597 var x = new Array(mirror.localCount());
2598 for (var i = 0; i < mirror.localCount(); i++) {
2600 local.name = mirror.localName(i);
2601 local.value = this.serializeReference(mirror.localValue(i));
2605 serializeLocationFields(mirror.sourceLocation(), content);
2606 var source_line_text = mirror.sourceLineText();
2612 for (var i = 0; i < mirror.scopeCount(); i++) {
2613 var scope = mirror.scope(i);
2622 JSONProtocolSerializer.prototype.serializeScope_ = function(mirror, content) {
2623 content.index = mirror.scopeIndex();
2624 content.frameIndex = mirror.frameIndex();
2625 content.type = mirror.scopeType();
2627 this.serializeValue(mirror.scopeObject()) :
2628 this.serializeReference(mirror.scopeObject());