Remove trailing regexp from .js files.

Removed trailing whitespace using regexp replace.  No other changes.

Review URL: http://codereview.chromium.org/1559006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4314 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 69bb1100
......@@ -1150,7 +1150,7 @@ function SetupArray() {
"reduce", getFunction("reduce", ArrayReduce, 1),
"reduceRight", getFunction("reduceRight", ArrayReduceRight, 1)
));
%FinishArrayPrototypeSetup($Array.prototype);
}
......
......@@ -164,7 +164,7 @@ function DebugEventDetails(response) {
Debug.State.currentFrame = 0;
details.text = result;
break;
case 'exception':
if (body.uncaught) {
result += 'Uncaught: ';
......@@ -212,7 +212,7 @@ function DebugEventDetails(response) {
function SourceInfo(body) {
var result = '';
if (body.script) {
if (body.script.name) {
result += body.script.name;
......@@ -224,7 +224,7 @@ function SourceInfo(body) {
result += body.sourceLine + 1;
result += ' column ';
result += body.sourceColumn + 1;
return result;
}
......@@ -297,20 +297,20 @@ function DebugRequest(cmd_line) {
case 'bt':
this.request_ = this.backtraceCommandToJSONRequest_(args);
break;
case 'frame':
case 'f':
this.request_ = this.frameCommandToJSONRequest_(args);
break;
case 'scopes':
this.request_ = this.scopesCommandToJSONRequest_(args);
break;
case 'scope':
this.request_ = this.scopeCommandToJSONRequest_(args);
break;
case 'print':
case 'p':
this.request_ = this.printCommandToJSONRequest_(args);
......@@ -331,16 +331,16 @@ function DebugRequest(cmd_line) {
case 'source':
this.request_ = this.sourceCommandToJSONRequest_(args);
break;
case 'scripts':
this.request_ = this.scriptsCommandToJSONRequest_(args);
break;
case 'break':
case 'b':
this.request_ = this.breakCommandToJSONRequest_(args);
break;
case 'clear':
this.request_ = this.clearCommandToJSONRequest_(args);
break;
......@@ -365,7 +365,7 @@ function DebugRequest(cmd_line) {
default:
throw new Error('Unknown command "' + cmd + '"');
}
last_cmd = cmd;
}
......@@ -490,22 +490,22 @@ DebugRequest.prototype.stepCommandToJSONRequest_ = function(args) {
case 'i':
request.arguments.stepaction = 'in';
break;
case 'min':
case 'm':
request.arguments.stepaction = 'min';
break;
case 'next':
case 'n':
request.arguments.stepaction = 'next';
break;
case 'out':
case 'o':
request.arguments.stepaction = 'out';
break;
default:
throw new Error('Invalid step argument "' + args[0] + '".');
}
......@@ -523,7 +523,7 @@ DebugRequest.prototype.stepCommandToJSONRequest_ = function(args) {
DebugRequest.prototype.backtraceCommandToJSONRequest_ = function(args) {
// Build a backtrace request from the text command.
var request = this.createRequest('backtrace');
// Default is to show top 10 frames.
request.arguments = {};
request.arguments.fromFrame = 0;
......@@ -626,7 +626,7 @@ DebugRequest.prototype.referencesCommandToJSONRequest_ = function(args) {
if (args.length == 0) {
throw new Error('Missing object id.');
}
return this.makeReferencesJSONRequest_(args, 'referencedBy');
};
......@@ -637,7 +637,7 @@ DebugRequest.prototype.instancesCommandToJSONRequest_ = function(args) {
if (args.length == 0) {
throw new Error('Missing object id.');
}
// Build a references request.
return this.makeReferencesJSONRequest_(args, 'constructedBy');
};
......@@ -691,18 +691,18 @@ DebugRequest.prototype.scriptsCommandToJSONRequest_ = function(args) {
case 'natives':
request.arguments.types = ScriptTypeFlag(Debug.ScriptType.Native);
break;
case 'extensions':
request.arguments.types = ScriptTypeFlag(Debug.ScriptType.Extension);
break;
case 'all':
request.arguments.types =
ScriptTypeFlag(Debug.ScriptType.Normal) |
ScriptTypeFlag(Debug.ScriptType.Native) |
ScriptTypeFlag(Debug.ScriptType.Extension);
break;
default:
throw new Error('Invalid argument "' + args[0] + '".');
}
......@@ -740,7 +740,7 @@ DebugRequest.prototype.breakCommandToJSONRequest_ = function(args) {
type = 'script';
var tmp = target.substring(pos + 1, target.length);
target = target.substring(0, pos);
// Check for both line and column.
pos = tmp.indexOf(':');
if (pos > 0) {
......@@ -755,7 +755,7 @@ DebugRequest.prototype.breakCommandToJSONRequest_ = function(args) {
} else {
type = 'function';
}
request.arguments = {};
request.arguments.type = type;
request.arguments.target = target;
......@@ -936,13 +936,13 @@ function DebugResponseDetails(response) {
result += body.breakpoint;
details.text = result;
break;
case 'clearbreakpoint':
result = 'cleared breakpoint #';
result += body.breakpoint;
details.text = result;
break;
case 'backtrace':
if (body.totalFrames == 0) {
result = '(empty stack)';
......@@ -956,14 +956,14 @@ function DebugResponseDetails(response) {
}
details.text = result;
break;
case 'frame':
details.text = SourceUnderline(body.sourceLineText,
body.column);
Debug.State.currentSourceLine = body.line;
Debug.State.currentFrame = body.index;
break;
case 'scopes':
if (body.totalScopes == 0) {
result = '(no scopes)';
......@@ -987,7 +987,7 @@ function DebugResponseDetails(response) {
result += formatObject_(scope_object_value, true);
details.text = result;
break;
case 'evaluate':
case 'lookup':
if (last_cmd == 'p' || last_cmd == 'print') {
......@@ -1031,7 +1031,7 @@ function DebugResponseDetails(response) {
}
details.text = result;
break;
case 'source':
// Get the source from the response.
var source = body.source;
......@@ -1066,7 +1066,7 @@ function DebugResponseDetails(response) {
}
details.text = result;
break;
case 'scripts':
var result = '';
for (i = 0; i < body.length; i++) {
......@@ -1128,7 +1128,7 @@ function DebugResponseDetails(response) {
case 'continue':
details.text = "(running)";
break;
default:
details.text =
'Response for unknown command \'' + response.command + '\'' +
......@@ -1137,7 +1137,7 @@ function DebugResponseDetails(response) {
} catch (e) {
details.text = 'Error: "' + e + '" formatting response';
}
return details;
};
......@@ -1254,7 +1254,7 @@ ProtocolValue.prototype.type = function() {
/**
* Get a metadata field from a protocol value.
* Get a metadata field from a protocol value.
* @return {Object} the metadata field value
*/
ProtocolValue.prototype.field = function(name) {
......@@ -1435,12 +1435,12 @@ function ArrayToJSONArray_(content) {
function BooleanToJSON_(value) {
return String(value);
return String(value);
}
function NumberToJSON_(value) {
return String(value);
return String(value);
}
......
......@@ -1274,7 +1274,7 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request)
// Response controls running state.
this.running_ = response.running;
}
response.running = this.running_;
response.running = this.running_;
return response.toJSONProtocol();
} catch (e) {
// Failed to generate response - return generic error.
......@@ -1870,12 +1870,12 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) {
return response.failed('Invalid types "' + request.arguments.types + '"');
}
}
if (!IS_UNDEFINED(request.arguments.includeSource)) {
includeSource = %ToBoolean(request.arguments.includeSource);
response.setOption('includeSource', includeSource);
}
if (IS_ARRAY(request.arguments.ids)) {
idsToInclude = {};
var ids = request.arguments.ids;
......@@ -1973,7 +1973,7 @@ DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response)
response.failed('Argument "new_string" is not a string value');
return;
}
var scripts = %DebugGetLoadedScripts();
var the_script = null;
......@@ -1986,7 +1986,7 @@ DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response)
response.failed('Script not found');
return;
}
var change_log = new Array();
try {
Debug.LiveEditChangeScript(the_script, change_pos, change_len, new_string,
......@@ -1995,7 +1995,7 @@ DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response)
if (e instanceof Debug.LiveEditChangeScript.Failure) {
// Let's treat it as a "success" so that body with change_log will be
// sent back. "change_log" will have "failure" field set.
change_log.push( { failure: true } );
change_log.push( { failure: true } );
} else {
throw e;
}
......@@ -2076,7 +2076,7 @@ function ObjectToProtocolObject_(object, mirror_serializer) {
}
}
}
return content;
}
......@@ -2099,7 +2099,7 @@ function ArrayToProtocolArray_(array, mirror_serializer) {
/**
* Convert a value to its debugger protocol representation.
* Convert a value to its debugger protocol representation.
* @param {*} value The value to format as protocol value.
* @param {MirrorSerializer} mirror_serializer The serializer to use if any
* mirror objects are encountered.
......
......@@ -32,14 +32,14 @@
// Changes script text and recompiles all relevant functions if possible.
// The change is always a substring (change_pos, change_pos + change_len)
// being replaced with a completely different string new_str.
//
//
// Only one function will have its Code changed in result of this function.
// All nested functions (should they have any instances at the moment) are left
// unchanged and re-linked to a newly created script instance representing old
// version of the source. (Generally speaking,
// during the change all nested functions are erased and completely different
// set of nested functions are introduced.) All other functions just have
// their positions updated.
// their positions updated.
//
// @param {Script} script that is being changed
// @param {Array} change_log a list that collects engineer-readable description
......@@ -56,9 +56,9 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
// Elements of array are ordered by start positions of functions (from top
// to bottom) in the source. Fields outer_index and next_sibling_index help
// to navigate the nesting structure of functions.
//
// The script is used for compilation, because it produces code that
// needs to be linked with some particular script (for nested functions).
//
// The script is used for compilation, because it produces code that
// needs to be linked with some particular script (for nested functions).
function DebugGatherCompileInfo(source) {
// Get function info, elements are partially sorted (it is a tree
// of nested functions serialized as parent followed by serialized children.
......@@ -71,7 +71,7 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
compile_info.push(new liveedit.FunctionCompileInfo(raw_compile_info[i]));
old_index_map.push(i);
}
for (var i = 0; i < compile_info.length; i++) {
var k = i;
for (var j = i + 1; j < compile_info.length; j++) {
......@@ -112,12 +112,12 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
compile_info[previous_sibling].next_sibling_index = -1;
}
}
ResetIndexes(-1, -1);
Assert(current_index == compile_info.length);
return compile_info;
}
}
// Given a positions, finds a function that fully includes the entire change.
function FindChangedFunction(compile_info, offset, len) {
......@@ -148,7 +148,7 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
var old_info = old_compile_info[index];
for (var i = 0; i < shared_infos.length; i++) {
var info = shared_infos[i];
if (info.start_position == old_info.start_position &&
if (info.start_position == old_info.start_position &&
info.end_position == old_info.end_position) {
return info;
}
......@@ -161,7 +161,7 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
change_log.push( {function_patched: new_info.function_name} );
}
var change_len_old;
var change_len_new;
// Translate position in old version of script into position in new
......@@ -175,7 +175,7 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
}
return -1;
}
var position_change_array;
var position_patch_report;
function PatchPositions(new_info, shared_info) {
......@@ -187,7 +187,7 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
position_change_array);
position_patch_report.push( { name: new_info.function_name } );
}
var link_to_old_script_report;
var old_script;
// Makes a function associated with another instance of a script (the
......@@ -195,16 +195,16 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
// may access its own text.
function LinkToOldScript(shared_info) {
%LiveEditRelinkFunctionToScript(shared_info.raw_array, old_script);
link_to_old_script_report.push( { name: shared_info.function_name } );
}
var old_source = script.source;
var change_len_old = change_len;
var change_len_new = new_str.length;
// Prepare new source string.
var new_source = old_source.substring(0, change_pos) +
new_str + old_source.substring(change_pos + change_len);
......@@ -217,10 +217,10 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
for (var i = 0; i < shared_raw_list.length; i++) {
shared_infos.push(new liveedit.SharedInfoWrapper(shared_raw_list[i]));
}
// Gather compile information about old version of script.
var old_compile_info = DebugGatherCompileInfo(old_source);
// Gather compile information about new version of script.
var new_compile_info;
try {
......@@ -247,20 +247,20 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
old_compile_info[function_being_patched],
new_compile_info[function_being_patched])) {
Assert(old_compile_info[function_being_patched].outer_index ==
Assert(old_compile_info[function_being_patched].outer_index ==
new_compile_info[function_being_patched].outer_index);
function_being_patched =
old_compile_info[function_being_patched].outer_index;
Assert(function_being_patched != -1);
}
// Check that function being patched is not currently on stack.
liveedit.CheckStackActivations(
[ FindFunctionInfo(function_being_patched) ], change_log );
// Committing all changes.
var old_script_name = liveedit.CreateNameForOldScript(script);
var old_script_name = liveedit.CreateNameForOldScript(script);
// Update the script text and create a new script representing an old
// version of the script.
......@@ -271,11 +271,11 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
var position_patch_report = new Array();
change_log.push( {position_patched: position_patch_report} );
var position_change_array = [ change_pos,
change_pos + change_len_old,
change_pos + change_len_new ];
// Update positions of all outer functions (i.e. all functions, that
// are partially below the function being patched).
for (var i = new_compile_info[function_being_patched].outer_index;
......@@ -308,7 +308,7 @@ Debug.LiveEditChangeScript = function(script, change_pos, change_len, new_str,
var link_to_old_script_report = new Array();
change_log.push( { linked_to_old_script: link_to_old_script_report } );
// We need to link to old script all former nested functions.
// We need to link to old script all former nested functions.
for (var i = function_being_patched + 1; i < old_next_sibling; i++) {
LinkToOldScript(FindFunctionInfo(i), old_script);
}
......@@ -323,7 +323,7 @@ Debug.LiveEditChangeScript.Assert = function(condition, message) {
}
}
}
// An object describing function compilation details. Its index fields
// apply to indexes inside array that stores these objects.
Debug.LiveEditChangeScript.FunctionCompileInfo = function(raw_array) {
......@@ -337,7 +337,7 @@ Debug.LiveEditChangeScript.FunctionCompileInfo = function(raw_array) {
this.next_sibling_index = null;
this.raw_array = raw_array;
}
// A structure describing SharedFunctionInfo.
Debug.LiveEditChangeScript.SharedInfoWrapper = function(raw_array) {
this.function_name = raw_array[0];
......@@ -364,18 +364,18 @@ Debug.LiveEditChangeScript.CompareFunctionExpectations =
}
var scope_info1 = function_info1.scope_info;
var scope_info2 = function_info2.scope_info;
if (!scope_info1) {
return !scope_info2;
}
if (scope_info1.length != scope_info2.length) {
return false;
}
// Check that outer scope structure is not changed. Otherwise the function
// will not properly work with existing scopes.
return scope_info1.toString() == scope_info2.toString();
return scope_info1.toString() == scope_info2.toString();
}
// For array of wrapped shared function infos checks that none of them
......@@ -384,7 +384,7 @@ Debug.LiveEditChangeScript.CompareFunctionExpectations =
Debug.LiveEditChangeScript.CheckStackActivations = function(shared_wrapper_list,
change_log) {
var liveedit = Debug.LiveEditChangeScript;
var shared_list = new Array();
for (var i = 0; i < shared_wrapper_list.length; i++) {
shared_list[i] = shared_wrapper_list[i].info;
......@@ -396,7 +396,7 @@ Debug.LiveEditChangeScript.CheckStackActivations = function(shared_wrapper_list,
var shared = shared_list[i];
var description = {
name: shared.function_name,
start_pos: shared.start_position,
start_pos: shared.start_position,
end_pos: shared.end_position
};
problems.push(description);
......@@ -422,7 +422,7 @@ Debug.LiveEditChangeScript.Failure = function(message) {
}
Debug.LiveEditChangeScript.Failure.prototype.toString = function() {
return "LiveEdit Failure: " + this.message;
return "LiveEdit Failure: " + this.message;
}
// A testing entry.
......
......@@ -743,7 +743,7 @@ function FormatEvalOrigin(script) {
} else {
eval_origin += "<anonymous>";
}
var eval_from_script = script.eval_from_script;
if (eval_from_script) {
if (eval_from_script.compilation_type == COMPILATION_TYPE_EVAL) {
......@@ -764,7 +764,7 @@ function FormatEvalOrigin(script) {
}
}
}
return eval_origin;
};
......
......@@ -67,7 +67,7 @@ function MakeMirror(value, opt_transient) {
}
}
}
if (IS_UNDEFINED(value)) {
mirror = new UndefinedMirror();
} else if (IS_NULL(value)) {
......@@ -110,7 +110,7 @@ function LookupMirror(handle) {
return mirror_cache_[handle];
}
/**
* Returns the mirror for the undefined value.
*
......@@ -622,7 +622,7 @@ ObjectMirror.prototype.propertyNames = function(kind, limit) {
var propertyNames;
var elementNames;
var total = 0;
// Find all the named properties.
if (kind & PropertyKind.Named) {
// Get the local property names.
......@@ -1223,7 +1223,7 @@ PropertyMirror.prototype.setter = function() {
/**
* Returns whether this property is natively implemented by the host or a set
* through JavaScript code.
* @return {boolean} True if the property is
* @return {boolean} True if the property is
* UndefinedMirror if there is no setter for this property
*/
PropertyMirror.prototype.isNative = function() {
......@@ -1390,7 +1390,7 @@ FrameMirror.prototype.index = function() {
FrameMirror.prototype.func = function() {
// Get the function for this frame from the VM.
var f = this.details_.func();
// Create a function mirror. NOTE: MakeMirror cannot be used here as the
// value returned from the VM might be a string if the function for the
// frame is unresolved.
......@@ -1825,17 +1825,17 @@ ScriptMirror.prototype.toText = function() {
/**
* Returns a suggested script URL from comments in script code (if found),
* Returns a suggested script URL from comments in script code (if found),
* undefined otherwise. Used primarily by debuggers for identifying eval()'ed
* scripts. See
* scripts. See
* http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt
* for details.
*
*
* @return {?string} value for //@ sourceURL comment
*/
ScriptMirror.prototype.sourceUrlFromComment_ = function() {
if (!('sourceUrl_' in this) && this.source()) {
// TODO(608): the spaces in a regexp below had to be escaped as \040
// TODO(608): the spaces in a regexp below had to be escaped as \040
// because this file is being processed by js2c whose handling of spaces
// in regexps is broken.
// We're not using \s here to prevent \n from matching.
......@@ -1928,10 +1928,10 @@ JSONProtocolSerializer.prototype.serializeValue = function(mirror) {
JSONProtocolSerializer.prototype.serializeReferencedObjects = function() {
// Collect the protocol representation of the referenced objects in an array.
var content = [];
// Get the number of referenced objects.
var count = this.mirrors_.length;
for (var i = 0; i < count; i++) {
content.push(this.serialize_(this.mirrors_[i], false, false));
}
......@@ -1966,7 +1966,7 @@ JSONProtocolSerializer.prototype.add_ = function(mirror) {
return;
}
}
// Add the mirror to the list of mirrors to be serialized.
this.mirrors_.push(mirror);
}
......@@ -1978,7 +1978,7 @@ JSONProtocolSerializer.prototype.add_ = function(mirror) {
* @param {Mirror} mirror Mirror to serialize.
* @return {Object} Protocol reference object.
*/
JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ =
JSONProtocolSerializer.prototype.serializeReferenceWithDisplayData_ =
function(mirror) {
var o = {};
o.ref = mirror.handle();
......@@ -2025,7 +2025,7 @@ JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
return {'ref' : mirror.handle()};
}
}
// Collect the JSON property/value pairs.
var content = {};
......@@ -2137,7 +2137,7 @@ JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
// Always add the text representation.
content.text = mirror.toText();
// Create and return the JSON string.
return content;
}
......@@ -2170,7 +2170,7 @@ JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
if (mirror.hasIndexedInterceptor()) {
content.indexedInterceptor = true;
}
// Add function specific properties.
if (mirror.isFunction()) {
// Add function specific properties.
......@@ -2185,7 +2185,7 @@ JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
if (mirror.script()) {
content.script = this.serializeReference(mirror.script());
content.scriptId = mirror.script().id();
serializeLocationFields(mirror.sourceLocation(), content);
}
}
......@@ -2224,13 +2224,13 @@ JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
* "position":"<position>",
* "line":"<line>",
* "column":"<column>",
*
*
* @param {SourceLocation} location The location to serialize, may be undefined.
*/
function serializeLocationFields (location, content) {
if (!location) {
return;
}
}
content.position = location.position;
var line = location.line;
if (!IS_UNDEFINED(line)) {
......@@ -2264,7 +2264,7 @@ function serializeLocationFields (location, content) {
*/
JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) {
var result = {};
result.name = propertyMirror.name();
var propertyValue = propertyMirror.value();
if (this.inlineRefs_() && propertyValue.isValue()) {
......@@ -2316,7 +2316,7 @@ JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) {
if (!IS_UNDEFINED(source_line_text)) {
content.sourceLineText = source_line_text;
}
content.scopes = [];
for (var i = 0; i < mirror.scopeCount(); i++) {
var scope = mirror.scope(i);
......@@ -2358,5 +2358,5 @@ function NumberToJSON_(value) {
return '-Infinity';
}
}
return value;
return value;
}
......@@ -333,7 +333,7 @@ function RegExpGetLastMatch() {
function RegExpGetLastParen() {
if (lastMatchInfoOverride) {
var override = lastMatchInfoOverride;
if (override.length <= 3) return '';
if (override.length <= 3) return '';
return override[override.length - 3];
}
var length = NUMBER_OF_CAPTURES(lastMatchInfo);
......@@ -416,8 +416,8 @@ var lastMatchInfo = [
// Override last match info with an array of actual substrings.
// Used internally by replace regexp with function.
// The array has the format of an "apply" argument for a replacement
// function.
// The array has the format of an "apply" argument for a replacement
// function.
var lastMatchInfoOverride = null;
// -------------------------------------------------------------------
......@@ -439,7 +439,7 @@ function SetupRegExp() {
%FunctionSetLength($RegExp.prototype.compile, 1);
// The properties input, $input, and $_ are aliases for each other. When this
// value is set the value it is set to is coerced to a string.
// value is set the value it is set to is coerced to a string.
// Getter and setter for the input.
function RegExpGetInput() {
var regExpInput = LAST_INPUT(lastMatchInfo);
......
......@@ -577,11 +577,11 @@ function SameValue(x, y) {
if (IS_NUMBER(x)) {
if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true;
// x is +0 and y is -0 or vice versa
if (x === 0 && y === 0 && !%_IsSmi(x) && !%_IsSmi(y) &&
if (x === 0 && y === 0 && !%_IsSmi(x) && !%_IsSmi(y) &&
((1 / x < 0 && 1 / y > 0) || (1 / x > 0 && 1 / y < 0))) {
return false;
}
return x == y;
return x == y;
}
if (IS_STRING(x)) return %StringEquals(x, y);
if (IS_BOOLEAN(x))return %NumberEquals(%ToNumber(x),%ToNumber(y));
......
......@@ -406,7 +406,7 @@ function addCaptureString(builder, matchInfo, index) {
};
// TODO(lrn): This array will survive indefinitely if replace is never
// called again. However, it will be empty, since the contents are cleared
// called again. However, it will be empty, since the contents are cleared
// in the finally block.
var reusableReplaceArray = $Array(16);
......@@ -427,16 +427,16 @@ function StringReplaceRegExpWithFunction(subject, regexp, replace) {
try {
// Must handle exceptions thrown by the replace functions correctly,
// including unregistering global regexps.
var res = %RegExpExecMultiple(regexp,
subject,
lastMatchInfo,
var res = %RegExpExecMultiple(regexp,
subject,
lastMatchInfo,
resultArray);
regexp.lastIndex = 0;
if (IS_NULL(res)) {
// No matches at all.
return subject;
}
var len = res.length;
// No matches at all.
return subject;
}
var len = res.length;
var i = 0;
if (NUMBER_OF_CAPTURES(lastMatchInfo) == 2) {
var match_start = 0;
......@@ -457,8 +457,8 @@ function StringReplaceRegExpWithFunction(subject, regexp, replace) {
match_start += elem.length;
}
i++;
}
} else {
}
} else {
while (i < len) {
var elem = res[i];
if (!%_IsSmi(elem)) {
......@@ -484,7 +484,7 @@ function StringReplaceRegExpWithFunction(subject, regexp, replace) {
} else { // Not a global regexp, no need to loop.
var matchInfo = DoRegExpExec(regexp, subject, 0);
if (IS_NULL(matchInfo)) return subject;
var result = new ReplaceResultBuilder(subject);
result.addSpecialSlice(0, matchInfo[CAPTURE0]);
var endOfMatch = matchInfo[CAPTURE1];
......@@ -520,7 +520,7 @@ function ApplyReplacementFunction(replace, matchInfo, subject) {
// ECMA-262 section 15.5.4.12
function StringSearch(re) {
function StringSearch(re) {
var regexp = new $RegExp(re);
var s = TO_STRING_INLINE(this);
var match = DoRegExpExec(regexp, s, 0);
......
......@@ -244,7 +244,7 @@ function URIDecode(uri) {
if (cc == 61) return true;
// ?@
if (63 <= cc && cc <= 64) return true;
return false;
};
var string = ToString(uri);
......@@ -268,7 +268,7 @@ function isAlphaNumeric(cc) {
if (65 <= cc && cc <= 90) return true;
// 0 - 9
if (48 <= cc && cc <= 57) return true;
return false;
}
......@@ -293,7 +293,7 @@ function URIEncode(uri) {
if (cc == 95) return true;
// ~
if (cc == 126) return true;
return false;
};
......@@ -316,7 +316,7 @@ function URIEncodeComponent(component) {
if (cc == 95) return true;
// ~
if (cc == 126) return true;
return false;
};
......@@ -327,14 +327,14 @@ function URIEncodeComponent(component) {
function HexValueOf(c) {
var code = c.charCodeAt(0);
// 0-9
if (code >= 48 && code <= 57) return code - 48;
// A-F
if (code >= 65 && code <= 70) return code - 55;
// a-f
if (code >= 97 && code <= 102) return code - 87;
return -1;
}
......
......@@ -482,7 +482,7 @@ PropertyDescriptor.prototype.hasSetter = function() {
// ES5 section 8.12.1.
function GetOwnProperty(obj, p) {
var desc = new PropertyDescriptor();
// An array with:
// obj is a data property [false, value, Writeable, Enumerable, Configurable]
// obj is an accessor [true, Get, Set, Enumerable, Configurable]
......@@ -522,7 +522,7 @@ function HasProperty(obj, p) {
}
// ES5 8.12.9.
// ES5 8.12.9.
function DefineOwnProperty(obj, p, desc, should_throw) {
var current = GetOwnProperty(obj, p);
var extensible = %IsExtensible(ToObject(obj));
......@@ -558,7 +558,7 @@ function DefineOwnProperty(obj, p, desc, should_throw) {
}
}
// Send flags - enumerable and configurable are common - writable is
// Send flags - enumerable and configurable are common - writable is
// only send to the data descriptor.
// Take special care if enumerable and configurable is not defined on
// desc (we need to preserve the existing values from current).
......@@ -602,7 +602,7 @@ function ObjectGetPrototypeOf(obj) {
}
// ES5 section 15.2.3.3
// ES5 section 15.2.3.3
function ObjectGetOwnPropertyDescriptor(obj, p) {
if ((!IS_OBJECT(obj) || IS_NULL_OR_UNDEFINED(obj)) && !IS_FUNCTION(obj) &&
!IS_UNDETECTABLE(obj))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment