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

Side by Side Diff: frog/frogsh

Issue 8590017: Fix "is Object" to always be true in Dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: take2 after syncing Created 9 years, 1 month 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
« no previous file with comments | « no previous file | frog/gen.dart » ('j') | frog/value.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 /** 4 /**
5 * Generates a dynamic call stub for a function. 5 * Generates a dynamic call stub for a function.
6 * Our goal is to create a stub method like this on-the-fly: 6 * Our goal is to create a stub method like this on-the-fly:
7 * function($0, $1, capture) { this($0, $1, true, capture); } 7 * function($0, $1, capture) { this($0, $1, true, capture); }
8 * 8 *
9 * This stub then replaces the dynamic one on Function, with one that is 9 * This stub then replaces the dynamic one on Function, with one that is
10 * specialized for that particular function, taking into account its default 10 * specialized for that particular function, taking into account its default
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 this._previous = null; 1783 this._previous = null;
1784 return this._element; 1784 return this._element;
1785 } 1785 }
1786 DoubleLinkedQueueEntry$E.prototype._asNonSentinelEntry = function() { 1786 DoubleLinkedQueueEntry$E.prototype._asNonSentinelEntry = function() {
1787 return this; 1787 return this;
1788 } 1788 }
1789 DoubleLinkedQueueEntry$E.prototype.previousEntry = function() { 1789 DoubleLinkedQueueEntry$E.prototype.previousEntry = function() {
1790 return this._previous._asNonSentinelEntry(); 1790 return this._previous._asNonSentinelEntry();
1791 } 1791 }
1792 // ********** Code for DoubleLinkedQueueEntry$KeyValuePair$K$V ************** 1792 // ********** Code for DoubleLinkedQueueEntry$KeyValuePair$K$V **************
1793 function DoubleLinkedQueueEntry$KeyValuePair$K$V(e) { 1793 function DoubleLinkedQueueEntry$KeyValuePair$K$V() {}
1794 // Initializers done
1795 this._element = e;
1796 }
1797 $inherits(DoubleLinkedQueueEntry$KeyValuePair$K$V, DoubleLinkedQueueEntry); 1794 $inherits(DoubleLinkedQueueEntry$KeyValuePair$K$V, DoubleLinkedQueueEntry);
1798 DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V = function(){return this;}; 1795 DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V = function(){return this;};
1799 DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype._asNonSentinelEntry = function () {
1800 return this;
1801 }
1802 // ********** Code for _DoubleLinkedQueueEntrySentinel ************** 1796 // ********** Code for _DoubleLinkedQueueEntrySentinel **************
1803 function _DoubleLinkedQueueEntrySentinel() { 1797 function _DoubleLinkedQueueEntrySentinel() {
1804 DoubleLinkedQueueEntry$E.call(this, null); 1798 DoubleLinkedQueueEntry$E.call(this, null);
1805 // Initializers done 1799 // Initializers done
1806 this._link(this, this); 1800 this._link(this, this);
1807 } 1801 }
1808 $inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry$E); 1802 $inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry$E);
1809 _DoubleLinkedQueueEntrySentinel.prototype.remove = function() { 1803 _DoubleLinkedQueueEntrySentinel.prototype.remove = function() {
1810 $throw(const$3/*const EmptyQueueException()*/); 1804 $throw(const$3/*const EmptyQueueException()*/);
1811 } 1805 }
1812 _DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry = function() { 1806 _DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry = function() {
1813 return null; 1807 return null;
1814 } 1808 }
1815 _DoubleLinkedQueueEntrySentinel.prototype.get$element = function() { 1809 _DoubleLinkedQueueEntrySentinel.prototype.get$element = function() {
1816 $throw(const$3/*const EmptyQueueException()*/); 1810 $throw(const$3/*const EmptyQueueException()*/);
1817 } 1811 }
1818 // ********** Code for _DoubleLinkedQueueEntrySentinel$E ************** 1812 // ********** Code for _DoubleLinkedQueueEntrySentinel$E **************
1819 function _DoubleLinkedQueueEntrySentinel$E() { 1813 function _DoubleLinkedQueueEntrySentinel$E() {
1820 DoubleLinkedQueueEntry$E.call(this, null); 1814 DoubleLinkedQueueEntry$E.call(this, null);
1821 // Initializers done 1815 // Initializers done
1822 this._link(this, this); 1816 this._link(this, this);
1823 } 1817 }
1824 $inherits(_DoubleLinkedQueueEntrySentinel$E, _DoubleLinkedQueueEntrySentinel); 1818 $inherits(_DoubleLinkedQueueEntrySentinel$E, _DoubleLinkedQueueEntrySentinel);
1825 _DoubleLinkedQueueEntrySentinel$E.prototype._link = function(p, n) {
1826 this._next = n;
1827 this._previous = p;
1828 p._next = this;
1829 n._previous = this;
1830 }
1831 _DoubleLinkedQueueEntrySentinel$E.prototype.prepend = function(e) {
1832 new DoubleLinkedQueueEntry$E(e)._link(this._previous, this);
1833 }
1834 _DoubleLinkedQueueEntrySentinel$E.prototype.previousEntry = function() {
1835 return this._previous._asNonSentinelEntry();
1836 }
1837 // ********** Code for _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V ******** ****** 1819 // ********** Code for _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V ******** ******
1838 function _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V() { 1820 function _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V() {
1839 DoubleLinkedQueueEntry$E.call(this, null); 1821 DoubleLinkedQueueEntry$E.call(this, null);
1840 // Initializers done 1822 // Initializers done
1841 this._link(this, this); 1823 this._link(this, this);
1842 } 1824 }
1843 $inherits(_DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V, _DoubleLinkedQueueEn trySentinel); 1825 $inherits(_DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V, _DoubleLinkedQueueEn trySentinel);
1844 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype._link = function(p, n ) {
1845 this._next = n;
1846 this._previous = p;
1847 p._next = this;
1848 n._previous = this;
1849 }
1850 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.prepend = function(e) {
1851 new DoubleLinkedQueueEntry$KeyValuePair$K$V(e)._link(this._previous, this);
1852 }
1853 _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V.prototype.previousEntry = funct ion() {
1854 var $0;
1855 return (($0 = this._previous._asNonSentinelEntry()) && $0.is$DoubleLinkedQueue Entry$KeyValuePair$K$V());
1856 }
1857 // ********** Code for DoubleLinkedQueue ************** 1826 // ********** Code for DoubleLinkedQueue **************
1858 function DoubleLinkedQueue() { 1827 function DoubleLinkedQueue() {
1859 // Initializers done 1828 // Initializers done
1860 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E(); 1829 this._sentinel = new _DoubleLinkedQueueEntrySentinel$E();
1861 } 1830 }
1862 DoubleLinkedQueue.prototype.is$Collection$E = function(){return this;}; 1831 DoubleLinkedQueue.prototype.is$Collection$E = function(){return this;};
1863 DoubleLinkedQueue.prototype.is$Collection$Object = function(){return this;}; 1832 DoubleLinkedQueue.prototype.is$Collection$Object = function(){return this;};
1864 DoubleLinkedQueue.prototype.is$Collection$Type = function(){return this;}; 1833 DoubleLinkedQueue.prototype.is$Collection$Type = function(){return this;};
1865 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;}; 1834 DoubleLinkedQueue.prototype.is$Iterable = function(){return this;};
1866 DoubleLinkedQueue.prototype.addLast = function(value) { 1835 DoubleLinkedQueue.prototype.addLast = function(value) {
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 function ArrayBasedScanner$SourceString() { 2704 function ArrayBasedScanner$SourceString() {
2736 this.groupingStack = const$14/*const EmptyLink()*/ 2705 this.groupingStack = const$14/*const EmptyLink()*/
2737 this.extraCharOffset = 0; 2706 this.extraCharOffset = 0;
2738 this.tokenStart = -1; 2707 this.tokenStart = -1;
2739 this.byteOffset = -1; 2708 this.byteOffset = -1;
2740 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1); 2709 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1);
2741 // Initializers done 2710 // Initializers done
2742 this.tail = this.tokens; 2711 this.tail = this.tokens;
2743 } 2712 }
2744 $inherits(ArrayBasedScanner$SourceString, ArrayBasedScanner); 2713 $inherits(ArrayBasedScanner$SourceString, ArrayBasedScanner);
2745 ArrayBasedScanner$SourceString.prototype.advance = function() {
2746 var next = this.nextByte();
2747 return next;
2748 }
2749 ArrayBasedScanner$SourceString.prototype.select = function(choice, yes, no) {
2750 var next = this.advance();
2751 if (next === choice) {
2752 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, yes);
2753 return this.advance();
2754 }
2755 else {
2756 this.appendStringToken(1024/*null.UNKNOWN_TOKEN*/, no);
2757 return next;
2758 }
2759 }
2760 ArrayBasedScanner$SourceString.prototype.appendStringToken = function(kind, valu e) {
2761 this.tail.next = new StringToken(kind, value, this.tokenStart);
2762 this.tail = this.tail.next;
2763 }
2764 ArrayBasedScanner$SourceString.prototype.appendKeywordToken = function(keyword) {
2765 this.tail.next = new KeywordToken(keyword, this.tokenStart);
2766 this.tail = this.tail.next;
2767 }
2768 ArrayBasedScanner$SourceString.prototype.appendEofToken = function() {
2769 this.tail.next = new Token(0/*null.EOF_TOKEN*/, this.get$charOffset());
2770 this.tail = this.tail.next;
2771 }
2772 ArrayBasedScanner$SourceString.prototype.beginToken = function() {
2773 this.tokenStart = this.get$charOffset();
2774 }
2775 ArrayBasedScanner$SourceString.prototype.firstToken = function() {
2776 return this.tokens.next;
2777 }
2778 ArrayBasedScanner$SourceString.prototype.addToCharOffset = function(offset) {
2779 this.extraCharOffset += offset;
2780 }
2781 ArrayBasedScanner$SourceString.prototype.appendWhiteSpace = function(next) {
2782
2783 }
2784 ArrayBasedScanner$SourceString.prototype.appendBeginGroup = function(kind, value ) {
2785 var $0;
2786 var token = new BeginGroupToken(kind, value, this.tokenStart);
2787 this.tail.next = token;
2788 this.tail = this.tail.next;
2789 while (kind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.isEmp ty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) {
2790 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2791 }
2792 this.groupingStack = (($0 = this.groupingStack.prepend(token)) && $0.is$Link$T oken());
2793 }
2794 ArrayBasedScanner$SourceString.prototype.appendEndGroup = function(kind, value, openKind) {
2795 var $0;
2796 var oldTail = this.tail;
2797 this.appendStringToken(kind, value);
2798 if ($notnull_bool(this.groupingStack.isEmpty())) {
2799 if (openKind === 60/*null.LT_TOKEN*/) return;
2800 $throw(new MalformedInputException(('Unmatched ' + value + '')));
2801 }
2802 while (openKind !== 60/*null.LT_TOKEN*/ && !$notnull_bool(this.groupingStack.i sEmpty()) && this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) {
2803 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2804 }
2805 if (this.groupingStack.get$head().kind !== openKind) {
2806 if (openKind === 60/*null.LT_TOKEN*/) return;
2807 $throw(new MalformedInputException(('Unmatched ' + value + '')));
2808 }
2809 this.groupingStack.get$head().endGroup = oldTail.next;
2810 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Token ());
2811 }
2812 ArrayBasedScanner$SourceString.prototype.appendGtGt = function(kind, value) {
2813 var $0;
2814 var oldTail = this.tail;
2815 this.appendStringToken(kind, value);
2816 if ($notnull_bool(this.groupingStack.isEmpty())) return;
2817 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) {
2818 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2819 }
2820 if ($notnull_bool(this.groupingStack.isEmpty())) return;
2821 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) {
2822 this.groupingStack.get$head().endGroup = oldTail.next;
2823 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2824 }
2825 }
2826 ArrayBasedScanner$SourceString.prototype.appendGtGtGt = function(kind, value) {
2827 var $0;
2828 var oldTail = this.tail;
2829 this.appendStringToken(kind, value);
2830 if ($notnull_bool(this.groupingStack.isEmpty())) return;
2831 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) {
2832 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2833 }
2834 if ($notnull_bool(this.groupingStack.isEmpty())) return;
2835 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) {
2836 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2837 }
2838 if ($notnull_bool(this.groupingStack.isEmpty())) return;
2839 if ($notnull_bool($eq(this.groupingStack.get$head().kind, 60/*null.LT_TOKEN*/) )) {
2840 this.groupingStack.get$head().endGroup = oldTail.next;
2841 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2842 }
2843 }
2844 ArrayBasedScanner$SourceString.prototype.tokenize = function() {
2845 var next = this.advance();
2846 while (next != -1) {
2847 next = this.bigSwitch(next);
2848 }
2849 this.appendEofToken();
2850 return this.firstToken();
2851 }
2852 ArrayBasedScanner$SourceString.prototype.bigSwitch = function(next) {
2853 this.beginToken();
2854 switch (next) {
2855 case 9/*null.$TAB*/:
2856 case 10/*null.$LF*/:
2857 case 13/*null.$CR*/:
2858 case 32/*null.$SPACE*/:
2859
2860 this.appendWhiteSpace(next);
2861 return this.advance();
2862
2863 case 60/*null.$LT*/:
2864
2865 return this.tokenizeLessThan(next);
2866
2867 case 62/*null.$GT*/:
2868
2869 return this.tokenizeGreaterThan(next);
2870
2871 case 61/*null.$EQ*/:
2872
2873 return this.tokenizeEquals(next);
2874
2875 case 33/*null.$BANG*/:
2876
2877 return this.tokenizeExclamation(next);
2878
2879 case 43/*null.$PLUS*/:
2880
2881 return this.tokenizePlus(next);
2882
2883 case 45/*null.$MINUS*/:
2884
2885 return this.tokenizeMinus(next);
2886
2887 case 42/*null.$STAR*/:
2888
2889 return this.tokenizeMultiply(next);
2890
2891 case 37/*null.$PERCENT*/:
2892
2893 return this.tokenizePercent(next);
2894
2895 case 38/*null.$AMPERSAND*/:
2896
2897 return this.tokenizeAmpersand(next);
2898
2899 case 124/*null.$BAR*/:
2900
2901 return this.tokenizeBar(next);
2902
2903 case 94/*null.$CARET*/:
2904
2905 return this.tokenizeCaret(next);
2906
2907 case 91/*null.$LBRACKET*/:
2908
2909 return this.tokenizeOpenBracket(next);
2910
2911 case 126/*null.$TILDE*/:
2912
2913 return this.tokenizeTilde(next);
2914
2915 case 92/*null.$BACKSLASH*/:
2916
2917 this.appendStringToken(92/*null.BACKSLASH_TOKEN*/, "\\");
2918 return this.advance();
2919
2920 case 35/*null.$HASH*/:
2921
2922 return this.tokenizeTag(next);
2923
2924 case 40/*null.$LPAREN*/:
2925
2926 this.appendBeginGroup(40/*null.LPAREN_TOKEN*/, "(");
2927 return this.advance();
2928
2929 case 41/*null.$RPAREN*/:
2930
2931 this.appendEndGroup(41/*null.RPAREN_TOKEN*/, ")", 40/*null.LPAREN_TOKEN*/) ;
2932 return this.advance();
2933
2934 case 44/*null.$COMMA*/:
2935
2936 this.appendStringToken(44/*null.COMMA_TOKEN*/, ",");
2937 return this.advance();
2938
2939 case 58/*null.$COLON*/:
2940
2941 this.appendStringToken(58/*null.COLON_TOKEN*/, ":");
2942 return this.advance();
2943
2944 case 59/*null.$SEMICOLON*/:
2945
2946 this.appendStringToken(59/*null.SEMICOLON_TOKEN*/, ";");
2947 return this.advance();
2948
2949 case 63/*null.$QUESTION*/:
2950
2951 this.appendStringToken(63/*null.QUESTION_TOKEN*/, "?");
2952 return this.advance();
2953
2954 case 93/*null.$RBRACKET*/:
2955
2956 this.appendEndGroup(93/*null.RBRACKET_TOKEN*/, "]", 91/*null.LBRACKET_TOKE N*/);
2957 return this.advance();
2958
2959 case 96/*null.$BACKPING*/:
2960
2961 this.appendStringToken(96/*null.BACKPING_TOKEN*/, "`");
2962 return this.advance();
2963
2964 case 123/*null.$LBRACE*/:
2965
2966 this.appendBeginGroup(123/*null.LBRACE_TOKEN*/, "{");
2967 return this.advance();
2968
2969 case 125/*null.$RBRACE*/:
2970
2971 this.appendEndGroup(125/*null.RBRACE_TOKEN*/, "}", 123/*null.LBRACE_TOKEN* /);
2972 return this.advance();
2973
2974 case 47/*null.$SLASH*/:
2975
2976 return this.tokenizeSlashOrComment(next);
2977
2978 case 64/*null.$AT*/:
2979
2980 return this.tokenizeRawString(next);
2981
2982 case 34/*null.$DQ*/:
2983 case 39/*null.$SQ*/:
2984
2985 return this.tokenizeString(next, this.byteOffset, false);
2986
2987 case 46/*null.$PERIOD*/:
2988
2989 return this.tokenizeDotOrNumber(next);
2990
2991 case 48/*null.$0*/:
2992
2993 return this.tokenizeHexOrNumber(next);
2994
2995 case 49/*null.$1*/:
2996 case 50/*null.$2*/:
2997 case 51/*null.$3*/:
2998 case 52/*null.$4*/:
2999 case 53/*null.$5*/:
3000 case 54/*null.$6*/:
3001 case 55/*null.$7*/:
3002 case 56/*null.$8*/:
3003 case 57/*null.$9*/:
3004
3005 return this.tokenizeNumber(next);
3006
3007 case 36/*null.$DOLLAR*/:
3008 case 65/*null.$A*/:
3009 case 66/*null.$B*/:
3010 case 67/*null.$C*/:
3011 case 68/*null.$D*/:
3012 case 69/*null.$E*/:
3013 case 70/*null.$F*/:
3014 case 71/*null.$G*/:
3015 case 72/*null.$H*/:
3016 case 73/*null.$I*/:
3017 case 74/*null.$J*/:
3018 case 75/*null.$K*/:
3019 case 76/*null.$L*/:
3020 case 77/*null.$M*/:
3021 case 78/*null.$N*/:
3022 case 79/*null.$O*/:
3023 case 80/*null.$P*/:
3024 case 81/*null.$Q*/:
3025 case 82/*null.$R*/:
3026 case 83/*null.$S*/:
3027 case 84/*null.$T*/:
3028 case 85/*null.$U*/:
3029 case 86/*null.$V*/:
3030 case 87/*null.$W*/:
3031 case 88/*null.$X*/:
3032 case 89/*null.$Y*/:
3033 case 90/*null.$Z*/:
3034 case 95/*null.$_*/:
3035 case 97/*null.$a*/:
3036 case 98/*null.$b*/:
3037 case 99/*null.$c*/:
3038 case 100/*null.$d*/:
3039 case 101/*null.$e*/:
3040 case 102/*null.$f*/:
3041 case 103/*null.$g*/:
3042 case 104/*null.$h*/:
3043 case 105/*null.$i*/:
3044 case 106/*null.$j*/:
3045 case 107/*null.$k*/:
3046 case 108/*null.$l*/:
3047 case 109/*null.$m*/:
3048 case 110/*null.$n*/:
3049 case 111/*null.$o*/:
3050 case 112/*null.$p*/:
3051 case 113/*null.$q*/:
3052 case 114/*null.$r*/:
3053 case 115/*null.$s*/:
3054 case 116/*null.$t*/:
3055 case 117/*null.$u*/:
3056 case 118/*null.$v*/:
3057 case 119/*null.$w*/:
3058 case 120/*null.$x*/:
3059 case 121/*null.$y*/:
3060 case 122/*null.$z*/:
3061
3062 return this.tokenizeIdentifier(next);
3063
3064 default:
3065
3066 if (next == -1) {
3067 return -1;
3068 }
3069 if (next < 0x1f) {
3070 $throw(new MalformedInputException(this.get$charOffset()));
3071 }
3072 return this.tokenizeIdentifier(next);
3073
3074 }
3075 }
3076 ArrayBasedScanner$SourceString.prototype.tokenizeTag = function(next) {
3077 if (this.byteOffset == 0) {
3078 if (this.peek() == 33/*null.$BANG*/) {
3079 do {
3080 next = this.advance();
3081 }
3082 while (next != 10/*null.$LF*/ && next != 13/*null.$CR*/)
3083 return next;
3084 }
3085 }
3086 this.appendStringToken(35/*null.HASH_TOKEN*/, "#");
3087 return this.advance();
3088 }
3089 ArrayBasedScanner$SourceString.prototype.tokenizeTilde = function(next) {
3090 next = this.advance();
3091 if (next == 47/*null.$SLASH*/) {
3092 return this.select(61/*null.$EQ*/, "~/=", "~/");
3093 }
3094 else {
3095 this.appendStringToken(126/*null.TILDE_TOKEN*/, "~");
3096 return next;
3097 }
3098 }
3099 ArrayBasedScanner$SourceString.prototype.tokenizeOpenBracket = function(next) {
3100 next = this.advance();
3101 if (next == 93/*null.$RBRACKET*/) {
3102 return this.select(61/*null.$EQ*/, "[]=", "[]");
3103 }
3104 else {
3105 this.appendBeginGroup(91/*null.LBRACKET_TOKEN*/, "[");
3106 return next;
3107 }
3108 }
3109 ArrayBasedScanner$SourceString.prototype.tokenizeCaret = function(next) {
3110 return this.select(61/*null.$EQ*/, "^=", "^");
3111 }
3112 ArrayBasedScanner$SourceString.prototype.tokenizeBar = function(next) {
3113 next = this.advance();
3114 switch (next) {
3115 case 124/*null.$BAR*/:
3116
3117 this.appendStringToken(124/*null.BAR_TOKEN*/, "||");
3118 return this.advance();
3119
3120 case 61/*null.$EQ*/:
3121
3122 this.appendStringToken(124/*null.BAR_TOKEN*/, "|=");
3123 return this.advance();
3124
3125 default:
3126
3127 this.appendStringToken(124/*null.BAR_TOKEN*/, "|");
3128 return next;
3129
3130 }
3131 }
3132 ArrayBasedScanner$SourceString.prototype.tokenizeAmpersand = function(next) {
3133 next = this.advance();
3134 switch (next) {
3135 case 38/*null.$AMPERSAND*/:
3136
3137 this.appendStringToken(38/*null.AMPERSAND_TOKEN*/, "&&");
3138 return this.advance();
3139
3140 case 61/*null.$EQ*/:
3141
3142 this.appendStringToken(38/*null.AMPERSAND_TOKEN*/, "&=");
3143 return this.advance();
3144
3145 default:
3146
3147 this.appendStringToken(38/*null.AMPERSAND_TOKEN*/, "&");
3148 return next;
3149
3150 }
3151 }
3152 ArrayBasedScanner$SourceString.prototype.tokenizePercent = function(next) {
3153 return this.select(61/*null.$EQ*/, "%=", "%");
3154 }
3155 ArrayBasedScanner$SourceString.prototype.tokenizeMultiply = function(next) {
3156 return this.select(61/*null.$EQ*/, "*=", "*");
3157 }
3158 ArrayBasedScanner$SourceString.prototype.tokenizeMinus = function(next) {
3159 next = this.advance();
3160 switch (next) {
3161 case 45/*null.$MINUS*/:
3162
3163 this.appendStringToken(45/*null.MINUS_TOKEN*/, "--");
3164 return this.advance();
3165
3166 case 61/*null.$EQ*/:
3167
3168 this.appendStringToken(45/*null.MINUS_TOKEN*/, "-=");
3169 return this.advance();
3170
3171 default:
3172
3173 this.appendStringToken(45/*null.MINUS_TOKEN*/, "-");
3174 return next;
3175
3176 }
3177 }
3178 ArrayBasedScanner$SourceString.prototype.tokenizePlus = function(next) {
3179 next = this.advance();
3180 switch (next) {
3181 case 43/*null.$PLUS*/:
3182
3183 this.appendStringToken(43/*null.PLUS_TOKEN*/, "++");
3184 return this.advance();
3185
3186 case 61/*null.$EQ*/:
3187
3188 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+=");
3189 return this.advance();
3190
3191 default:
3192
3193 this.appendStringToken(43/*null.PLUS_TOKEN*/, "+");
3194 return next;
3195
3196 }
3197 }
3198 ArrayBasedScanner$SourceString.prototype.tokenizeExclamation = function(next) {
3199 next = this.advance();
3200 if (next == 61/*null.$EQ*/) {
3201 return this.select(61/*null.$EQ*/, "!==", "!=");
3202 }
3203 this.appendStringToken(33/*null.BANG_TOKEN*/, "!");
3204 return next;
3205 }
3206 ArrayBasedScanner$SourceString.prototype.tokenizeEquals = function(next) {
3207 next = this.advance();
3208 if (next == 61/*null.$EQ*/) {
3209 return this.select(61/*null.$EQ*/, "===", "==");
3210 }
3211 this.appendStringToken(61/*null.EQ_TOKEN*/, "=");
3212 return next;
3213 }
3214 ArrayBasedScanner$SourceString.prototype.tokenizeGreaterThan = function(next) {
3215 next = this.advance();
3216 switch (next) {
3217 case 61/*null.$EQ*/:
3218
3219 this.appendStringToken(62/*null.GT_TOKEN*/, ">=");
3220 return this.advance();
3221
3222 case 62/*null.$GT*/:
3223
3224 next = this.advance();
3225 switch (next) {
3226 case 61/*null.$EQ*/:
3227
3228 this.appendStringToken(62/*null.GT_TOKEN*/, ">>=");
3229 return this.advance();
3230
3231 case 62/*null.$GT*/:
3232
3233 {
3234 next = this.advance();
3235 if (next === 61/*null.$EQ*/) {
3236 this.appendStringToken(62/*null.GT_TOKEN*/, ">>>=");
3237 return this.advance();
3238 }
3239 else {
3240 this.appendGtGtGt(62/*null.GT_TOKEN*/, ">>>");
3241 return next;
3242 }
3243 }
3244
3245 default:
3246
3247 this.appendGtGt(62/*null.GT_TOKEN*/, ">>");
3248 return next;
3249
3250 }
3251 $throw(new FallThroughError());
3252
3253 default:
3254
3255 this.appendEndGroup(62/*null.GT_TOKEN*/, ">", 60/*null.LT_TOKEN*/);
3256 return next;
3257
3258 }
3259 }
3260 ArrayBasedScanner$SourceString.prototype.tokenizeLessThan = function(next) {
3261 next = this.advance();
3262 switch (next) {
3263 case 61/*null.$EQ*/:
3264
3265 this.appendStringToken(188/*null.LT_EQ_TOKEN*/, "<=");
3266 return this.advance();
3267
3268 case 60/*null.$LT*/:
3269
3270 return this.select(61/*null.$EQ*/, "<<=", "<<");
3271
3272 default:
3273
3274 this.appendBeginGroup(60/*null.LT_TOKEN*/, "<");
3275 return next;
3276
3277 }
3278 }
3279 ArrayBasedScanner$SourceString.prototype.tokenizeNumber = function(next) {
3280 var start = this.byteOffset;
3281 while (true) {
3282 next = this.advance();
3283 switch (next) {
3284 case 48/*null.$0*/:
3285 case 49/*null.$1*/:
3286 case 50/*null.$2*/:
3287 case 51/*null.$3*/:
3288 case 52/*null.$4*/:
3289 case 53/*null.$5*/:
3290 case 54/*null.$6*/:
3291 case 55/*null.$7*/:
3292 case 56/*null.$8*/:
3293 case 57/*null.$9*/:
3294
3295 break;
3296
3297 case 46/*null.$PERIOD*/:
3298
3299 return this.tokenizeFractionPart(this.advance(), start);
3300
3301 case 101/*null.$e*/:
3302 case 69/*null.$E*/:
3303 case 100/*null.$d*/:
3304 case 68/*null.$D*/:
3305
3306 return this.tokenizeFractionPart(next, start);
3307
3308 default:
3309
3310 this.appendByteStringToken(105/*null.INT_TOKEN*/, this.asciiString(start ));
3311 return next;
3312
3313 }
3314 }
3315 }
3316 ArrayBasedScanner$SourceString.prototype.tokenizeHexOrNumber = function(next) {
3317 var x = this.peek();
3318 if (x == 120/*null.$x*/ || x == 88/*null.$X*/) {
3319 this.advance();
3320 return this.tokenizeHex(x);
3321 }
3322 return this.tokenizeNumber(next);
3323 }
3324 ArrayBasedScanner$SourceString.prototype.tokenizeHex = function(next) {
3325 var start = this.byteOffset;
3326 var hasDigits = false;
3327 while (true) {
3328 next = this.advance();
3329 switch (next) {
3330 case 48/*null.$0*/:
3331 case 49/*null.$1*/:
3332 case 50/*null.$2*/:
3333 case 51/*null.$3*/:
3334 case 52/*null.$4*/:
3335 case 53/*null.$5*/:
3336 case 54/*null.$6*/:
3337 case 55/*null.$7*/:
3338 case 56/*null.$8*/:
3339 case 57/*null.$9*/:
3340 case 65/*null.$A*/:
3341 case 66/*null.$B*/:
3342 case 67/*null.$C*/:
3343 case 68/*null.$D*/:
3344 case 69/*null.$E*/:
3345 case 70/*null.$F*/:
3346 case 97/*null.$a*/:
3347 case 98/*null.$b*/:
3348 case 99/*null.$c*/:
3349 case 100/*null.$d*/:
3350 case 101/*null.$e*/:
3351 case 102/*null.$f*/:
3352
3353 hasDigits = true;
3354 break;
3355
3356 default:
3357
3358 if (!$notnull_bool(hasDigits)) {
3359 $throw(new MalformedInputException(this.get$charOffset()));
3360 }
3361 this.appendByteStringToken(120/*null.HEXADECIMAL_TOKEN*/, this.asciiStri ng(start));
3362 return next;
3363
3364 }
3365 }
3366 }
3367 ArrayBasedScanner$SourceString.prototype.tokenizeDotOrNumber = function(next) {
3368 var start = this.byteOffset;
3369 next = this.advance();
3370 switch (next) {
3371 case 48/*null.$0*/:
3372 case 49/*null.$1*/:
3373 case 50/*null.$2*/:
3374 case 51/*null.$3*/:
3375 case 52/*null.$4*/:
3376 case 53/*null.$5*/:
3377 case 54/*null.$6*/:
3378 case 55/*null.$7*/:
3379 case 56/*null.$8*/:
3380 case 57/*null.$9*/:
3381
3382 {
3383 return this.tokenizeFractionPart(next, start);
3384 }
3385
3386 case 46/*null.$PERIOD*/:
3387
3388 return this.select(46/*null.$PERIOD*/, "...", "..");
3389
3390 default:
3391
3392 this.appendStringToken(46/*null.PERIOD_TOKEN*/, ".");
3393 return next;
3394
3395 }
3396 }
3397 ArrayBasedScanner$SourceString.prototype.tokenizeFractionPart = function(next, s tart) {
3398 var done = false;
3399 LOOP:
3400 while (!$notnull_bool(done)) {
3401 switch (next) {
3402 case 48/*null.$0*/:
3403 case 49/*null.$1*/:
3404 case 50/*null.$2*/:
3405 case 51/*null.$3*/:
3406 case 52/*null.$4*/:
3407 case 53/*null.$5*/:
3408 case 54/*null.$6*/:
3409 case 55/*null.$7*/:
3410 case 56/*null.$8*/:
3411 case 57/*null.$9*/:
3412
3413 break;
3414
3415 case 101/*null.$e*/:
3416 case 69/*null.$E*/:
3417
3418 next = this.tokenizeExponent(this.advance());
3419 done = true;
3420 continue LOOP;
3421
3422 default:
3423
3424 done = true;
3425 continue LOOP;
3426
3427 }
3428 next = this.advance();
3429 }
3430 if (next == 100/*null.$d*/ || next == 68/*null.$D*/) {
3431 next = this.advance();
3432 }
3433 this.appendByteStringToken(100/*null.DOUBLE_TOKEN*/, this.asciiString(start));
3434 return next;
3435 }
3436 ArrayBasedScanner$SourceString.prototype.tokenizeExponent = function(next) {
3437 if (next == 43/*null.$PLUS*/ || next == 45/*null.$MINUS*/) {
3438 next = this.advance();
3439 }
3440 var hasDigits = false;
3441 while (true) {
3442 switch (next) {
3443 case 48/*null.$0*/:
3444 case 49/*null.$1*/:
3445 case 50/*null.$2*/:
3446 case 51/*null.$3*/:
3447 case 52/*null.$4*/:
3448 case 53/*null.$5*/:
3449 case 54/*null.$6*/:
3450 case 55/*null.$7*/:
3451 case 56/*null.$8*/:
3452 case 57/*null.$9*/:
3453
3454 hasDigits = true;
3455 break;
3456
3457 default:
3458
3459 if (!$notnull_bool(hasDigits)) {
3460 $throw(new MalformedInputException(this.get$charOffset()));
3461 }
3462 return next;
3463
3464 }
3465 next = this.advance();
3466 }
3467 }
3468 ArrayBasedScanner$SourceString.prototype.tokenizeSlashOrComment = function(next) {
3469 next = this.advance();
3470 switch (next) {
3471 case 42/*null.$STAR*/:
3472
3473 return this.tokenizeMultiLineComment(next);
3474
3475 case 47/*null.$SLASH*/:
3476
3477 return this.tokenizeSingleLineComment(next);
3478
3479 case 61/*null.$EQ*/:
3480
3481 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/=");
3482 return this.advance();
3483
3484 default:
3485
3486 this.appendStringToken(47/*null.SLASH_TOKEN*/, "/");
3487 return next;
3488
3489 }
3490 }
3491 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineComment = function(ne xt) {
3492 while (true) {
3493 next = this.advance();
3494 switch (next) {
3495 case -1:
3496 case 10/*null.$LF*/:
3497 case 13/*null.$CR*/:
3498
3499 return next;
3500
3501 }
3502 }
3503 }
3504 ArrayBasedScanner$SourceString.prototype.tokenizeMultiLineComment = function(nex t) {
3505 next = this.advance();
3506 while (true) {
3507 switch (next) {
3508 case -1:
3509
3510 return next;
3511
3512 case 42/*null.$STAR*/:
3513
3514 next = this.advance();
3515 if (next == 47/*null.$SLASH*/) {
3516 return this.advance();
3517 }
3518 else if (next == -1) {
3519 return next;
3520 }
3521 break;
3522
3523 default:
3524
3525 next = this.advance();
3526 break;
3527
3528 }
3529 }
3530 }
3531 ArrayBasedScanner$SourceString.prototype.tokenizeIdentifier = function(next) {
3532 var start = this.byteOffset;
3533 var state = null;
3534 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) {
3535 state = KeywordState.get$KEYWORD_STATE().next(next);
3536 next = this.advance();
3537 }
3538 var isAscii = true;
3539 while (true) {
3540 if (97/*null.$a*/ <= next && next <= 122/*null.$z*/) {
3541 if (state != null) {
3542 state = state.next(next);
3543 }
3544 }
3545 else if ((48/*null.$0*/ <= next && next <= 57/*null.$9*/) || (65/*null.$A*/ <= next && next <= 90/*null.$Z*/) || next == 95/*null.$_*/ || next == 36/*null.$ DOLLAR*/) {
3546 state = null;
3547 }
3548 else if (next < 128) {
3549 if (state != null && $notnull_bool(state.isLeaf())) {
3550 this.appendKeywordToken(state.get$keyword());
3551 }
3552 else if ($notnull_bool(isAscii)) {
3553 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.asciiString (start));
3554 }
3555 else {
3556 this.appendByteStringToken(97/*null.IDENTIFIER_TOKEN*/, this.utf8String( start, -1));
3557 }
3558 return next;
3559 }
3560 else {
3561 var nonAsciiStart = this.byteOffset;
3562 do {
3563 next = this.nextByte();
3564 }
3565 while (next > 127)
3566 var string = this.utf8String(nonAsciiStart, -1).toString();
3567 isAscii = false;
3568 this.addToCharOffset(string.length);
3569 return next;
3570 }
3571 next = this.advance();
3572 }
3573 }
3574 ArrayBasedScanner$SourceString.prototype.tokenizeRawString = function(next) {
3575 var start = this.byteOffset;
3576 next = this.advance();
3577 if (next == 34/*null.$DQ*/ || next == 39/*null.$SQ*/) {
3578 return this.tokenizeString(next, start, true);
3579 }
3580 else {
3581 $throw(new MalformedInputException(this.get$charOffset()));
3582 }
3583 }
3584 ArrayBasedScanner$SourceString.prototype.tokenizeString = function(next, start, raw) {
3585 var q = next;
3586 next = this.advance();
3587 if (q == next) {
3588 next = this.advance();
3589 if (q == next) {
3590 return this.tokenizeMultiLineString(q, start, raw);
3591 }
3592 else {
3593 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, -1));
3594 return next;
3595 }
3596 }
3597 if ($notnull_bool(raw)) {
3598 return this.tokenizeSingleLineRawString(next, q, start);
3599 }
3600 else {
3601 return this.tokenizeSingleLineString(next, q, start);
3602 }
3603 }
3604 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineString = function(nex t, q1, start) {
3605 while (next != -1) {
3606 if (next == q1) {
3607 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0));
3608 return this.advance();
3609 }
3610 else if (next == 92/*null.$BACKSLASH*/) {
3611 next = this.advance();
3612 if (next == -1) {
3613 $throw(new MalformedInputException(this.get$charOffset()));
3614 }
3615 }
3616 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) {
3617 $throw(new MalformedInputException(this.get$charOffset()));
3618 }
3619 next = this.advance();
3620 }
3621 $throw(new MalformedInputException(this.get$charOffset()));
3622 }
3623 ArrayBasedScanner$SourceString.prototype.tokenizeSingleLineRawString = function( next, q1, start) {
3624 next = this.advance();
3625 while (next != -1) {
3626 if (next == q1) {
3627 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(start, 0));
3628 return this.advance();
3629 }
3630 else if (next == 10/*null.$LF*/ || next == 13/*null.$CR*/) {
3631 $throw(new MalformedInputException(this.get$charOffset()));
3632 }
3633 next = this.advance();
3634 }
3635 $throw(new MalformedInputException(this.get$charOffset()));
3636 }
3637 ArrayBasedScanner$SourceString.prototype.tokenizeMultiLineString = function(q, s tart, raw) {
3638 var next = this.advance();
3639 while (next != -1) {
3640 if (next == q) {
3641 next = this.advance();
3642 if (next == q) {
3643 next = this.advance();
3644 if (next == q) {
3645 this.appendByteStringToken(39/*null.STRING_TOKEN*/, this.utf8String(st art, 0));
3646 return this.advance();
3647 }
3648 }
3649 }
3650 next = this.advance();
3651 }
3652 return next;
3653 }
3654 // ********** Code for top level ************** 2714 // ********** Code for top level **************
3655 // ********** Library scanner ************** 2715 // ********** Library scanner **************
3656 // ********** Code for AbstractScanner ************** 2716 // ********** Code for AbstractScanner **************
3657 function AbstractScanner() {} 2717 function AbstractScanner() {}
3658 AbstractScanner.prototype.tokenize = function() { 2718 AbstractScanner.prototype.tokenize = function() {
3659 var next = this.advance(); 2719 var next = this.advance();
3660 while (next != -1) { 2720 while (next != -1) {
3661 next = this.bigSwitch(next); 2721 next = this.bigSwitch(next);
3662 } 2722 }
3663 this.appendEofToken(); 2723 this.appendEofToken();
(...skipping 8934 matching lines...) Expand 10 before | Expand all | Expand 10 after
12598 this._pushBlock(false); 11658 this._pushBlock(false);
12599 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier())); 11659 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier()));
12600 this._scope.rethrow = (ex && ex.is$Value()); 11660 this._scope.rethrow = (ex && ex.is$Value());
12601 this.writer.nextBlock(('} catch (' + ex.code + ') {')); 11661 this.writer.nextBlock(('} catch (' + ex.code + ') {'));
12602 if (catch_.trace != null) { 11662 if (catch_.trace != null) {
12603 var trace = this._scope.declare(catch_.trace); 11663 var trace = this._scope.declare(catch_.trace);
12604 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); 11664 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');'));
12605 world.gen.corejs.useStackTraceOf = true; 11665 world.gen.corejs.useStackTraceOf = true;
12606 } 11666 }
12607 this._genToDartException($assert_String(ex.code), node); 11667 this._genToDartException($assert_String(ex.code), node);
12608 if (!$notnull_bool(ex.type.get$isVar())) { 11668 if (!$notnull_bool(ex.type.get$isVarOrObject())) {
12609 var test = ex.instanceOf$3$isTrue$forceCheck(this, ex.type, catch_.get$exc eption().get$span(), false, true); 11669 var test = ex.instanceOf$3$isTrue$forceCheck(this, ex.type, catch_.get$exc eption().get$span(), false, true);
12610 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); 11670 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';'));
12611 } 11671 }
12612 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan g_Statement())); 11672 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan g_Statement()));
12613 this._popBlock(); 11673 this._popBlock();
12614 } 11674 }
12615 else if (node.catches.length > 0) { 11675 else if (node.catches.length > 0) {
12616 this._pushBlock(false); 11676 this._pushBlock(false);
12617 var ex = this._scope.create('\$ex', world.varType, null, false); 11677 var ex = this._scope.create('\$ex', world.varType, null, false);
12618 this._scope.rethrow = (ex && ex.is$Value()); 11678 this._scope.rethrow = (ex && ex.is$Value());
12619 this.writer.nextBlock(('} catch (' + ex.code + ') {')); 11679 this.writer.nextBlock(('} catch (' + ex.code + ') {'));
12620 var trace = null; 11680 var trace = null;
12621 if (node.catches.some((function (c) { 11681 if (node.catches.some((function (c) {
12622 return c.trace != null; 11682 return c.trace != null;
12623 }) 11683 })
12624 )) { 11684 )) {
12625 trace = this._scope.create('\$trace', world.varType, null, false); 11685 trace = this._scope.create('\$trace', world.varType, null, false);
12626 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); 11686 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');'));
12627 world.gen.corejs.useStackTraceOf = true; 11687 world.gen.corejs.useStackTraceOf = true;
12628 } 11688 }
12629 this._genToDartException($assert_String(ex.code), node); 11689 this._genToDartException($assert_String(ex.code), node);
12630 var needsRethrow = true; 11690 var needsRethrow = true;
12631 for (var i = 0; 11691 for (var i = 0;
12632 i < node.catches.length; i++) { 11692 i < node.catches.length; i++) {
12633 var catch_ = node.catches.$index(i); 11693 var catch_ = node.catches.$index(i);
12634 this._pushBlock(false); 11694 this._pushBlock(false);
12635 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier())); 11695 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier()));
12636 if (!$notnull_bool(tmp.type.get$isVar())) { 11696 if (!$notnull_bool(tmp.type.get$isVarOrObject())) {
12637 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.type, catch_.get$ exception().get$span(), true, true); 11697 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.type, catch_.get$ exception().get$span(), true, true);
12638 if (i == 0) { 11698 if (i == 0) {
12639 this.writer.enterBlock(('if (' + test.code + ') {')); 11699 this.writer.enterBlock(('if (' + test.code + ') {'));
12640 } 11700 }
12641 else { 11701 else {
12642 this.writer.nextBlock(('} else if (' + test.code + ') {')); 11702 this.writer.nextBlock(('} else if (' + test.code + ') {'));
12643 } 11703 }
12644 } 11704 }
12645 else if (i > 0) { 11705 else if (i > 0) {
12646 this.writer.nextBlock('} else {'); 11706 this.writer.nextBlock('} else {');
12647 } 11707 }
12648 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); 11708 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';'));
12649 if (catch_.trace != null) { 11709 if (catch_.trace != null) {
12650 var tmptrace = this._scope.declare(catch_.trace); 11710 var tmptrace = this._scope.declare(catch_.trace);
12651 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';')) ; 11711 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';')) ;
12652 } 11712 }
12653 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement()) ); 11713 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement()) );
12654 this._popBlock(); 11714 this._popBlock();
12655 if ($notnull_bool(tmp.type.get$isVar())) { 11715 if ($notnull_bool(tmp.type.get$isVarOrObject())) {
12656 if (i + 1 < node.catches.length) { 11716 if (i + 1 < node.catches.length) {
12657 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan())); 11717 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan()));
12658 } 11718 }
12659 if (i > 0) { 11719 if (i > 0) {
12660 this.writer.exitBlock('}'); 11720 this.writer.exitBlock('}');
12661 } 11721 }
12662 needsRethrow = false; 11722 needsRethrow = false;
12663 break; 11723 break;
12664 } 11724 }
12665 } 11725 }
(...skipping 7113 matching lines...) Expand 10 before | Expand all | Expand 10 after
19779 } 18839 }
19780 lang_Type.prototype.get$isVoid = function() { 18840 lang_Type.prototype.get$isVoid = function() {
19781 return false; 18841 return false;
19782 } 18842 }
19783 lang_Type.prototype.get$isNullable = function() { 18843 lang_Type.prototype.get$isNullable = function() {
19784 return true; 18844 return true;
19785 } 18845 }
19786 lang_Type.prototype.get$isVarOrFunction = function() { 18846 lang_Type.prototype.get$isVarOrFunction = function() {
19787 return $notnull_bool(this.get$isVar()) || $notnull_bool(this.get$isFunction()) ; 18847 return $notnull_bool(this.get$isVar()) || $notnull_bool(this.get$isFunction()) ;
19788 } 18848 }
18849 lang_Type.prototype.get$isVarOrObject = function() {
18850 return $notnull_bool(this.get$isVar()) || $notnull_bool(this.get$isObject());
18851 }
19789 lang_Type.prototype.getCallMethod = function() { 18852 lang_Type.prototype.getCallMethod = function() {
19790 return null; 18853 return null;
19791 } 18854 }
19792 lang_Type.prototype.get$isClosed = function() { 18855 lang_Type.prototype.get$isClosed = function() {
19793 return $notnull_bool(this.get$isString()) || $notnull_bool(this.get$isBool()) || $notnull_bool(this.get$isNum()) || $notnull_bool(this.get$isFunction()) || $n otnull_bool(this.get$isVar()); 18856 return $notnull_bool(this.get$isString()) || $notnull_bool(this.get$isBool()) || $notnull_bool(this.get$isNum()) || $notnull_bool(this.get$isFunction()) || $n otnull_bool(this.get$isVar());
19794 } 18857 }
19795 lang_Type.prototype.get$isUsed = function() { 18858 lang_Type.prototype.get$isUsed = function() {
19796 return false; 18859 return false;
19797 } 18860 }
19798 lang_Type.prototype.get$isGeneric = function() { 18861 lang_Type.prototype.get$isGeneric = function() {
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
20393 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; }; 19456 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; };
20394 DefinedType.prototype.get$members = function() { return this.members; }; 19457 DefinedType.prototype.get$members = function() { return this.members; };
20395 DefinedType.prototype.set$members = function(value) { return this.members = valu e; }; 19458 DefinedType.prototype.set$members = function(value) { return this.members = valu e; };
20396 DefinedType.prototype.get$factories = function() { return this.factories; }; 19459 DefinedType.prototype.get$factories = function() { return this.factories; };
20397 DefinedType.prototype.set$factories = function(value) { return this.factories = value; }; 19460 DefinedType.prototype.set$factories = function(value) { return this.factories = value; };
20398 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; 19461 DefinedType.prototype.get$isUsed = function() { return this.isUsed; };
20399 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; }; 19462 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; };
20400 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; }; 19463 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; };
20401 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; }; 19464 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; };
20402 DefinedType.prototype.setDefinition = function(def) { 19465 DefinedType.prototype.setDefinition = function(def) {
20403 $assert(this.definition == null, "definition == null", "type.dart", 630, 12); 19466 $assert(this.definition == null, "definition == null", "type.dart", 632, 12);
20404 this.definition = def; 19467 this.definition = def;
20405 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT ype() != null) { 19468 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT ype() != null) {
20406 this.isNativeType = true; 19469 this.isNativeType = true;
20407 } 19470 }
20408 if (this.definition != null && this.definition.get$typeParameters() != null) { 19471 if (this.definition != null && this.definition.get$typeParameters() != null) {
20409 this._concreteTypes = $map([]); 19472 this._concreteTypes = $map([]);
20410 this.typeParameters = []; 19473 this.typeParameters = [];
20411 var $list = this.definition.get$typeParameters(); 19474 var $list = this.definition.get$typeParameters();
20412 for (var $i = 0;$i < $list.length; $i++) { 19475 for (var $i = 0;$i < $list.length; $i++) {
20413 var tp = $list.$index($i); 19476 var tp = $list.$index($i);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
20502 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); 19565 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true);
20503 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this. library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) { 19566 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this. library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) {
20504 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span()); 19567 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span());
20505 } 19568 }
20506 resolvedInterface.addDirectSubtype$1(this); 19569 resolvedInterface.addDirectSubtype$1(this);
20507 interfaces.add$1(resolvedInterface); 19570 interfaces.add$1(resolvedInterface);
20508 } 19571 }
20509 return (interfaces && interfaces.is$List$Type()); 19572 return (interfaces && interfaces.is$List$Type());
20510 } 19573 }
20511 DefinedType.prototype.addDirectSubtype = function(type) { 19574 DefinedType.prototype.addDirectSubtype = function(type) {
20512 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 746, 12); 19575 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 748, 12);
20513 this.directSubtypes.add(type); 19576 this.directSubtypes.add(type);
20514 } 19577 }
20515 DefinedType.prototype.get$subtypes = function() { 19578 DefinedType.prototype.get$subtypes = function() {
20516 if (this._subtypes == null) { 19579 if (this._subtypes == null) {
20517 this._subtypes = new HashSetImplementation(); 19580 this._subtypes = new HashSetImplementation();
20518 var $list = this.directSubtypes; 19581 var $list = this.directSubtypes;
20519 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) { 19582 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) {
20520 var st = $i.next$0(); 19583 var st = $i.next$0();
20521 this._subtypes.add(st); 19584 this._subtypes.add(st);
20522 this._subtypes.addAll(st.get$subtypes()); 19585 this._subtypes.addAll(st.get$subtypes());
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
20929 } 19992 }
20930 else { 19993 else {
20931 world.internalError('unknown type reference', node.span); 19994 world.internalError('unknown type reference', node.span);
20932 } 19995 }
20933 return node.type; 19996 return node.type;
20934 } 19997 }
20935 DefinedType.prototype.resolveTypeParams = function(inType) { 19998 DefinedType.prototype.resolveTypeParams = function(inType) {
20936 return this; 19999 return this;
20937 } 20000 }
20938 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { 20001 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
20939 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1229, 12); 20002 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1231, 12);
20940 var names = [this.name]; 20003 var names = [this.name];
20941 var typeMap = $map([]); 20004 var typeMap = $map([]);
20942 for (var i = 0; 20005 for (var i = 0;
20943 i < typeArgs.length; i++) { 20006 i < typeArgs.length; i++) {
20944 var paramName = this.typeParameters.$index(i).get$name(); 20007 var paramName = this.typeParameters.$index(i).get$name();
20945 typeMap.$setindex(paramName, typeArgs.$index(i)); 20008 typeMap.$setindex(paramName, typeArgs.$index(i));
20946 names.add$1(typeArgs.$index(i).get$name()); 20009 names.add$1(typeArgs.$index(i).get$name());
20947 } 20010 }
20948 var concreteName = Strings.join((names && names.is$List$String()), '\$'); 20011 var concreteName = Strings.join((names && names.is$List$String()), '\$');
20949 var ret = this._concreteTypes.$index(concreteName); 20012 var ret = this._concreteTypes.$index(concreteName);
20950 if ($notnull_bool(ret == null)) { 20013 if ($notnull_bool(ret == null)) {
20951 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs ); 20014 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs );
20952 this._concreteTypes.$setindex(concreteName, ret); 20015 this._concreteTypes.$setindex(concreteName, ret);
20953 } 20016 }
20954 return (ret && ret.is$lang_Type()); 20017 return (ret && ret.is$lang_Type());
20955 } 20018 }
20956 DefinedType.prototype.getCallStub = function(args) { 20019 DefinedType.prototype.getCallStub = function(args) {
20957 $assert(this.get$isFunction(), "isFunction", "type.dart", 1249, 12); 20020 $assert(this.get$isFunction(), "isFunction", "type.dart", 1251, 12);
20958 var name = _getCallStubName('call', args); 20021 var name = _getCallStubName('call', args);
20959 if (this.varStubs == null) this.varStubs = $map([]); 20022 if (this.varStubs == null) this.varStubs = $map([]);
20960 var stub = this.varStubs.$index(name); 20023 var stub = this.varStubs.$index(name);
20961 if ($notnull_bool(stub == null)) { 20024 if ($notnull_bool(stub == null)) {
20962 stub = new VarFunctionStub($assert_String(name), args); 20025 stub = new VarFunctionStub($assert_String(name), args);
20963 this.varStubs.$setindex(name, stub); 20026 this.varStubs.$setindex(name, stub);
20964 } 20027 }
20965 return (stub && stub.is$VarFunctionStub()); 20028 return (stub && stub.is$VarFunctionStub());
20966 } 20029 }
20967 DefinedType.prototype.addDirectSubtype$1 = function($0) { 20030 DefinedType.prototype.addDirectSubtype$1 = function($0) {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
21308 var temp = context.getTemp(this); 20371 var temp = context.getTemp(this);
21309 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 20372 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
21310 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); 20373 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())');
21311 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); 20374 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value()));
21312 } 20375 }
21313 return new Value(toType, check, this.span, true); 20376 return new Value(toType, check, this.span, true);
21314 } 20377 }
21315 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { 20378 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) {
21316 if ($notnull_bool(toType.get$isVar())) { 20379 if ($notnull_bool(toType.get$isVar())) {
21317 world.error('can not resolve type', span); 20380 world.error('can not resolve type', span);
21318 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true' , null);
21319 }
21320 if ((toType instanceof ParameterType)) {
21321 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'true' , null);
21322 } 20381 }
21323 var testCode = null; 20382 var testCode = null;
20383 if ($notnull_bool(toType.get$isVar()) || $notnull_bool(toType.get$isObject()) || (toType instanceof ParameterType)) {
20384 if ($notnull_bool(this.needsTemp)) {
20385 return new Value(world.nonNullBool, ('(' + this.code + ', true)'), span, t rue);
20386 }
20387 else {
20388 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'tru e', null);
20389 }
20390 }
21324 if ($notnull_bool(toType.get$library().get$isCore())) { 20391 if ($notnull_bool(toType.get$library().get$isCore())) {
21325 var typeofName = toType.get$typeofName(); 20392 var typeofName = toType.get$typeofName();
21326 if ($notnull_bool($ne(typeofName, null))) { 20393 if ($notnull_bool($ne(typeofName, null))) {
21327 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '==' : '!=') + " '" + typeofName + "')"); 20394 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '==' : '!=') + " '" + typeofName + "')");
21328 } 20395 }
21329 } 20396 }
21330 if ($notnull_bool(toType.get$isClass()) && !(toType instanceof ConcreteType)) { 20397 if ($notnull_bool(toType.get$isClass()) && !(toType instanceof ConcreteType)) {
21331 toType.markUsed(); 20398 toType.markUsed();
21332 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); 20399 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')');
21333 if (!$notnull_bool(isTrue)) { 20400 if (!$notnull_bool(isTrue)) {
(...skipping 25 matching lines...) Expand all
21359 for (var i = 0; 20426 for (var i = 0;
21360 i < args.get$length(); i++) { 20427 i < args.get$length(); i++) {
21361 argsCode.add$1(args.values.$index(i).code); 20428 argsCode.add$1(args.values.$index(i).code);
21362 } 20429 }
21363 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); 20430 pos = Strings.join((argsCode && argsCode.is$List$String()), ", ");
21364 } 20431 }
21365 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)]; 20432 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)];
21366 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont ext, node, this, new Arguments(null, noSuchArgs)); 20433 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont ext, node, this, new Arguments(null, noSuchArgs));
21367 } 20434 }
21368 Value.prototype.invokeSpecial = function(name, args, returnType) { 20435 Value.prototype.invokeSpecial = function(name, args, returnType) {
21369 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 475, 12 ); 20436 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 480, 12 );
21370 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 76, 12); 20437 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 81, 12);
21371 var argsString = args.getCode(); 20438 var argsString = args.getCode();
21372 if (name == '\$index' || name == '\$setindex') { 20439 if (name == '\$index' || name == '\$setindex') {
21373 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true); 20440 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true);
21374 } 20441 }
21375 else { 20442 else {
21376 if (argsString.length > 0) argsString = (', ' + argsString + ''); 20443 if (argsString.length > 0) argsString = (', ' + argsString + '');
21377 world.gen.corejs.useOperator(name); 20444 world.gen.corejs.useOperator(name);
21378 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, true); 20445 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, true);
21379 } 20446 }
21380 } 20447 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
21559 }; 20626 };
21560 // ********** Code for BareValue ************** 20627 // ********** Code for BareValue **************
21561 function BareValue(home, outermost, span) { 20628 function BareValue(home, outermost, span) {
21562 this.home = home; 20629 this.home = home;
21563 Value.call(this, outermost.method.declaringType, null, span, false); 20630 Value.call(this, outermost.method.declaringType, null, span, false);
21564 // Initializers done 20631 // Initializers done
21565 this.isType = outermost.get$isStatic(); 20632 this.isType = outermost.get$isStatic();
21566 } 20633 }
21567 $inherits(BareValue, Value); 20634 $inherits(BareValue, Value);
21568 BareValue.prototype._tryResolveMember = function(context, name) { 20635 BareValue.prototype._tryResolveMember = function(context, name) {
21569 $assert($eq(context, this.home), "context == home", "value.dart", 680, 12); 20636 $assert($eq(context, this.home), "context == home", "value.dart", 685, 12);
21570 var member = this.type.resolveMember(name); 20637 var member = this.type.resolveMember(name);
21571 if ($notnull_bool($ne(member, null))) { 20638 if ($notnull_bool($ne(member, null))) {
21572 $assert(this.code == null, "code == null", "value.dart", 685, 14); 20639 $assert(this.code == null, "code == null", "value.dart", 690, 14);
21573 if ($notnull_bool(this.isType)) { 20640 if ($notnull_bool(this.isType)) {
21574 this.code = this.type.get$jsname(); 20641 this.code = this.type.get$jsname();
21575 } 20642 }
21576 else { 20643 else {
21577 this.code = this.home._makeThisCode(); 20644 this.code = this.home._makeThisCode();
21578 } 20645 }
21579 return member; 20646 return member;
21580 } 20647 }
21581 member = this.home.get$library().lookup(name, this.span); 20648 member = this.home.get$library().lookup(name, this.span);
21582 if ($notnull_bool($ne(member, null))) { 20649 if ($notnull_bool($ne(member, null))) {
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
22665 INTERFACE, 21732 INTERFACE,
22666 LIBRARY, 21733 LIBRARY,
22667 NATIVE, 21734 NATIVE,
22668 NEGATE, 21735 NEGATE,
22669 OPERATOR, 21736 OPERATOR,
22670 SET, 21737 SET,
22671 SOURCE, 21738 SOURCE,
22672 STATIC, 21739 STATIC,
22673 TYPEDEF ]*/; 21740 TYPEDEF ]*/;
22674 main(); 21741 main();
OLDNEW
« no previous file with comments | « no previous file | frog/gen.dart » ('j') | frog/value.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698