| OLD | NEW |
| 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 6942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6953 // Initializers done | 6953 // Initializers done |
| 6954 } | 6954 } |
| 6955 $inherits(BeginGroupToken, StringToken); | 6955 $inherits(BeginGroupToken, StringToken); |
| 6956 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;}; | 6956 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;}; |
| 6957 // ********** Code for Keyword ************** | 6957 // ********** Code for Keyword ************** |
| 6958 function Keyword(syntax, isPseudo) { | 6958 function Keyword(syntax, isPseudo) { |
| 6959 this.syntax = syntax; | 6959 this.syntax = syntax; |
| 6960 this.isPseudo = isPseudo; | 6960 this.isPseudo = isPseudo; |
| 6961 // Initializers done | 6961 // Initializers done |
| 6962 } | 6962 } |
| 6963 Keyword.prototype.is$Keyword = function(){return this;}; | |
| 6964 Keyword.prototype.is$SourceString = function(){return this;}; | 6963 Keyword.prototype.is$SourceString = function(){return this;}; |
| 6965 Keyword.get$keywords = function() { | 6964 Keyword.get$keywords = function() { |
| 6966 if ($notnull_bool(Keyword._keywords == null)) { | 6965 if ($notnull_bool(Keyword._keywords == null)) { |
| 6967 Keyword._keywords = Keyword.computeKeywordMap(); | 6966 Keyword._keywords = Keyword.computeKeywordMap(); |
| 6968 } | 6967 } |
| 6969 return Keyword._keywords; | 6968 return Keyword._keywords; |
| 6970 } | 6969 } |
| 6971 Keyword.computeKeywordMap = function() { | 6970 Keyword.computeKeywordMap = function() { |
| 6972 var result = new LinkedHashMapImplementation$String$Keyword(); | 6971 var result = new LinkedHashMapImplementation$String$Keyword(); |
| 6973 for (var $i0 = const$234/*Keyword.values*/.iterator(); $i0.hasNext(); ) { | 6972 for (var $i0 = const$234/*Keyword.values*/.iterator(); $i0.hasNext(); ) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7060 $notnull_bool(i < foo.length); i++) { | 7059 $notnull_bool(i < foo.length); i++) { |
| 7061 if ($notnull_bool($ne(foo.$index(i), null))) { | 7060 if ($notnull_bool($ne(foo.$index(i), null))) { |
| 7062 sb.add(("" + (i + 97/*null.$a*/) + ": " + foo.$index(i) + "; ")); | 7061 sb.add(("" + (i + 97/*null.$a*/) + ": " + foo.$index(i) + "; ")); |
| 7063 } | 7062 } |
| 7064 } | 7063 } |
| 7065 sb.add("]"); | 7064 sb.add("]"); |
| 7066 return sb.toString(); | 7065 return sb.toString(); |
| 7067 } | 7066 } |
| 7068 // ********** Code for LeafKeywordState ************** | 7067 // ********** Code for LeafKeywordState ************** |
| 7069 function LeafKeywordState(syntax) { | 7068 function LeafKeywordState(syntax) { |
| 7070 var $0; | 7069 this.keyword = Keyword.get$keywords().$index(syntax); |
| 7071 this.keyword = (($0 = Keyword.get$keywords().$index(syntax)) && $0.is$Keyword(
)); | |
| 7072 // Initializers done | 7070 // Initializers done |
| 7073 } | 7071 } |
| 7074 $inherits(LeafKeywordState, KeywordState); | 7072 $inherits(LeafKeywordState, KeywordState); |
| 7075 LeafKeywordState.prototype.get$keyword = function() { return this.keyword; }; | 7073 LeafKeywordState.prototype.get$keyword = function() { return this.keyword; }; |
| 7076 LeafKeywordState.prototype.set$keyword = function(value) { return this.keyword =
value; }; | 7074 LeafKeywordState.prototype.set$keyword = function(value) { return this.keyword =
value; }; |
| 7077 LeafKeywordState.prototype.isLeaf = function() { | 7075 LeafKeywordState.prototype.isLeaf = function() { |
| 7078 return true; | 7076 return true; |
| 7079 } | 7077 } |
| 7080 LeafKeywordState.prototype.next = function(c) { | 7078 LeafKeywordState.prototype.next = function(c) { |
| 7081 return null; | 7079 return null; |
| (...skipping 4024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11106 start = meth.declaringType.get$jsname() + '.prototype.'; | 11104 start = meth.declaringType.get$jsname() + '.prototype.'; |
| 11107 } | 11105 } |
| 11108 optNames.addAll(optValues); | 11106 optNames.addAll(optValues); |
| 11109 var optional = "['" + Strings.join((optNames && optNames.is$List$String(
)), "', '") + "']"; | 11107 var optional = "['" + Strings.join((optNames && optNames.is$List$String(
)), "', '") + "']"; |
| 11110 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional =
' + optional + '')); | 11108 defWriter.writeln(('' + start + '' + meth.get$jsname() + '.\$optional =
' + optional + '')); |
| 11111 } | 11109 } |
| 11112 } | 11110 } |
| 11113 } | 11111 } |
| 11114 } | 11112 } |
| 11115 MethodGenerator.prototype.writeBody = function() { | 11113 MethodGenerator.prototype.writeBody = function() { |
| 11116 var $0; | |
| 11117 var initializers = null; | 11114 var initializers = null; |
| 11118 var initializedFields = null; | 11115 var initializedFields = null; |
| 11119 if ($notnull_bool(this.method.get$isConstructor())) { | 11116 if ($notnull_bool(this.method.get$isConstructor())) { |
| 11120 initializers = []; | 11117 initializers = []; |
| 11121 initializedFields = new HashSetImplementation(); | 11118 initializedFields = new HashSetImplementation(); |
| 11122 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers()
); | 11119 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers()
); |
| 11123 for (var $i = 0;$i < $list.length; $i++) { | 11120 for (var $i = 0;$i < $list.length; $i++) { |
| 11124 var f = $list.$index($i); | 11121 var f = $list.$index($i); |
| 11125 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isSta
tic()))) { | 11122 if ($notnull_bool((f instanceof FieldMember) && !$notnull_bool(f.get$isSta
tic()))) { |
| 11126 var cv = f.computeValue(); | 11123 var cv = f.computeValue(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11172 world.error('only one initializer redirecting call is allowed', init
.get$span()); | 11169 world.error('only one initializer redirecting call is allowed', init
.get$span()); |
| 11173 } | 11170 } |
| 11174 initializerCall = init; | 11171 initializerCall = init; |
| 11175 } | 11172 } |
| 11176 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k
indFromAssign(init.op.kind) == 0)) { | 11173 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k
indFromAssign(init.op.kind) == 0)) { |
| 11177 var left = init.x; | 11174 var left = init.x; |
| 11178 if ($notnull_bool(!$notnull_bool(($notnull_bool((left instanceof DotEx
pression) && (left.self instanceof ThisExpression)) || (left instanceof VarExpre
ssion))))) { | 11175 if ($notnull_bool(!$notnull_bool(($notnull_bool((left instanceof DotEx
pression) && (left.self instanceof ThisExpression)) || (left instanceof VarExpre
ssion))))) { |
| 11179 world.error('invalid left side of initializer', left.get$span()); | 11176 world.error('invalid left side of initializer', left.get$span()); |
| 11180 continue; | 11177 continue; |
| 11181 } | 11178 } |
| 11182 initializedFields.add(left.get$name().get$name()); | 11179 var f = this.method.declaringType.getMember(left.get$name().get$name()
); |
| 11183 var assign = this._makeThisValue(null).set_(this, $assert_String(left.
get$name().get$name()), (($0 = left.get$name()) && $0.is$lang_Node()), (($0 = th
is.visitValue(init.y)) && $0.is$Value()), false); | 11180 if ($notnull_bool(f == null)) { |
| 11184 this.writer.writeln(('' + assign.code + ';')); | 11181 world.error('bad initializer - no matching field', left.get$span()); |
| 11182 continue; |
| 11183 } |
| 11184 else if ($notnull_bool(!$notnull_bool(f.get$isField()))) { |
| 11185 world.error(('"' + left.get$name().get$name() + '" does not refer to
a field'), left.get$span()); |
| 11186 continue; |
| 11187 } |
| 11188 initializedFields.add(f.get$name()); |
| 11189 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu
e(init.y).code + ';')); |
| 11185 } | 11190 } |
| 11186 else { | 11191 else { |
| 11187 world.error('invalid initializer', init.get$span()); | 11192 world.error('invalid initializer', init.get$span()); |
| 11188 } | 11193 } |
| 11189 } | 11194 } |
| 11190 if ($notnull_bool($ne(initializerCall, null))) { | 11195 if ($notnull_bool($ne(initializerCall, null))) { |
| 11191 var target = this._writeInitializerCall((initializerCall && initializerC
all.is$CallExpression())); | 11196 var target = this._writeInitializerCall((initializerCall && initializerC
all.is$CallExpression())); |
| 11192 if ($notnull_bool(!$notnull_bool(target.isSuper))) { | 11197 if ($notnull_bool(!$notnull_bool(target.isSuper))) { |
| 11193 if ($notnull_bool(initializers.length > 0)) { | 11198 if ($notnull_bool(initializers.length > 0)) { |
| 11194 var $list = this.method.get$parameters(); | 11199 var $list = this.method.get$parameters(); |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12183 } | 12188 } |
| 12184 MethodGenerator.prototype.visitSuperExpression = function(node) { | 12189 MethodGenerator.prototype.visitSuperExpression = function(node) { |
| 12185 return this._makeSuperValue(node); | 12190 return this._makeSuperValue(node); |
| 12186 } | 12191 } |
| 12187 MethodGenerator.prototype.visitNullExpression = function(node) { | 12192 MethodGenerator.prototype.visitNullExpression = function(node) { |
| 12188 return EvaluatedValue.EvaluatedValue$factory(world.varType, null, 'null', null
); | 12193 return EvaluatedValue.EvaluatedValue$factory(world.varType, null, 'null', null
); |
| 12189 } | 12194 } |
| 12190 MethodGenerator.prototype.visitLiteralExpression = function(node) { | 12195 MethodGenerator.prototype.visitLiteralExpression = function(node) { |
| 12191 var $0; | 12196 var $0; |
| 12192 var type = node.type.type; | 12197 var type = node.type.type; |
| 12193 $assert($ne(type, null), "type != null", "gen.dart", 2073, 12); | 12198 $assert($ne(type, null), "type != null", "gen.dart", 2081, 12); |
| 12194 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { | 12199 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { |
| 12195 var items = []; | 12200 var items = []; |
| 12196 var $list = node.value; | 12201 var $list = node.value; |
| 12197 for (var $i = node.value.iterator(); $i.hasNext(); ) { | 12202 for (var $i = node.value.iterator(); $i.hasNext(); ) { |
| 12198 var item = $i.next(); | 12203 var item = $i.next(); |
| 12199 var val = this.visitValue((item && item.is$lang_Expression())); | 12204 var val = this.visitValue((item && item.is$lang_Expression())); |
| 12200 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); | 12205 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); |
| 12201 var code = val.code; | 12206 var code = val.code; |
| 12202 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C
onditionalExpression))) { | 12207 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C
onditionalExpression))) { |
| 12203 code = ('(' + code + ')'); | 12208 code = ('(' + code + ')'); |
| (...skipping 8568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20772 INTERFACE, | 20777 INTERFACE, |
| 20773 LIBRARY, | 20778 LIBRARY, |
| 20774 NATIVE, | 20779 NATIVE, |
| 20775 NEGATE, | 20780 NEGATE, |
| 20776 OPERATOR, | 20781 OPERATOR, |
| 20777 SET, | 20782 SET, |
| 20778 SOURCE, | 20783 SOURCE, |
| 20779 STATIC, | 20784 STATIC, |
| 20780 TYPEDEF ]*/; | 20785 TYPEDEF ]*/; |
| 20781 RunEntry(function () {main();}, []); | 20786 RunEntry(function () {main();}, []); |
| OLD | NEW |