Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1247)

Side by Side Diff: src/messages.js

Issue 215052: * Remove non-Open Source code from Douglas Crockford.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 14 matching lines...) Expand all
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 28
29 // ------------------------------------------------------------------- 29 // -------------------------------------------------------------------
30 30
31 // Lazily initialized. 31 // Lazily initialized.
32 var kVowelSounds = 0; 32 var kVowelSounds = 0;
33 var kCapitalVowelSounds = 0; 33 var kCapitalVowelSounds = 0;
34 34
35 // If this object gets passed to an error constructor the error will
36 // get an accessor for .message that constructs a descriptive error
37 // message on access.
38 var kAddMessageAccessorsMarker = { };
39
35 40
36 function GetInstanceName(cons) { 41 function GetInstanceName(cons) {
37 if (cons.length == 0) { 42 if (cons.length == 0) {
38 return ""; 43 return "";
39 } 44 }
40 var first = %StringToLowerCase(StringCharAt.call(cons, 0)); 45 var first = %StringToLowerCase(StringCharAt.call(cons, 0));
41 if (kVowelSounds === 0) { 46 if (kVowelSounds === 0) {
42 kVowelSounds = {a: true, e: true, i: true, o: true, u: true, y: true}; 47 kVowelSounds = {a: true, e: true, i: true, o: true, u: true, y: true};
43 kCapitalVowelSounds = {a: true, e: true, i: true, o: true, u: true, h: true, 48 kCapitalVowelSounds = {a: true, e: true, i: true, o: true, u: true, h: true,
44 f: true, l: true, m: true, n: true, r: true, s: true, x: true, y: true}; 49 f: true, l: true, m: true, n: true, r: true, s: true, x: true, y: true};
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 563 }
559 564
560 565
561 function GetStackTraceLine(recv, fun, pos, isGlobal) { 566 function GetStackTraceLine(recv, fun, pos, isGlobal) {
562 return FormatSourcePosition(new CallSite(recv, fun, pos)); 567 return FormatSourcePosition(new CallSite(recv, fun, pos));
563 } 568 }
564 569
565 // ---------------------------------------------------------------------------- 570 // ----------------------------------------------------------------------------
566 // Error implementation 571 // Error implementation
567 572
568 // If this object gets passed to an error constructor the error will
569 // get an accessor for .message that constructs a descriptive error
570 // message on access.
571 var kAddMessageAccessorsMarker = { };
572
573 // Defines accessors for a property that is calculated the first time 573 // Defines accessors for a property that is calculated the first time
574 // the property is read. 574 // the property is read.
575 function DefineOneShotAccessor(obj, name, fun) { 575 function DefineOneShotAccessor(obj, name, fun) {
576 // Note that the accessors consistently operate on 'obj', not 'this'. 576 // Note that the accessors consistently operate on 'obj', not 'this'.
577 // Since the object may occur in someone else's prototype chain we 577 // Since the object may occur in someone else's prototype chain we
578 // can't rely on 'this' being the same as 'obj'. 578 // can't rely on 'this' being the same as 'obj'.
579 var hasBeenSet = false; 579 var hasBeenSet = false;
580 var value; 580 var value;
581 obj.__defineGetter__(name, function () { 581 obj.__defineGetter__(name, function () {
582 if (hasBeenSet) { 582 if (hasBeenSet) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 lines.push(error.toString()); 774 lines.push(error.toString());
775 } catch (e) { 775 } catch (e) {
776 try { 776 try {
777 lines.push("<error: " + e + ">"); 777 lines.push("<error: " + e + ">");
778 } catch (ee) { 778 } catch (ee) {
779 lines.push("<error>"); 779 lines.push("<error>");
780 } 780 }
781 } 781 }
782 for (var i = 0; i < frames.length; i++) { 782 for (var i = 0; i < frames.length; i++) {
783 var frame = frames[i]; 783 var frame = frames[i];
784 var line;
784 try { 785 try {
785 var line = FormatSourcePosition(frame); 786 line = FormatSourcePosition(frame);
786 } catch (e) { 787 } catch (e) {
787 try { 788 try {
788 var line = "<error: " + e + ">"; 789 line = "<error: " + e + ">";
789 } catch (ee) { 790 } catch (ee) {
790 // Any code that reaches this point is seriously nasty! 791 // Any code that reaches this point is seriously nasty!
791 var line = "<error>"; 792 line = "<error>";
792 } 793 }
793 } 794 }
794 lines.push(" at " + line); 795 lines.push(" at " + line);
795 } 796 }
796 return lines.join("\n"); 797 return lines.join("\n");
797 } 798 }
798 799
799 function FormatRawStackTrace(error, raw_stack) { 800 function FormatRawStackTrace(error, raw_stack) {
800 var frames = [ ]; 801 var frames = [ ];
801 for (var i = 0; i < raw_stack.length; i += 3) { 802 for (var i = 0; i < raw_stack.length; i += 3) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 return this.name + ": " + FormatMessage({ type: type, args: this.arguments } ); 888 return this.name + ": " + FormatMessage({ type: type, args: this.arguments } );
888 } 889 }
889 var message = this.message; 890 var message = this.message;
890 return this.name + (message ? (": " + message) : ""); 891 return this.name + (message ? (": " + message) : "");
891 }, DONT_ENUM); 892 }, DONT_ENUM);
892 893
893 894
894 // Boilerplate for exceptions for stack overflows. Used from 895 // Boilerplate for exceptions for stack overflows. Used from
895 // Top::StackOverflow(). 896 // Top::StackOverflow().
896 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); 897 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []);
OLDNEW
« no previous file with comments | « src/debug-delay.js ('k') | src/mirror-delay.js » ('j') | tools/jsmin.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698