// would be the appropriate test. We follow KJS in consulting the
// prototype.
var current = array[index];
- if (!IS_UNDEFINED(current) || index in array)
+ if (!IS_UNDEFINED(current) || index in array) {
deleted_elements[i] = current;
+ }
}
}
if (j_complement <= i) {
high = j;
- while (keys[--high_counter] == j);
+ while (keys[--high_counter] == j) { }
low = j_complement;
}
if (j_complement >= i) {
low = i;
- while (keys[++low_counter] == i);
+ while (keys[++low_counter] == i) { }
high = len - i - 1;
}
var first = this[0];
- if (IS_ARRAY(this))
+ if (IS_ARRAY(this)) {
SmartMove(this, 0, 1, len, 0);
- else
+ } else {
SimpleMove(this, 0, 1, len, 0);
+ }
this.length = len - 1;
var len = TO_UINT32(this.length);
var num_arguments = %_ArgumentsLength();
- if (IS_ARRAY(this))
+ if (IS_ARRAY(this)) {
SmartMove(this, 0, 0, len, num_arguments);
- else
+ } else {
SimpleMove(this, 0, 0, len, num_arguments);
+ }
for (var i = 0; i < num_arguments; i++) {
this[i] = %_Arguments(i);
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
String.prototype.startsWith = function (str) {
- if (str.length > this.length)
+ if (str.length > this.length) {
return false;
+ }
return this.substr(0, str.length) == str;
-}
+};
function log10(num) {
return Math.log(num)/Math.log(10);
for (var i = 0; i < parts.length; i++) {
var part = parts[i];
var next = current[part];
- if (!next)
+ if (!next) {
return [];
+ }
current = next;
}
var result = [];
var properties = mirror.properties();
for (var i = 0; i < properties.length; i++) {
var name = properties[i].name();
- if (typeof name === 'string' && name.startsWith(last))
+ if (typeof name === 'string' && name.startsWith(last)) {
result.push(name);
+ }
}
current = ToInspectableObject(current.__proto__);
}
displaySourceStartLine: -1,
displaySourceEndLine: -1,
currentSourceLine: -1
-}
+};
var trace_compile = false; // Tracing all compile events?
var trace_debug_json = false; // Tracing all debug json packets?
var last_cmd_line = '';
}
function DebugEventDetails(response) {
- details = {text:'', running:false}
+ details = {text:'', running:false};
// Get the running state.
details.running = response.running();
case 'afterCompile':
if (trace_compile) {
- result = 'Source ' + body.script.name + ' compiled:\n'
+ result = 'Source ' + body.script.name + ' compiled:\n';
var source = body.script.source;
if (!(source[source.length - 1] == '\n')) {
result += source;
}
return details;
-};
+}
function SourceInfo(body) {
// Return the source line text with the underline beneath.
return source_text + '\n' + underline;
-};
+}
// Converts a text command to a JSON request.
print("sending: '" + result + "'");
}
return result;
-};
+}
function DebugRequest(cmd_line) {
DebugRequest.prototype.JSONRequest = function() {
return this.request_;
-}
+};
function RequestPacket(command) {
json += ',"arguments":';
// Encode the arguments part.
if (this.arguments.toJSONProtocol) {
- json += this.arguments.toJSONProtocol()
+ json += this.arguments.toJSONProtocol();
} else {
json += SimpleObjectToJSON_(this.arguments);
}
}
json += '}';
return json;
-}
+};
DebugRequest.prototype.createRequest = function(command) {
}
return request;
-}
+};
function extractObjId(args) {
} else {
throw new Error('Invalid trace arguments.');
}
-}
+};
// Handle the help command.
DebugRequest.prototype.helpCommand_ = function(args) {
print('');
print('disconnect|exit|quit - disconnects and quits the debugger');
print('help - prints this help information');
-}
+};
function formatHandleReference_(value) {
function formatObject_(value, include_properties) {
var result = '';
result += formatHandleReference_(value);
- result += ', type: object'
+ result += ', type: object';
result += ', constructor ';
var ctor = value.constructorFunctionValue();
result += formatHandleReference_(ctor);
// Convert a JSON response to text for display in a text based debugger.
function DebugResponseDetails(response) {
- details = {text:'', running:false}
+ details = { text: '', running: false };
try {
if (!response.success()) {
}
return details;
-};
+}
/**
*/
ProtocolPackage.prototype.type = function() {
return this.packet_.type;
-}
+};
/**
*/
ProtocolPackage.prototype.event = function() {
return this.packet_.event;
-}
+};
/**
*/
ProtocolPackage.prototype.requestSeq = function() {
return this.packet_.request_seq;
-}
+};
/**
*/
ProtocolPackage.prototype.running = function() {
return this.packet_.running ? true : false;
-}
+};
ProtocolPackage.prototype.success = function() {
return this.packet_.success ? true : false;
-}
+};
ProtocolPackage.prototype.message = function() {
return this.packet_.message;
-}
+};
ProtocolPackage.prototype.command = function() {
return this.packet_.command;
-}
+};
ProtocolPackage.prototype.body = function() {
return this.packet_.body;
-}
+};
ProtocolPackage.prototype.bodyValue = function(index) {
} else {
return new ProtocolValue(this.packet_.body, this);
}
-}
+};
ProtocolPackage.prototype.body = function() {
return this.packet_.body;
-}
+};
ProtocolPackage.prototype.lookup = function(handle) {
} else {
return new ProtocolReference(handle);
}
-}
+};
ProtocolPackage.prototype.raw_json = function() {
return this.raw_json_;
-}
+};
function ProtocolValue(value, packet) {
*/
ProtocolValue.prototype.type = function() {
return this.value_.type;
-}
+};
/**
*/
ProtocolValue.prototype.field = function(name) {
return this.value_[name];
-}
+};
/**
ProtocolValue.prototype.isPrimitive = function() {
return this.isUndefined() || this.isNull() || this.isBoolean() ||
this.isNumber() || this.isString();
-}
+};
/**
*/
ProtocolValue.prototype.handle = function() {
return this.value_.handle;
-}
+};
/**
*/
ProtocolValue.prototype.isUndefined = function() {
return this.value_.type == 'undefined';
-}
+};
/**
*/
ProtocolValue.prototype.isNull = function() {
return this.value_.type == 'null';
-}
+};
/**
*/
ProtocolValue.prototype.isBoolean = function() {
return this.value_.type == 'boolean';
-}
+};
/**
*/
ProtocolValue.prototype.isNumber = function() {
return this.value_.type == 'number';
-}
+};
/**
*/
ProtocolValue.prototype.isString = function() {
return this.value_.type == 'string';
-}
+};
/**
ProtocolValue.prototype.isObject = function() {
return this.value_.type == 'object' || this.value_.type == 'function' ||
this.value_.type == 'error' || this.value_.type == 'regexp';
-}
+};
/**
ProtocolValue.prototype.constructorFunctionValue = function() {
var ctor = this.value_.constructorFunction;
return this.packet_.lookup(ctor.ref);
-}
+};
/**
ProtocolValue.prototype.protoObjectValue = function() {
var proto = this.value_.protoObject;
return this.packet_.lookup(proto.ref);
-}
+};
/**
*/
ProtocolValue.prototype.propertyCount = function() {
return this.value_.properties ? this.value_.properties.length : 0;
-}
+};
/**
ProtocolValue.prototype.propertyName = function(index) {
var property = this.value_.properties[index];
return property.name;
-}
+};
/**
}
}
return null;
-}
+};
/**
ProtocolValue.prototype.propertyValue = function(index) {
var property = this.value_.properties[index];
return this.packet_.lookup(property.ref);
-}
+};
/**
*/
ProtocolValue.prototype.value = function() {
return this.value_.value;
-}
+};
ProtocolValue.prototype.valueString = function() {
return this.value_.text;
-}
+};
function ProtocolReference(handle) {
ProtocolReference.prototype.handle = function() {
return this.handle_;
-}
+};
function MakeJSONPair_(name, value) {
// Convert control character to unicode escape sequence.
return '\\u00' +
'0' + // TODO %NumberToRadixString(Math.floor(mapped / 16), 16) +
- '0' // TODO %NumberToRadixString(mapped % 16, 16);
+ '0'; // TODO %NumberToRadixString(mapped % 16, 16)
})
+ '"';
}
if (property_value === null) {
property_value_json = 'null';
} else if (typeof property_value.toJSONProtocol == 'function') {
- property_value_json = property_value.toJSONProtocol(true)
+ property_value_json = property_value.toJSONProtocol(true);
} else if (property_value.constructor.name == 'Array'){
property_value_json = SimpleArrayToJSON_(property_value);
} else {
}
var elem = array[i];
if (elem.toJSONProtocol) {
- json += elem.toJSONProtocol(true)
+ json += elem.toJSONProtocol(true);
} else if (typeof(elem) === 'object') {
json += SimpleObjectToJSON_(elem);
} else if (typeof(elem) === 'boolean') {
}
%DateYMDFromTime(t, ymd_from_time_cache);
- ymd_from_time_cached_time = t
+ ymd_from_time_cached_time = t;
}
return ymd_from_time_cache[0];
return $NaN;
}
%DateYMDFromTime(t, ymd_from_time_cache);
- ymd_from_time_cached_time = t
+ ymd_from_time_cached_time = t;
}
return ymd_from_time_cache[1];
}
%DateYMDFromTime(t, ymd_from_time_cache);
- ymd_from_time_cached_time = t
+ ymd_from_time_cached_time = t;
}
return ymd_from_time_cache[2];
minutes = argc > 4 ? ToNumber(minutes) : 0;
seconds = argc > 5 ? ToNumber(seconds) : 0;
ms = argc > 6 ? ToNumber(ms) : 0;
- year = (!NUMBER_IS_NAN(year) && 0 <= TO_INTEGER(year) && TO_INTEGER(year) <= 99)
- ? 1900 + TO_INTEGER(year) : year;
+ year = (!NUMBER_IS_NAN(year) &&
+ 0 <= TO_INTEGER(year) &&
+ TO_INTEGER(year) <= 99) ? 1900 + TO_INTEGER(year) : year;
var day = MakeDay(year, month, date);
var time = MakeTime(hours, minutes, seconds, ms);
value = TimeClip(UTC(MakeDate(day, time)));
var WeekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
-var Months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+var Months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
function TwoDigitString(value) {
}
-var LongWeekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
-var LongMonths = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
+var LongWeekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday',
+ 'Thursday', 'Friday', 'Saturday'];
+var LongMonths = ['January', 'February', 'March', 'April', 'May', 'June',
+ 'July', 'August', 'September', 'October', 'November', 'December'];
function LongDateString(time) {
minutes = argc > 4 ? ToNumber(minutes) : 0;
seconds = argc > 5 ? ToNumber(seconds) : 0;
ms = argc > 6 ? ToNumber(ms) : 0;
- year = (!NUMBER_IS_NAN(year) && 0 <= TO_INTEGER(year) && TO_INTEGER(year) <= 99)
- ? 1900 + TO_INTEGER(year) : year;
+ year = (!NUMBER_IS_NAN(year) &&
+ 0 <= TO_INTEGER(year) &&
+ TO_INTEGER(year) <= 99) ? 1900 + TO_INTEGER(year) : year;
var day = MakeDay(year, month, date);
var time = MakeTime(hours, minutes, seconds, ms);
return %_SetValueOf(this, TimeClip(MakeDate(day, time)));
function DateSetMilliseconds(ms) {
var t = LocalTime(DATE_VALUE(this));
ms = ToNumber(ms);
- var time = MakeTime(HOUR_FROM_TIME(t), MIN_FROM_TIME(t), SEC_FROM_TIME(t), ms);
+ var time = MakeTime(HOUR_FROM_TIME(t),
+ MIN_FROM_TIME(t),
+ SEC_FROM_TIME(t),
+ ms);
return %_SetValueOf(this, TimeClip(UTC(MakeDate(DAY(t), time))));
}
function DateSetUTCMilliseconds(ms) {
var t = DATE_VALUE(this);
ms = ToNumber(ms);
- var time = MakeTime(HOUR_FROM_TIME(t), MIN_FROM_TIME(t), SEC_FROM_TIME(t), ms);
+ var time = MakeTime(HOUR_FROM_TIME(t),
+ MIN_FROM_TIME(t),
+ SEC_FROM_TIME(t),
+ ms);
return %_SetValueOf(this, TimeClip(MakeDate(DAY(t), time)));
}
copy.condition_ = this.condition_;
copy.ignoreCount_ = this.ignoreCount_;
return copy;
-}
+};
ScriptBreakPoint.prototype.number = function() {
locations.push(this.break_points_[i].actual_location);
}
return locations;
-}
+};
ScriptBreakPoint.prototype.update_positions = function(line, column) {
this.line_ = line;
this.column_ = column;
-}
+};
ScriptBreakPoint.prototype.hit_count = function() {
// break points set in this script.
function UpdateScriptBreakPoints(script) {
for (var i = 0; i < script_break_points.length; i++) {
- if (script_break_points[i].type() == Debug.ScriptBreakPointType.ScriptName &&
- script_break_points[i].matchesScript(script)) {
- script_break_points[i].set(script);
+ var break_point = script_break_points[i];
+ if ((break_point.type() == Debug.ScriptBreakPointType.ScriptName) &&
+ break_point.matchesScript(script)) {
+ break_point.set(script);
}
}
}
var script = %FunctionGetScript(func);
var script_offset = %FunctionGetScriptSourcePosition(func);
return script.locationFromLine(opt_line, opt_column, script_offset);
-}
+};
// Returns the character position in a script based on a line number and an
Debug.findScriptSourcePosition = function(script, opt_line, opt_column) {
var location = script.locationFromLine(opt_line, opt_column);
return location ? location.position : null;
-}
+};
Debug.findBreakPoint = function(break_point_number, remove) {
}
}
return [];
-}
+};
Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) {
if (!IS_FUNCTION(func)) throw new Error('Parameters have wrong types.');
{
break_point = MakeBreakPoint(position);
break_point.setCondition(condition);
- if (!enabled)
+ if (!enabled) {
break_point.disable();
+ }
var scripts = this.scripts();
for (var i = 0; i < scripts.length; i++) {
if (script_id == scripts[i].id) {
}
}
return script_break_point;
-}
+};
// Sets a breakpoint in a script identified through id or name at the
}
return script_break_point.number();
-}
+};
Debug.setScriptBreakPointById = function(script_id,
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId,
script_id, opt_line, opt_column,
opt_condition, opt_groupId);
-}
+};
Debug.setScriptBreakPointByName = function(script_name,
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptName,
script_name, opt_line, opt_column,
opt_condition, opt_groupId);
-}
+};
Debug.setScriptBreakPointByRegExp = function(script_regexp,
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptRegExp,
script_regexp, opt_line, opt_column,
opt_condition, opt_groupId);
-}
+};
Debug.enableScriptBreakPoint = function(break_point_number) {
};
-Debug.changeScriptBreakPointCondition = function(break_point_number, condition) {
+Debug.changeScriptBreakPointCondition = function(
+ break_point_number, condition) {
var script_break_point = this.findScriptBreakPoint(break_point_number, false);
script_break_point.setCondition(condition);
};
-Debug.changeScriptBreakPointIgnoreCount = function(break_point_number, ignoreCount) {
+Debug.changeScriptBreakPointIgnoreCount = function(
+ break_point_number, ignoreCount) {
if (ignoreCount < 0) {
throw new Error('Invalid argument');
}
Debug.scriptBreakPoints = function() {
return script_break_points;
-}
+};
Debug.clearStepping = function() {
%ClearStepping();
-}
+};
Debug.setBreakOnException = function() {
return %ChangeBreakOnException(Debug.ExceptionBreak.Caught, true);
var count = opt_count ? %ToNumber(opt_count) : 1;
return %PrepareStep(this.break_id, action, count);
-}
+};
ExecutionState.prototype.evaluateGlobal = function(source, disable_break,
opt_additional_context) {
ExecutionState.prototype.frame = function(opt_index) {
// If no index supplied return the selected frame.
if (opt_index == null) opt_index = this.selected_frame;
- if (opt_index < 0 || opt_index >= this.frameCount())
+ if (opt_index < 0 || opt_index >= this.frameCount()) {
throw new Error('Illegal frame index.');
+ }
return new FrameMirror(this.break_id, opt_index);
};
ExceptionEvent.prototype.exception = function() {
return this.exception_;
-}
+};
ExceptionEvent.prototype.uncaught = function() {
return this.uncaught_;
-}
+};
ExceptionEvent.prototype.func = function() {
o.body.script = this.script_;
return o.toJSONProtocol();
-}
+};
function MakeNewFunctionEvent(func) {
o.body = {};
o.body.script = { id: this.id() };
return o.toJSONProtocol();
-}
+};
function MakeScriptObject_(script, include_source) {
o.source = script.source();
}
return o;
-};
+}
function DebugCommandProcessor(exec_state, opt_is_running) {
this.exec_state_ = exec_state;
this.running_ = opt_is_running || false;
-};
+}
DebugCommandProcessor.prototype.processDebugRequest = function (request) {
return this.processDebugJSONRequest(request);
-}
+};
function ProtocolMessage(request) {
this.options_ = {};
}
this.options_[name] = value;
-}
+};
ProtocolMessage.prototype.failed = function(message) {
this.success = false;
this.message = message;
-}
+};
ProtocolMessage.prototype.toJSONProtocol = function() {
}
json.running = this.running;
return JSON.stringify(json);
-}
+};
DebugCommandProcessor.prototype.createResponse = function(request) {
};
-DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request) {
+DebugCommandProcessor.prototype.processDebugJSONRequest = function(
+ json_request) {
var request; // Current request.
var response; // Generated response.
try {
// Add the break point number to the response.
response.body = { type: type,
- breakpoint: break_point_number }
+ breakpoint: break_point_number };
// Add break point information to the response.
if (break_point instanceof ScriptBreakPoint) {
response.body.type = 'scriptRegExp';
response.body.script_regexp = break_point.script_regexp_object().source;
} else {
- throw new Error("Internal error: Unexpected breakpoint type: " + break_point.type());
+ throw new Error("Internal error: Unexpected breakpoint type: " +
+ break_point.type());
}
response.body.line = break_point.line();
response.body.column = break_point.column();
};
-DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(request, response) {
+DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(
+ request, response) {
// Check for legal request.
if (!request.arguments) {
response.failed('Missing arguments');
if (!IS_UNDEFINED(ignoreCount)) {
Debug.changeBreakPointIgnoreCount(break_point, ignoreCount);
}
-}
+};
-DebugCommandProcessor.prototype.clearBreakPointGroupRequest_ = function(request, response) {
+DebugCommandProcessor.prototype.clearBreakPointGroupRequest_ = function(
+ request, response) {
// Check for legal request.
if (!request.arguments) {
response.failed('Missing arguments');
// Add the cleared break point numbers to the response.
response.body = { breakpoints: cleared_break_points };
-}
+};
-DebugCommandProcessor.prototype.clearBreakPointRequest_ = function(request, response) {
+DebugCommandProcessor.prototype.clearBreakPointRequest_ = function(
+ request, response) {
// Check for legal request.
if (!request.arguments) {
response.failed('Missing arguments');
Debug.clearBreakPoint(break_point);
// Add the cleared break point number to the response.
- response.body = { breakpoint: break_point }
-}
+ response.body = { breakpoint: break_point };
+};
-DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(request, response) {
+DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(
+ request, response) {
var array = [];
for (var i = 0; i < script_break_points.length; i++) {
var break_point = script_break_points[i];
condition: break_point.condition(),
ignoreCount: break_point.ignoreCount(),
actual_locations: break_point.actual_locations()
- }
+ };
if (break_point.type() == Debug.ScriptBreakPointType.ScriptId) {
description.type = 'scriptId';
description.type = 'scriptRegExp';
description.script_regexp = break_point.script_regexp_object().source;
} else {
- throw new Error("Internal error: Unexpected breakpoint type: " + break_point.type());
+ throw new Error("Internal error: Unexpected breakpoint type: " +
+ break_point.type());
}
array.push(description);
}
breakpoints: array,
breakOnExceptions: Debug.isBreakOnException(),
breakOnUncaughtExceptions: Debug.isBreakOnUncaughtException()
- }
-}
+ };
+};
DebugCommandProcessor.prototype.disconnectRequest_ =
function(request, response) {
Debug.disableAllBreakPoints();
this.continueRequest_(request, response);
-}
+};
DebugCommandProcessor.prototype.setExceptionBreakRequest_ =
// Add the cleared break point number to the response.
response.body = { 'type': type, 'enabled': enabled };
-}
+};
-DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response) {
+DebugCommandProcessor.prototype.backtraceRequest_ = function(
+ request, response) {
// Get the number of frames.
var total_frames = this.exec_state_.frameCount();
if (total_frames == 0) {
response.body = {
totalFrames: total_frames
- }
+ };
return;
}
// Default frame range to include in backtrace.
- var from_index = 0
+ var from_index = 0;
var to_index = kDefaultBacktraceLength;
// Get the range from the arguments.
}
if (request.arguments.bottom) {
var tmp_index = total_frames - from_index;
- from_index = total_frames - to_index
+ from_index = total_frames - to_index;
to_index = tmp_index;
}
if (from_index < 0 || to_index < 0) {
toFrame: to_index,
totalFrames: total_frames,
frames: frames
- }
+ };
};
DebugCommandProcessor.prototype.frameForScopeRequest_ = function(request) {
- // Get the frame for which the scope or scopes are requested. With no frameNumber
- // argument use the currently selected frame.
+ // Get the frame for which the scope or scopes are requested.
+ // With no frameNumber argument use the currently selected frame.
if (request.arguments && !IS_UNDEFINED(request.arguments.frameNumber)) {
frame_index = request.arguments.frameNumber;
if (frame_index < 0 || this.exec_state_.frameCount() <= frame_index) {
} else {
return this.exec_state_.frame();
}
-}
+};
DebugCommandProcessor.prototype.scopesRequest_ = function(request, response) {
toScope: total_scopes,
totalScopes: total_scopes,
scopes: scopes
- }
+ };
};
if (!IS_UNDEFINED(request.arguments.types)) {
types = %ToNumber(request.arguments.types);
if (isNaN(types) || types < 0) {
- return response.failed('Invalid types "' + request.arguments.types + '"');
+ return response.failed('Invalid types "' +
+ request.arguments.types + '"');
}
}
var details = %GetThreadDetails(this.exec_state_.break_id, i);
var thread_info = { current: details[0],
id: details[1]
- }
+ };
threads.push(thread_info);
}
response.body = {
totalThreads: total_threads,
threads: threads
- }
+ };
};
DebugCommandProcessor.prototype.versionRequest_ = function(request, response) {
response.body = {
V8Version: %GetV8Version()
- }
+ };
};
};
-DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response) {
+DebugCommandProcessor.prototype.changeLiveRequest_ = function(
+ request, response) {
if (!Debug.LiveEdit) {
return response.failed('LiveEdit feature is not supported');
}
response.body.flags.push({ name: name, value: value });
}
}
-}
+};
DebugCommandProcessor.prototype.v8FlagsRequest_ = function(request, response) {
// running.
DebugCommandProcessor.prototype.isRunning = function() {
return this.running_;
-}
+};
DebugCommandProcessor.prototype.systemBreak = function(cmd, args) {
n = n >>> 4;
}
return r;
-};
+}
/**
case 'string':
case 'number':
json = value;
- break
+ break;
default:
json = null;
));
}
-SetUpJSON()
+SetUpJSON();
if (old_node.children[i].live_shared_function_infos) {
old_node.children[i].live_shared_function_infos.
forEach(function (old_child_info) {
- %LiveEditReplaceRefToNestedFunction(old_info.info,
- corresponding_child_info,
- old_child_info.info);
+ %LiveEditReplaceRefToNestedFunction(
+ old_info.info,
+ corresponding_child_info,
+ old_child_info.info);
});
}
}
position: break_point_position,
line: break_point.line(),
column: break_point.column()
- }
+ };
break_point_old_positions.push(old_position_description);
}
position: updated_position,
line: new_location.line,
column: new_location.column
- }
+ };
break_point.set(original_script);
new_positions: new_position_description
} );
}
- }
+ };
}
}
PosTranslator.prototype.GetChunks = function() {
return this.chunks;
- }
+ };
PosTranslator.prototype.Translate = function(pos, inside_chunk_handler) {
var array = this.chunks;
inside_chunk_handler = PosTranslator.DefaultInsideChunkHandler;
}
return inside_chunk_handler(pos, chunk);
- }
+ };
PosTranslator.DefaultInsideChunkHandler = function(pos, diff_chunk) {
Assert(false, "Cannot translate position in changed area");
- }
+ };
PosTranslator.ShiftWithTopInsideChunkHandler =
function(pos, diff_chunk) {
// We carelessly do not check whether we stay inside the chunk after
// translation.
return pos - diff_chunk.pos1 + diff_chunk.pos2;
- }
+ };
var FunctionStatus = {
// No change to function or its inner functions; however its positions
CHANGED: "changed",
// Function is changed but cannot be patched.
DAMAGED: "damaged"
- }
+ };
function CodeInfoTreeNode(code_info, children, array_index) {
this.info = code_info;
var chunk_it = new function() {
var chunk_index = 0;
var pos_diff = 0;
- this.current = function() { return chunks[chunk_index]; }
+ this.current = function() { return chunks[chunk_index]; };
this.next = function() {
var chunk = chunks[chunk_index];
pos_diff = chunk.pos2 + chunk.len2 - (chunk.pos1 + chunk.len1);
chunk_index++;
- }
- this.done = function() { return chunk_index >= chunks.length; }
- this.TranslatePos = function(pos) { return pos + pos_diff; }
+ };
+ this.done = function() { return chunk_index >= chunks.length; };
+ this.TranslatePos = function(pos) { return pos + pos_diff; };
};
// A recursive function that processes internals of a function and all its
BLOCKED_ON_OTHER_STACK: 3,
BLOCKED_UNDER_NATIVE_CODE: 4,
REPLACED_ON_ACTIVE_STACK: 5
- }
+ };
FunctionPatchabilityStatus.SymbolName = function(code) {
- var enum = FunctionPatchabilityStatus;
- for (name in enum) {
- if (enum[name] == code) {
+ var enumeration = FunctionPatchabilityStatus;
+ for (name in enumeration) {
+ if (enumeration[name] == code) {
return name;
}
}
- }
+ };
// A logical failure in liveedit process. This means that change_log
Failure.prototype.toString = function() {
return "LiveEdit Failure: " + this.message;
- }
+ };
// A testing entry.
function GetPcFromSourcePos(func, source_pos) {
PosTranslator: PosTranslator,
CompareStrings: CompareStrings,
ApplySingleChunkPatch: ApplySingleChunkPatch
- }
-}
+ };
+};
}
return new SourceLocation(this, position, line, column, start, end);
-};
+}
/**
// resource.
var column = opt_column || 0;
if (line == 0) {
- column -= this.column_offset
+ column -= this.column_offset;
}
var offset_position = opt_offset_position || 0;
return null;
}
- return this.locationFromPosition(this.line_ends[offset_line + line - 1] + 1 + column); // line > 0 here.
+ return this.locationFromPosition(
+ this.line_ends[offset_line + line - 1] + 1 + column); // line > 0 here.
}
}
* invalid
*/
function ScriptSourceSlice(opt_from_line, opt_to_line) {
- var from_line = IS_UNDEFINED(opt_from_line) ? this.line_offset : opt_from_line;
- var to_line = IS_UNDEFINED(opt_to_line) ? this.line_offset + this.lineCount() : opt_to_line
+ var from_line = IS_UNDEFINED(opt_from_line) ? this.line_offset
+ : opt_from_line;
+ var to_line = IS_UNDEFINED(opt_to_line) ? this.line_offset + this.lineCount()
+ : opt_to_line;
// Adjust according to the offset within the resource.
from_line -= this.line_offset;
var to_position = to_line == 0 ? 0 : line_ends[to_line - 1] + 1;
// Return a source slice with line numbers re-adjusted to the resource.
- return new SourceSlice(this, from_line + this.line_offset, to_line + this.line_offset,
- from_position, to_position);
+ return new SourceSlice(this,
+ from_line + this.line_offset,
+ to_line + this.line_offset,
+ from_position, to_position);
}
function ScriptLineCount() {
// Return number of source lines.
return this.line_ends.length;
-};
+}
/**
* position : position within the source
* start : position of start of source context (inclusive)
* end : position of end of source context (not inclusive)
- * Source text for the source context is the character interval [start, end[. In
- * most cases end will point to a newline character. It might point just past
- * the final position of the source if the last source line does not end with a
- * newline character.
+ * Source text for the source context is the character interval
+ * [start, end[. In most cases end will point to a newline character.
+ * It might point just past the final position of the source if the last
+ * source line does not end with a newline character.
* @param {Script} script The Script object for which this is a location
* @param {number} position Source position for the location
* @param {number} line The line number for the location
this.end = this.start + limit;
}
}
-};
+}
/**
* Source text for this location.
*/
function SourceLocationSourceText() {
- return %_CallFunction(this.script.source, this.start, this.end, StringSubstring);
-};
+ return %_CallFunction(this.script.source,
+ this.start,
+ this.end,
+ StringSubstring);
+}
SetUpLockedPrototype(SourceLocation,
$Array(
"restrict", SourceLocationRestrict,
"sourceText", SourceLocationSourceText
- )
+ )
);
this.from_position,
this.to_position,
StringSubstring);
-};
+}
SetUpLockedPrototype(SourceSlice,
$Array("script", "from_line", "to_line", "from_position", "to_position"),
function CallSiteGetThis() {
return this.receiver;
-};
+}
function CallSiteGetTypeName() {
var constructor = this.receiver.constructor;
return %_CallFunction(this.receiver, ObjectToString);
}
return constructorName;
-};
+}
function CallSiteIsToplevel() {
if (this.receiver == null) {
return true;
}
return IS_GLOBAL(this.receiver);
-};
+}
function CallSiteIsEval() {
var script = %FunctionGetScript(this.fun);
return script && script.compilation_type == COMPILATION_TYPE_EVAL;
-};
+}
function CallSiteGetEvalOrigin() {
var script = %FunctionGetScript(this.fun);
return FormatEvalOrigin(script);
-};
+}
function CallSiteGetScriptNameOrSourceURL() {
var script = %FunctionGetScript(this.fun);
return script ? script.nameOrSourceURL() : null;
-};
+}
function CallSiteGetFunction() {
return this.fun;
-};
+}
function CallSiteGetFunctionName() {
// See if the function knows its own name
return "eval";
}
return null;
-};
+}
function CallSiteGetMethodName() {
// See if we can find a unique property on the receiver that holds
// this function.
var ownName = this.fun.name;
if (ownName && this.receiver &&
- (%_CallFunction(this.receiver, ownName, ObjectLookupGetter) === this.fun ||
- %_CallFunction(this.receiver, ownName, ObjectLookupSetter) === this.fun ||
+ (%_CallFunction(this.receiver,
+ ownName,
+ ObjectLookupGetter) === this.fun ||
+ %_CallFunction(this.receiver,
+ ownName,
+ ObjectLookupSetter) === this.fun ||
this.receiver[ownName] === this.fun)) {
// To handle DontEnum properties we guess that the method has
// the same name as the function.
for (var prop in this.receiver) {
if (this.receiver.__lookupGetter__(prop) === this.fun ||
this.receiver.__lookupSetter__(prop) === this.fun ||
- (!this.receiver.__lookupGetter__(prop) && this.receiver[prop] === this.fun)) {
+ (!this.receiver.__lookupGetter__(prop) &&
+ this.receiver[prop] === this.fun)) {
// If we find more than one match bail out to avoid confusion.
if (name) {
return null;
return name;
}
return null;
-};
+}
function CallSiteGetFileName() {
var script = %FunctionGetScript(this.fun);
return script ? script.name : null;
-};
+}
function CallSiteGetLineNumber() {
if (this.pos == -1) {
location = script.locationFromPosition(this.pos, true);
}
return location ? location.line + 1 : null;
-};
+}
function CallSiteGetColumnNumber() {
if (this.pos == -1) {
location = script.locationFromPosition(this.pos, true);
}
return location ? location.column + 1: null;
-};
+}
function CallSiteIsNative() {
var script = %FunctionGetScript(this.fun);
return script ? (script.type == TYPE_NATIVE) : false;
-};
+}
function CallSiteGetPosition() {
return this.pos;
-};
+}
function CallSiteIsConstructor() {
var constructor = this.receiver ? this.receiver.constructor : null;
return false;
}
return this.fun === constructor;
-};
+}
SetUpLockedPrototype(CallSite, $Array("receiver", "fun", "pos"), $Array(
"getThis", CallSiteGetThis,
// eval script originated from "real" source.
if (eval_from_script.name) {
eval_origin += " (" + eval_from_script.name;
- var location = eval_from_script.locationFromPosition(script.eval_from_script_position, true);
+ var location = eval_from_script.locationFromPosition(
+ script.eval_from_script_position, true);
if (location) {
eval_origin += ":" + (location.line + 1);
eval_origin += ":" + (location.column + 1);
}
- eval_origin += ")"
+ eval_origin += ")";
} else {
eval_origin += " (unknown source)";
}
}
return eval_origin;
-};
+}
function FormatSourcePosition(frame) {
var fileName;
fileLocation = "native";
} else if (frame.isEval()) {
fileName = frame.getScriptNameOrSourceURL();
- if (!fileName)
+ if (!fileName) {
fileLocation = frame.getEvalOrigin();
+ }
} else {
fileName = frame.getFileName();
}
DefineOneShotAccessor(obj, 'stack', function (obj) {
return FormatRawStackTrace(obj, raw_stack);
});
-};
+}
function SetUpError() {
if (!%PushIfAbsent(visited_errors, error)) throw cyclic_error_marker;
try {
var type = error.type;
- var name = error.name
+ var name = error.name;
name = IS_UNDEFINED(name) ? "Error" : TO_STRING_INLINE(name);
var message = error.message;
var hasMessage = %_CallFunction(error, "message", ObjectHasOwnProperty);
*/
function Mirror(type) {
this.type_ = type;
-};
+}
Mirror.prototype.type = function() {
*/
Mirror.prototype.isValue = function() {
return this instanceof ValueMirror;
-}
+};
/**
*/
Mirror.prototype.isUndefined = function() {
return this instanceof UndefinedMirror;
-}
+};
/**
*/
Mirror.prototype.isNull = function() {
return this instanceof NullMirror;
-}
+};
/**
*/
Mirror.prototype.isBoolean = function() {
return this instanceof BooleanMirror;
-}
+};
/**
*/
Mirror.prototype.isNumber = function() {
return this instanceof NumberMirror;
-}
+};
/**
*/
Mirror.prototype.isString = function() {
return this instanceof StringMirror;
-}
+};
/**
*/
Mirror.prototype.isObject = function() {
return this instanceof ObjectMirror;
-}
+};
/**
*/
Mirror.prototype.isFunction = function() {
return this instanceof FunctionMirror;
-}
+};
/**
*/
Mirror.prototype.isUnresolvedFunction = function() {
return this instanceof UnresolvedFunctionMirror;
-}
+};
/**
*/
Mirror.prototype.isArray = function() {
return this instanceof ArrayMirror;
-}
+};
/**
*/
Mirror.prototype.isDate = function() {
return this instanceof DateMirror;
-}
+};
/**
*/
Mirror.prototype.isRegExp = function() {
return this instanceof RegExpMirror;
-}
+};
/**
*/
Mirror.prototype.isError = function() {
return this instanceof ErrorMirror;
-}
+};
/**
*/
Mirror.prototype.isProperty = function() {
return this instanceof PropertyMirror;
-}
+};
/**
*/
Mirror.prototype.isFrame = function() {
return this instanceof FrameMirror;
-}
+};
/**
*/
Mirror.prototype.isScript = function() {
return this instanceof ScriptMirror;
-}
+};
/**
*/
Mirror.prototype.isContext = function() {
return this instanceof ContextMirror;
-}
+};
/**
*/
Mirror.prototype.isScope = function() {
return this instanceof ScopeMirror;
-}
+};
/**
*/
Mirror.prototype.allocateHandle_ = function() {
this.handle_ = next_handle_++;
-}
+};
/**
*/
Mirror.prototype.allocateTransientHandle_ = function() {
this.handle_ = next_transient_handle_--;
-}
+};
Mirror.prototype.toText = function() {
// Simpel to text which is used when on specialization in subclass.
return "#<" + this.constructor.name + ">";
-}
+};
/**
UndefinedMirror.prototype.toText = function() {
return 'undefined';
-}
+};
/**
NullMirror.prototype.toText = function() {
return 'null';
-}
+};
/**
BooleanMirror.prototype.toText = function() {
return this.value_ ? 'true' : 'false';
-}
+};
/**
NumberMirror.prototype.toText = function() {
return %NumberToString(this.value_);
-}
+};
/**
'... (length: ' + this.length() + ')';
}
return this.value_;
-}
+};
StringMirror.prototype.toText = function() {
return this.getTruncatedValue(kMaxProtocolStringLength);
-}
+};
/**
FunctionMirror.prototype.toText = function() {
return this.source();
-}
+};
/**
UnresolvedFunctionMirror.prototype.propertyNames = function(kind, limit) {
return [];
-}
+};
/**
};
-ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, opt_to_index) {
+ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index,
+ opt_to_index) {
var from_index = opt_from_index || 0;
var to_index = opt_to_index || this.length() - 1;
if (from_index > to_index) return new Array();
values[i - from_index] = value;
}
return values;
-}
+};
/**
DateMirror.prototype.toText = function() {
var s = JSON.stringify(this.value_);
return s.substring(1, s.length - 1); // cut quotes
-}
+};
/**
RegExpMirror.prototype.toText = function() {
// Simpel to text which is used when on specialization in subclass.
return "/" + this.source() + "/";
-}
+};
/**
str = '#<Error>';
}
return str;
-}
+};
/**
this.value_ = details[0];
this.details_ = details[1];
if (details.length > 2) {
- this.exception_ = details[2]
+ this.exception_ = details[2];
this.getter_ = details[3];
this.setter_ = details[4];
}
PropertyMirror.prototype.isReadOnly = function() {
return (this.attributes() & PropertyAttribute.ReadOnly) != 0;
-}
+};
PropertyMirror.prototype.isEnum = function() {
return (this.attributes() & PropertyAttribute.DontEnum) == 0;
-}
+};
PropertyMirror.prototype.canDelete = function() {
return (this.attributes() & PropertyAttribute.DontDelete) == 0;
-}
+};
PropertyMirror.prototype.name = function() {
return this.name_;
-}
+};
PropertyMirror.prototype.isIndexed = function() {
}
}
return true;
-}
+};
PropertyMirror.prototype.value = function() {
return MakeMirror(this.value_, false);
-}
+};
/**
*/
PropertyMirror.prototype.isException = function() {
return this.exception_ ? true : false;
-}
+};
PropertyMirror.prototype.attributes = function() {
return %DebugPropertyAttributesFromDetails(this.details_);
-}
+};
PropertyMirror.prototype.propertyType = function() {
return %DebugPropertyTypeFromDetails(this.details_);
-}
+};
PropertyMirror.prototype.insertionIndex = function() {
return %DebugPropertyIndexFromDetails(this.details_);
-}
+};
/**
*/
PropertyMirror.prototype.hasGetter = function() {
return this.getter_ ? true : false;
-}
+};
/**
*/
PropertyMirror.prototype.hasSetter = function() {
return this.setter_ ? true : false;
-}
+};
/**
} else {
return GetUndefinedMirror();
}
-}
+};
/**
} else {
return GetUndefinedMirror();
}
-}
+};
/**
return (this.propertyType() == PropertyType.Interceptor) ||
((this.propertyType() == PropertyType.Callbacks) &&
!this.hasGetter() && !this.hasSetter());
-}
+};
const kFrameDetailsFrameIdIndex = 0;
FrameDetails.prototype.frameId = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kFrameDetailsFrameIdIndex];
-}
+};
FrameDetails.prototype.receiver = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kFrameDetailsReceiverIndex];
-}
+};
FrameDetails.prototype.func = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kFrameDetailsFunctionIndex];
-}
+};
FrameDetails.prototype.isConstructCall = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kFrameDetailsConstructCallIndex];
-}
+};
FrameDetails.prototype.isAtReturn = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kFrameDetailsAtReturnIndex];
-}
+};
FrameDetails.prototype.isDebuggerFrame = function() {
%CheckExecutionState(this.break_id_);
var f = kFrameDetailsFlagDebuggerFrameMask;
return (this.details_[kFrameDetailsFlagsIndex] & f) == f;
-}
+};
FrameDetails.prototype.isOptimizedFrame = function() {
%CheckExecutionState(this.break_id_);
var f = kFrameDetailsFlagOptimizedFrameMask;
return (this.details_[kFrameDetailsFlagsIndex] & f) == f;
-}
+};
FrameDetails.prototype.isInlinedFrame = function() {
return this.inlinedFrameIndex() > 0;
-}
+};
FrameDetails.prototype.inlinedFrameIndex = function() {
%CheckExecutionState(this.break_id_);
var f = kFrameDetailsFlagInlinedFrameIndexMask;
- return (this.details_[kFrameDetailsFlagsIndex] & f) >> 2
-}
+ return (this.details_[kFrameDetailsFlagsIndex] & f) >> 2;
+};
FrameDetails.prototype.argumentCount = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kFrameDetailsArgumentCountIndex];
-}
+};
FrameDetails.prototype.argumentName = function(index) {
if (index >= 0 && index < this.argumentCount()) {
return this.details_[kFrameDetailsFirstDynamicIndex +
index * kFrameDetailsNameValueSize +
- kFrameDetailsNameIndex]
+ kFrameDetailsNameIndex];
}
-}
+};
FrameDetails.prototype.argumentValue = function(index) {
if (index >= 0 && index < this.argumentCount()) {
return this.details_[kFrameDetailsFirstDynamicIndex +
index * kFrameDetailsNameValueSize +
- kFrameDetailsValueIndex]
+ kFrameDetailsValueIndex];
}
-}
+};
FrameDetails.prototype.localCount = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kFrameDetailsLocalCountIndex];
-}
+};
FrameDetails.prototype.sourcePosition = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kFrameDetailsSourcePositionIndex];
-}
+};
FrameDetails.prototype.localName = function(index) {
%CheckExecutionState(this.break_id_);
if (index >= 0 && index < this.localCount()) {
var locals_offset = kFrameDetailsFirstDynamicIndex +
- this.argumentCount() * kFrameDetailsNameValueSize
+ this.argumentCount() * kFrameDetailsNameValueSize;
return this.details_[locals_offset +
index * kFrameDetailsNameValueSize +
- kFrameDetailsNameIndex]
+ kFrameDetailsNameIndex];
}
-}
+};
FrameDetails.prototype.localValue = function(index) {
%CheckExecutionState(this.break_id_);
if (index >= 0 && index < this.localCount()) {
var locals_offset = kFrameDetailsFirstDynamicIndex +
- this.argumentCount() * kFrameDetailsNameValueSize
+ this.argumentCount() * kFrameDetailsNameValueSize;
return this.details_[locals_offset +
index * kFrameDetailsNameValueSize +
- kFrameDetailsValueIndex]
+ kFrameDetailsValueIndex];
}
-}
+};
FrameDetails.prototype.returnValue = function() {
if (this.details_[kFrameDetailsAtReturnIndex]) {
return this.details_[return_value_offset];
}
-}
+};
FrameDetails.prototype.scopeCount = function() {
return %GetScopeCount(this.break_id_, this.frameId());
-}
+};
/**
};
-FrameMirror.prototype.evaluate = function(source, disable_break, opt_context_object) {
+FrameMirror.prototype.evaluate = function(source, disable_break,
+ opt_context_object) {
var result = %DebugEvaluate(this.break_id_,
this.details_.frameId(),
this.details_.inlinedFrameIndex(),
result += '[debugger]';
} else {
// If the receiver has a className which is 'global' don't display it.
- var display_receiver = !receiver.className || receiver.className() != 'global';
+ var display_receiver =
+ !receiver.className || (receiver.className() != 'global');
if (display_receiver) {
result += receiver.toText();
}
}
return result;
-}
+};
FrameMirror.prototype.sourceAndPositionText = function() {
}
return result;
-}
+};
FrameMirror.prototype.localsText = function() {
// Format local variables.
var result = '';
- var locals_count = this.localCount()
+ var locals_count = this.localCount();
if (locals_count > 0) {
for (var i = 0; i < locals_count; ++i) {
result += ' var ';
}
return result;
-}
+};
FrameMirror.prototype.toText = function(opt_locals) {
result += this.localsText();
}
return result;
-}
+};
const kScopeDetailsTypeIndex = 0;
ScopeDetails.prototype.type = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kScopeDetailsTypeIndex];
-}
+};
ScopeDetails.prototype.object = function() {
%CheckExecutionState(this.break_id_);
return this.details_[kScopeDetailsObjectIndex];
-}
+};
/**
ScriptMirror.prototype.locationFromPosition = function(
position, include_resource_offset) {
return this.script_.locationFromPosition(position, include_resource_offset);
-}
+};
ScriptMirror.prototype.sourceSlice = function (opt_from_line, opt_to_line) {
return this.script_.sourceSlice(opt_from_line, opt_to_line);
-}
+};
ScriptMirror.prototype.context = function() {
}
result += ')';
return result;
-}
+};
/**
*/
JSONProtocolSerializer.prototype.serializeReference = function(mirror) {
return this.serialize_(mirror, true, true);
-}
+};
/**
JSONProtocolSerializer.prototype.serializeValue = function(mirror) {
var json = this.serialize_(mirror, false, true);
return json;
-}
+};
/**
}
return content;
-}
+};
JSONProtocolSerializer.prototype.includeSource_ = function() {
return this.options_ && this.options_.includeSource;
-}
+};
JSONProtocolSerializer.prototype.inlineRefs_ = function() {
return this.options_ && this.options_.inlineRefs;
-}
+};
JSONProtocolSerializer.prototype.maxStringLength_ = function() {
return kMaxProtocolStringLength;
}
return this.options_.maxStringLength;
-}
+};
JSONProtocolSerializer.prototype.add_ = function(mirror) {
// Add the mirror to the list of mirrors to be serialized.
this.mirrors_.push(mirror);
-}
+};
/**
break;
case PROPERTY_TYPE:
- throw new Error('PropertyMirror cannot be serialized independeltly')
+ throw new Error('PropertyMirror cannot be serialized independeltly');
break;
case FRAME_TYPE:
mirror.evalFromScript()) {
content.evalFromScript =
this.serializeReference(mirror.evalFromScript());
- var evalFromLocation = mirror.evalFromLocation()
+ var evalFromLocation = mirror.evalFromLocation();
if (evalFromLocation) {
content.evalFromLocation = { line: evalFromLocation.line,
column: evalFromLocation.column };
// Create and return the JSON string.
return content;
-}
+};
/**
}
}
content.properties = p;
-}
+};
/**
result.ref = propertyValue.handle();
}
return result;
-}
+};
JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) {
var x = new Array(mirror.argumentCount());
for (var i = 0; i < mirror.argumentCount(); i++) {
var arg = {};
- var argument_name = mirror.argumentName(i)
+ var argument_name = mirror.argumentName(i);
if (argument_name) {
arg.name = argument_name;
}
index: i
});
}
-}
+};
JSONProtocolSerializer.prototype.serializeScope_ = function(mirror, content) {
content.object = this.inlineRefs_() ?
this.serializeValue(mirror.scopeObject()) :
this.serializeReference(mirror.scopeObject());
-}
+};
/**
}
function RegExpSetInput(string) {
LAST_INPUT(lastMatchInfo) = ToString(string);
- };
+ }
%DefineAccessor($RegExp, 'input', GETTER, RegExpGetInput, DONT_DELETE);
%DefineAccessor($RegExp, 'input', SETTER, RegExpSetInput, DONT_DELETE);
- %DefineAccessor($RegExp, '$_', GETTER, RegExpGetInput, DONT_ENUM | DONT_DELETE);
- %DefineAccessor($RegExp, '$_', SETTER, RegExpSetInput, DONT_ENUM | DONT_DELETE);
- %DefineAccessor($RegExp, '$input', GETTER, RegExpGetInput, DONT_ENUM | DONT_DELETE);
- %DefineAccessor($RegExp, '$input', SETTER, RegExpSetInput, DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, '$_', GETTER, RegExpGetInput,
+ DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, '$_', SETTER, RegExpSetInput,
+ DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, '$input', GETTER, RegExpGetInput,
+ DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, '$input', SETTER, RegExpSetInput,
+ DONT_ENUM | DONT_DELETE);
// The properties multiline and $* are aliases for each other. When this
// value is set in SpiderMonkey, the value it is set to is coerced to a
// Getter and setter for multiline.
var multiline = false;
- function RegExpGetMultiline() { return multiline; };
- function RegExpSetMultiline(flag) { multiline = flag ? true : false; };
+ function RegExpGetMultiline() { return multiline; }
+ function RegExpSetMultiline(flag) { multiline = flag ? true : false; }
- %DefineAccessor($RegExp, 'multiline', GETTER, RegExpGetMultiline, DONT_DELETE);
- %DefineAccessor($RegExp, 'multiline', SETTER, RegExpSetMultiline, DONT_DELETE);
- %DefineAccessor($RegExp, '$*', GETTER, RegExpGetMultiline, DONT_ENUM | DONT_DELETE);
- %DefineAccessor($RegExp, '$*', SETTER, RegExpSetMultiline, DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, 'multiline', GETTER, RegExpGetMultiline,
+ DONT_DELETE);
+ %DefineAccessor($RegExp, 'multiline', SETTER, RegExpSetMultiline,
+ DONT_DELETE);
+ %DefineAccessor($RegExp, '$*', GETTER, RegExpGetMultiline,
+ DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, '$*', SETTER, RegExpSetMultiline,
+ DONT_ENUM | DONT_DELETE);
function NoOpSetter(ignored) {}
// Static properties set by a successful match.
- %DefineAccessor($RegExp, 'lastMatch', GETTER, RegExpGetLastMatch, DONT_DELETE);
+ %DefineAccessor($RegExp, 'lastMatch', GETTER, RegExpGetLastMatch,
+ DONT_DELETE);
%DefineAccessor($RegExp, 'lastMatch', SETTER, NoOpSetter, DONT_DELETE);
- %DefineAccessor($RegExp, '$&', GETTER, RegExpGetLastMatch, DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, '$&', GETTER, RegExpGetLastMatch,
+ DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$&', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
- %DefineAccessor($RegExp, 'lastParen', GETTER, RegExpGetLastParen, DONT_DELETE);
+ %DefineAccessor($RegExp, 'lastParen', GETTER, RegExpGetLastParen,
+ DONT_DELETE);
%DefineAccessor($RegExp, 'lastParen', SETTER, NoOpSetter, DONT_DELETE);
- %DefineAccessor($RegExp, '$+', GETTER, RegExpGetLastParen, DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, '$+', GETTER, RegExpGetLastParen,
+ DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$+', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
- %DefineAccessor($RegExp, 'leftContext', GETTER, RegExpGetLeftContext, DONT_DELETE);
+ %DefineAccessor($RegExp, 'leftContext', GETTER, RegExpGetLeftContext,
+ DONT_DELETE);
%DefineAccessor($RegExp, 'leftContext', SETTER, NoOpSetter, DONT_DELETE);
- %DefineAccessor($RegExp, '$`', GETTER, RegExpGetLeftContext, DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, '$`', GETTER, RegExpGetLeftContext,
+ DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$`', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
- %DefineAccessor($RegExp, 'rightContext', GETTER, RegExpGetRightContext, DONT_DELETE);
+ %DefineAccessor($RegExp, 'rightContext', GETTER, RegExpGetRightContext,
+ DONT_DELETE);
%DefineAccessor($RegExp, 'rightContext', SETTER, NoOpSetter, DONT_DELETE);
- %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, DONT_ENUM | DONT_DELETE);
+ %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext,
+ DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
for (var i = 1; i < 10; ++i) {
- %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_DELETE);
+ %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i),
+ DONT_DELETE);
%DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE);
}
}
}
if (!IS_SPEC_FUNCTION(this)) {
- throw %MakeTypeError('apply_non_function', [ %ToString(this), typeof this ]);
+ throw %MakeTypeError('apply_non_function',
+ [ %ToString(this), typeof this ]);
}
// Make sure the arguments list has the right type.
// ECMA-262 section 15.5.4.2
function StringToString() {
- if (!IS_STRING(this) && !IS_STRING_WRAPPER(this))
+ if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
throw new $TypeError('String.prototype.toString is not generic');
+ }
return %_ValueOf(this);
}
// ECMA-262 section 15.5.4.3
function StringValueOf() {
- if (!IS_STRING(this) && !IS_STRING_WRAPPER(this))
+ if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
throw new $TypeError('String.prototype.valueOf is not generic');
+ }
return %_ValueOf(this);
}
// ECMA-262, section 15.5.4.6
function StringConcat() {
if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
- throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.concat"]);
+ throw MakeTypeError("called_on_null_or_undefined",
+ ["String.prototype.concat"]);
}
var len = %_ArgumentsLength();
var this_as_string = TO_STRING_INLINE(this);
builder_elements.push(SubString(string, position, next));
}
}
-};
+}
// Compute the string of a given regular expression capture.
if (start < 0) return;
var end = lastCaptureInfo[CAPTURE(scaled + 1)];
return SubString(string, start, end);
-};
+}
// Add the string of a given regular expression capture to the
if (start < 0) return;
var end = matchInfo[CAPTURE(scaled + 1)];
builder.addSpecialSlice(start, end);
-};
+}
// TODO(lrn): This array will survive indefinitely if replace is never
// called again. However, it will be empty, since the contents are cleared
var s_len = s.length;
var start_i = TO_INTEGER(start);
var end_i = s_len;
- if (end !== void 0)
+ if (end !== void 0) {
end_i = TO_INTEGER(end);
+ }
if (start_i < 0) {
start_i += s_len;
- if (start_i < 0)
+ if (start_i < 0) {
start_i = 0;
+ }
} else {
- if (start_i > s_len)
+ if (start_i > s_len) {
start_i = s_len;
+ }
}
if (end_i < 0) {
end_i += s_len;
- if (end_i < 0)
+ if (end_i < 0) {
end_i = 0;
+ }
} else {
- if (end_i > s_len)
+ if (end_i > s_len) {
end_i = s_len;
+ }
}
var num_c = end_i - start_i;
- if (num_c < 0)
+ if (num_c < 0) {
num_c = 0;
+ }
return SubString(s, start_i, start_i + num_c);
}
}
}
- return (start_i + 1 == end_i
+ return ((start_i + 1 == end_i)
? %_StringCharAt(s, start_i)
: %_SubString(s, start_i, end_i));
}
var end = start + len;
if (end > s.length) end = s.length;
- return (start + 1 == end
+ return ((start + 1 == end)
? %_StringCharAt(s, start)
: %_SubString(s, start, end));
}
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
-};
+}
// Compatibility support for KJS.
var cc = URIHexCharsToCharCode(uri.charCodeAt(++k), uri.charCodeAt(++k));
if (cc >> 7) {
var n = 0;
- while (((cc << ++n) & 0x80) != 0) ;
+ while (((cc << ++n) & 0x80) != 0) { }
if (n == 1 || n > 4) throw new $URIError("URI malformed");
var octets = new $Array(n);
octets[0] = cc;
if (63 <= cc && cc <= 64) return true;
return false;
- };
+ }
var string = ToString(uri);
return Decode(string, reservedPredicate);
}
// ECMA-262 - 15.1.3.2.
function URIDecodeComponent(component) {
- function reservedPredicate(cc) { return false; };
+ function reservedPredicate(cc) { return false; }
var string = ToString(component);
return Decode(string, reservedPredicate);
}
if (cc == 126) return true;
return false;
- };
+ }
var string = ToString(uri);
return Encode(string, unescapePredicate);
if (cc == 126) return true;
return false;
- };
+ }
var string = ToString(component);
return Encode(string, unescapePredicate);
// The spec says ToString should be evaluated before ToInt32.
string = TO_STRING_INLINE(string);
radix = TO_INT32(radix);
- if (!(radix == 0 || (2 <= radix && radix <= 36)))
+ if (!(radix == 0 || (2 <= radix && radix <= 36))) {
return $NaN;
+ }
}
if (%_HasCachedArrayIndex(string) &&
receiver = %GlobalReceiver(global);
}
if (!IS_SPEC_FUNCTION(fun)) {
- throw new $TypeError('Object.prototype.__defineGetter__: Expecting function');
+ throw new $TypeError(
+ 'Object.prototype.__defineGetter__: Expecting function');
}
var desc = new PropertyDescriptor();
desc.setGet(fun);
function ObjectKeys(obj) {
- if (!IS_SPEC_OBJECT(obj))
+ if (!IS_SPEC_OBJECT(obj)) {
throw MakeTypeError("obj_ctor_property_non_object", ["keys"]);
+ }
if (%IsJSProxy(obj)) {
var handler = %GetHandler(obj);
var names = CallTrap0(handler, "keys", DerivedKeysTrap);
// For Harmony proxies.
function ToCompletePropertyDescriptor(obj) {
- var desc = ToPropertyDescriptor(obj)
+ var desc = ToPropertyDescriptor(obj);
if (IsGenericDescriptor(desc) || IsDataDescriptor(desc)) {
if (!desc.hasValue()) desc.setValue(void 0);
if (!desc.hasWritable()) desc.setWritable(false);
// ES5 section 15.2.3.2.
function ObjectGetPrototypeOf(obj) {
- if (!IS_SPEC_OBJECT(obj))
+ if (!IS_SPEC_OBJECT(obj)) {
throw MakeTypeError("obj_ctor_property_non_object", ["getPrototypeOf"]);
+ }
return %GetPrototype(obj);
}
// ES5 section 15.2.3.3
function ObjectGetOwnPropertyDescriptor(obj, p) {
- if (!IS_SPEC_OBJECT(obj))
+ if (!IS_SPEC_OBJECT(obj)) {
throw MakeTypeError("obj_ctor_property_non_object",
["getOwnPropertyDescriptor"]);
+ }
var desc = GetOwnProperty(obj, p);
return FromPropertyDescriptor(desc);
}
}
var n = ToUint32(obj.length);
var array = new $Array(n);
- var names = {} // TODO(rossberg): use sets once they are ready.
+ var names = {}; // TODO(rossberg): use sets once they are ready.
for (var index = 0; index < n; index++) {
var s = ToString(obj[index]);
if (s in names) {
- throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s])
+ throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]);
}
array[index] = s;
names[s] = 0;
// ES5 section 15.2.3.4.
function ObjectGetOwnPropertyNames(obj) {
- if (!IS_SPEC_OBJECT(obj))
- throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]);
-
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError("obj_ctor_property_non_object",
+ ["getOwnPropertyNames"]);
+ }
// Special handling for proxies.
if (%IsJSProxy(obj)) {
var handler = %GetHandler(obj);
if (%GetInterceptorInfo(obj) & 1) {
var indexedInterceptorNames =
%GetIndexedInterceptorElementNames(obj);
- if (indexedInterceptorNames)
+ if (indexedInterceptorNames) {
propertyNames = propertyNames.concat(indexedInterceptorNames);
+ }
}
// Find all the named properties.
// We need to check for the exact property value since for intrinsic
// properties like toString if(propertySet["toString"]) will always
// succeed.
- if (propertySet[name] === true)
+ if (propertySet[name] === true) {
continue;
+ }
propertySet[name] = true;
propertyNames[j++] = name;
}
// ES5 section 15.2.3.7.
function ObjectDefineProperties(obj, properties) {
- if (!IS_SPEC_OBJECT(obj))
+ if (!IS_SPEC_OBJECT(obj)) {
throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]);
+ }
var props = ToObject(properties);
var names = GetOwnEnumerablePropertyNames(props);
var descriptors = new InternalArray();
function BooleanValueOf() {
// NOTE: Both Boolean objects and values can enter here as
// 'this'. This is not as dictated by ECMA-262.
- if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this))
+ if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this)) {
throw new $TypeError('Boolean.prototype.valueOf is not generic');
+ }
return %_ValueOf(this);
}
// 'this'. This is not as dictated by ECMA-262.
var number = this;
if (!IS_NUMBER(this)) {
- if (!IS_NUMBER_WRAPPER(this))
+ if (!IS_NUMBER_WRAPPER(this)) {
throw new $TypeError('Number.prototype.toString is not generic');
+ }
// Get the value of this number in case it's an object.
number = %_ValueOf(this);
}
function NumberValueOf() {
// NOTE: Both Number objects and values can enter here as
// 'this'. This is not as dictated by ECMA-262.
- if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this))
+ if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this)) {
throw new $TypeError('Number.prototype.valueOf is not generic');
+ }
return %_ValueOf(this);
}
if (!IS_UNDEFINED(fractionDigits)) {
f = TO_INTEGER(fractionDigits);
if (f < 0 || f > 20) {
- throw new $RangeError("toExponential() argument must be between 0 and 20");
+ throw new $RangeError(
+ "toExponential() argument must be between 0 and 20");
}
}
if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.2.
- %SetProperty($Number, "MIN_VALUE", 5e-324, DONT_ENUM | DONT_DELETE | READ_ONLY);
+ %SetProperty($Number, "MIN_VALUE", 5e-324,
+ DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.3.
%SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY);
}
// This runtime function finds any remaining arguments on the stack,
// so we don't pass the arguments object.
- var result = %FunctionBindArguments(boundFunction, this, this_arg, new_length);
+ var result = %FunctionBindArguments(boundFunction, this,
+ this_arg, new_length);
// We already have caller and arguments properties on functions,
// which are non-configurable. It therefore makes no sence to
assertEquals(23, new C().x);
C.prototype.__defineSetter__('x', function(value) { this.y = 23; });
-assertEquals(void 0, new C().x));
+assertEquals(void 0, new C().x);