| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 AssertError.prototype.toString = function() { | 200 AssertError.prototype.toString = function() { |
| 201 return ("Failed assertion: '" + this.failedAssertion + "' is not true ") + ("i
n " + this.url + " at line " + this.line + ", column " + this.column + "."); | 201 return ("Failed assertion: '" + this.failedAssertion + "' is not true ") + ("i
n " + this.url + " at line " + this.line + ", column " + this.column + "."); |
| 202 } | 202 } |
| 203 // ********** Code for Object ************** | 203 // ********** Code for Object ************** |
| 204 Object.prototype.get$dynamic = function() { | 204 Object.prototype.get$dynamic = function() { |
| 205 return this; | 205 return this; |
| 206 } | 206 } |
| 207 Object.prototype.noSuchMethod = function(name, args) { | 207 Object.prototype.noSuchMethod = function(name, args) { |
| 208 $throw(new NoSuchMethodException(this, name, args)); | 208 $throw(new NoSuchMethodException(this, name, args)); |
| 209 } | 209 } |
| 210 Object.prototype._get$3 = function($0, $1, $2) { |
| 211 return this.noSuchMethod("_get", [$0, $1, $2]); |
| 212 } |
| 213 ; |
| 214 Object.prototype._set$4 = function($0, $1, $2, $3) { |
| 215 return this.noSuchMethod("_set", [$0, $1, $2, $3]); |
| 216 } |
| 217 ; |
| 210 Object.prototype.beginTypeArguments$1 = function($0) { | 218 Object.prototype.beginTypeArguments$1 = function($0) { |
| 211 return this.noSuchMethod("beginTypeArguments", [$0]); | 219 return this.noSuchMethod("beginTypeArguments", [$0]); |
| 212 } | 220 } |
| 213 ; | 221 ; |
| 214 Object.prototype.beginTypeVariables$1 = function($0) { | 222 Object.prototype.beginTypeVariables$1 = function($0) { |
| 215 return this.noSuchMethod("beginTypeVariables", [$0]); | 223 return this.noSuchMethod("beginTypeVariables", [$0]); |
| 216 } | 224 } |
| 217 ; | 225 ; |
| 218 Object.prototype.endTypeArguments$3 = function($0, $1, $2) { | 226 Object.prototype.endTypeArguments$3 = function($0, $1, $2) { |
| 219 return this.noSuchMethod("endTypeArguments", [$0, $1, $2]); | 227 return this.noSuchMethod("endTypeArguments", [$0, $1, $2]); |
| 220 } | 228 } |
| 221 ; | 229 ; |
| 222 Object.prototype.endTypeVariables$3 = function($0, $1, $2) { | 230 Object.prototype.endTypeVariables$3 = function($0, $1, $2) { |
| 223 return this.noSuchMethod("endTypeVariables", [$0, $1, $2]); | 231 return this.noSuchMethod("endTypeVariables", [$0, $1, $2]); |
| 224 } | 232 } |
| 225 ; | 233 ; |
| 226 Object.prototype.get_$3 = function($0, $1, $2) { | |
| 227 return this.noSuchMethod("get_", [$0, $1, $2]); | |
| 228 } | |
| 229 ; | |
| 230 Object.prototype.handleNoTypeArguments$1 = function($0) { | 234 Object.prototype.handleNoTypeArguments$1 = function($0) { |
| 231 return this.noSuchMethod("handleNoTypeArguments", [$0]); | 235 return this.noSuchMethod("handleNoTypeArguments", [$0]); |
| 232 } | 236 } |
| 233 ; | 237 ; |
| 234 Object.prototype.handleNoTypeVariables$1 = function($0) { | 238 Object.prototype.handleNoTypeVariables$1 = function($0) { |
| 235 return this.noSuchMethod("handleNoTypeVariables", [$0]); | 239 return this.noSuchMethod("handleNoTypeVariables", [$0]); |
| 236 } | 240 } |
| 237 ; | 241 ; |
| 238 Object.prototype.invoke$4 = function($0, $1, $2, $3) { | 242 Object.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 239 return this.noSuchMethod("invoke", [$0, $1, $2, $3]); | 243 return this.noSuchMethod("invoke", [$0, $1, $2, $3]); |
| 240 } | 244 } |
| 241 ; | 245 ; |
| 242 Object.prototype.set_$4 = function($0, $1, $2, $3) { | |
| 243 return this.noSuchMethod("set_", [$0, $1, $2, $3]); | |
| 244 } | |
| 245 ; | |
| 246 Object.prototype.visitPostfixExpression$1 = function($0) { | 246 Object.prototype.visitPostfixExpression$1 = function($0) { |
| 247 return this.noSuchMethod("visitPostfixExpression", [$0]); | 247 return this.noSuchMethod("visitPostfixExpression", [$0]); |
| 248 } | 248 } |
| 249 ; | 249 ; |
| 250 function $assert_bool(x) { | 250 function $assert_bool(x) { |
| 251 if (x == null || typeof(x) == "boolean") return x; | 251 if (x == null || typeof(x) == "boolean") return x; |
| 252 throw new TypeError("'" + x + "' is not a bool."); | 252 throw new TypeError("'" + x + "' is not a bool."); |
| 253 } | 253 } |
| 254 // ********** Code for IllegalAccessException ************** | 254 // ********** Code for IllegalAccessException ************** |
| 255 function IllegalAccessException() { | 255 function IllegalAccessException() { |
| (...skipping 10509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10765 else { | 10765 else { |
| 10766 world.internalError(('conflict with temporary name "' + name + '"')); | 10766 world.internalError(('conflict with temporary name "' + name + '"')); |
| 10767 } | 10767 } |
| 10768 } | 10768 } |
| 10769 if ($notnull_bool(!$notnull_bool(isParameter))) { | 10769 if ($notnull_bool(!$notnull_bool(isParameter))) { |
| 10770 var index = 0; | 10770 var index = 0; |
| 10771 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { | 10771 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { |
| 10772 jsName = ('' + name + '' + index++ + ''); | 10772 jsName = ('' + name + '' + index++ + ''); |
| 10773 } | 10773 } |
| 10774 } | 10774 } |
| 10775 var ret = new Value(type, jsName, false, false, false); | 10775 var ret = new Value(type, jsName, $notnull_bool(location != null) ? location.s
pan : null, false, false, false); |
| 10776 this._vars.$setindex(name, ret); | 10776 this._vars.$setindex(name, ret); |
| 10777 return ret; | 10777 return ret; |
| 10778 } | 10778 } |
| 10779 BlockScope.prototype.declareParameter = function(p) { | 10779 BlockScope.prototype.declareParameter = function(p) { |
| 10780 return this.create(p.name, p.type, p.definition, true); | 10780 return this.create(p.name, p.type, p.definition, true); |
| 10781 } | 10781 } |
| 10782 BlockScope.prototype.declare = function(id) { | 10782 BlockScope.prototype.declare = function(id) { |
| 10783 var type = this.enclosingMethod.method.resolveType(id.type, false); | 10783 var type = this.enclosingMethod.method.resolveType(id.type, false); |
| 10784 return this.create(id.name.name, (type && type.is$lang_Type()), id, false); | 10784 return this.create(id.name.name, (type && type.is$lang_Type()), id, false); |
| 10785 } | 10785 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 10806 this._scope = new BlockScope(this, null, false); | 10806 this._scope = new BlockScope(this, null, false); |
| 10807 } | 10807 } |
| 10808 if ($notnull_bool(this.enclosingMethod != null && this.method.name != '')) { | 10808 if ($notnull_bool(this.enclosingMethod != null && this.method.name != '')) { |
| 10809 var m = (($0 = this.method) && $0.is$MethodMember()); | 10809 var m = (($0 = this.method) && $0.is$MethodMember()); |
| 10810 this._scope.create(m.name, m.get$functionType(), m.definition, false); | 10810 this._scope.create(m.name, m.get$functionType(), m.definition, false); |
| 10811 } | 10811 } |
| 10812 this._usedTemps = new HashSetImplementation(); | 10812 this._usedTemps = new HashSetImplementation(); |
| 10813 this._freeTemps = []; | 10813 this._freeTemps = []; |
| 10814 } | 10814 } |
| 10815 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; | 10815 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; |
| 10816 MethodGenerator.prototype.get$library = function() { |
| 10817 return this.method.get$library(); |
| 10818 } |
| 10816 MethodGenerator.prototype.findMembers = function(name) { | 10819 MethodGenerator.prototype.findMembers = function(name) { |
| 10817 return this.method.get$library()._findMembers(name); | 10820 return this.get$library()._findMembers(name); |
| 10818 } | 10821 } |
| 10819 MethodGenerator.prototype.get$isClosure = function() { | 10822 MethodGenerator.prototype.get$isClosure = function() { |
| 10820 return (this.enclosingMethod != null); | 10823 return (this.enclosingMethod != null); |
| 10821 } | 10824 } |
| 10822 MethodGenerator.prototype.get$isStatic = function() { | 10825 MethodGenerator.prototype.get$isStatic = function() { |
| 10823 return this.method.get$isStatic(); | 10826 return this.method.get$isStatic(); |
| 10824 } | 10827 } |
| 10825 MethodGenerator.prototype.getTemp = function(value) { | 10828 MethodGenerator.prototype.getTemp = function(value) { |
| 10826 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value; | 10829 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value; |
| 10827 } | 10830 } |
| 10828 MethodGenerator.prototype.forceTemp = function(value) { | 10831 MethodGenerator.prototype.forceTemp = function(value) { |
| 10829 var name; | 10832 var name; |
| 10830 if ($notnull_bool(this._freeTemps.length > 0)) { | 10833 if ($notnull_bool(this._freeTemps.length > 0)) { |
| 10831 name = $assert_String(this._freeTemps.removeLast()); | 10834 name = $assert_String(this._freeTemps.removeLast()); |
| 10832 } | 10835 } |
| 10833 else { | 10836 else { |
| 10834 name = '\$' + this._usedTemps.get$length(); | 10837 name = '\$' + this._usedTemps.get$length(); |
| 10835 } | 10838 } |
| 10836 this._usedTemps.add(name); | 10839 this._usedTemps.add(name); |
| 10837 return new Value(value.type, name, false, false, false); | 10840 return new Value(value.type, name, value.span, false, false, false); |
| 10838 } | 10841 } |
| 10839 MethodGenerator.prototype.assignTemp = function(tmp, v) { | 10842 MethodGenerator.prototype.assignTemp = function(tmp, v) { |
| 10840 if ($notnull_bool($eq(tmp, v))) { | 10843 if ($notnull_bool($eq(tmp, v))) { |
| 10841 return v; | 10844 return v; |
| 10842 } | 10845 } |
| 10843 else { | 10846 else { |
| 10844 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), false, tru
e, false); | 10847 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, fa
lse, true, false); |
| 10845 } | 10848 } |
| 10846 } | 10849 } |
| 10847 MethodGenerator.prototype.freeTemp = function(value) { | 10850 MethodGenerator.prototype.freeTemp = function(value) { |
| 10848 if ($notnull_bool(this._usedTemps.remove(value.code))) { | 10851 if ($notnull_bool(this._usedTemps.remove(value.code))) { |
| 10849 this._freeTemps.add(value.code); | 10852 this._freeTemps.add(value.code); |
| 10850 } | 10853 } |
| 10851 else { | 10854 else { |
| 10852 world.internalError(('tried to free unused value or non-temp "' + value.code
+ '"')); | 10855 world.internalError(('tried to free unused value or non-temp "' + value.code
+ '"')); |
| 10853 } | 10856 } |
| 10854 } | 10857 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10920 else if ($notnull_bool(this.method.get$isStatic())) { | 10923 else if ($notnull_bool(this.method.get$isStatic())) { |
| 10921 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th
is.method.get$jsname() + ' = function' + _params + ' {')); | 10924 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th
is.method.get$jsname() + ' = function' + _params + ' {')); |
| 10922 } | 10925 } |
| 10923 else { | 10926 else { |
| 10924 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot
ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); | 10927 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot
ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); |
| 10925 } | 10928 } |
| 10926 if ($notnull_bool(this.needsThis)) { | 10929 if ($notnull_bool(this.needsThis)) { |
| 10927 defWriter.writeln('var \$this = this; // closure support'); | 10930 defWriter.writeln('var \$this = this; // closure support'); |
| 10928 } | 10931 } |
| 10929 if ($notnull_bool(this._usedTemps.get$length() > 0 || this._freeTemps.length >
0)) { | 10932 if ($notnull_bool(this._usedTemps.get$length() > 0 || this._freeTemps.length >
0)) { |
| 10930 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da
rt", 694, 14); | 10933 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da
rt", 698, 14); |
| 10931 this._freeTemps.addAll(this._usedTemps); | 10934 this._freeTemps.addAll(this._usedTemps); |
| 10932 this._freeTemps.sort((function (x, y) { | 10935 this._freeTemps.sort((function (x, y) { |
| 10933 return x.compareTo(y); | 10936 return x.compareTo(y); |
| 10934 }) | 10937 }) |
| 10935 ); | 10938 ); |
| 10936 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); | 10939 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); |
| 10937 } | 10940 } |
| 10938 defWriter.writeln(this.writer.get$text()); | 10941 defWriter.writeln(this.writer.get$text()); |
| 10939 if ($notnull_bool($ne(names, null))) { | 10942 if ($notnull_bool($ne(names, null))) { |
| 10940 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List
$String()), ", ") + ')')); | 10943 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List
$String()), ", ") + ')')); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11018 for (var $i = 0;$i < $list.length; $i++) { | 11021 for (var $i = 0;$i < $list.length; $i++) { |
| 11019 var p = $list.$index($i); | 11022 var p = $list.$index($i); |
| 11020 if ($notnull_bool($ne(initializers, null) && p.isInitializer)) { | 11023 if ($notnull_bool($ne(initializers, null) && p.isInitializer)) { |
| 11021 var field = this.method.declaringType.getMember(p.get$name()); | 11024 var field = this.method.declaringType.getMember(p.get$name()); |
| 11022 if ($notnull_bool(field == null)) { | 11025 if ($notnull_bool(field == null)) { |
| 11023 world.error('bad this parameter - no matching field', p.get$definition()
.get$span()); | 11026 world.error('bad this parameter - no matching field', p.get$definition()
.get$span()); |
| 11024 } | 11027 } |
| 11025 if ($notnull_bool(!$notnull_bool(field.get$isField()))) { | 11028 if ($notnull_bool(!$notnull_bool(field.get$isField()))) { |
| 11026 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p
.get$definition().get$span()); | 11029 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p
.get$definition().get$span()); |
| 11027 } | 11030 } |
| 11028 var paramValue = new Value(field.get$returnType(), p.get$name(), false, fa
lse, false); | 11031 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def
inition().get$span(), false, false, false); |
| 11029 this._paramCode.add(paramValue.code); | 11032 this._paramCode.add(paramValue.code); |
| 11030 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code +
';')); | 11033 initializers.add(('this.' + field.get$jsname() + ' = ' + paramValue.code +
';')); |
| 11031 initializedFields.add(p.get$name()); | 11034 initializedFields.add(p.get$name()); |
| 11032 } | 11035 } |
| 11033 else { | 11036 else { |
| 11034 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); | 11037 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); |
| 11035 this._paramCode.add(paramValue.code); | 11038 this._paramCode.add(paramValue.code); |
| 11036 } | 11039 } |
| 11037 } | 11040 } |
| 11038 var body = this.method.get$definition().body; | 11041 var body = this.method.get$definition().body; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 11055 } | 11058 } |
| 11056 initializerCall = init; | 11059 initializerCall = init; |
| 11057 } | 11060 } |
| 11058 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k
indFromAssign(init.op.kind) == 0)) { | 11061 else if ($notnull_bool((init instanceof BinaryExpression) && TokenKind.k
indFromAssign(init.op.kind) == 0)) { |
| 11059 var left = init.x; | 11062 var left = init.x; |
| 11060 if ($notnull_bool(!$notnull_bool(((left instanceof DotExpression) && (
left.self instanceof ThisExpression) || (left instanceof VarExpression))))) { | 11063 if ($notnull_bool(!$notnull_bool(((left instanceof DotExpression) && (
left.self instanceof ThisExpression) || (left instanceof VarExpression))))) { |
| 11061 world.error('invalid left side of initializer', left.get$span()); | 11064 world.error('invalid left side of initializer', left.get$span()); |
| 11062 continue; | 11065 continue; |
| 11063 } | 11066 } |
| 11064 initializedFields.add(left.get$name().get$name()); | 11067 initializedFields.add(left.get$name().get$name()); |
| 11065 var assign = this._makeThisValue(null).set_$4(this, left.get$name().ge
t$name(), left.get$name(), this.visitValue(init.y)); | 11068 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); |
| 11066 this.writer.writeln(('' + assign.code + ';')); | 11069 this.writer.writeln(('' + assign.code + ';')); |
| 11067 } | 11070 } |
| 11068 else { | 11071 else { |
| 11069 world.error('invalid initializer', init.get$span()); | 11072 world.error('invalid initializer', init.get$span()); |
| 11070 } | 11073 } |
| 11071 } | 11074 } |
| 11072 if ($notnull_bool($ne(initializerCall, null))) { | 11075 if ($notnull_bool($ne(initializerCall, null))) { |
| 11073 var target = this._writeInitializerCall((initializerCall && initializerC
all.is$CallExpression())); | 11076 var target = this._writeInitializerCall((initializerCall && initializerC
all.is$CallExpression())); |
| 11074 if ($notnull_bool(!$notnull_bool(target.isSuper))) { | 11077 if ($notnull_bool(!$notnull_bool(target.isSuper))) { |
| 11075 if ($notnull_bool(initializers.length > 0)) { | 11078 if ($notnull_bool(initializers.length > 0)) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11390 } | 11393 } |
| 11391 if ($notnull_bool(list.type.get$isList())) { | 11394 if ($notnull_bool(list.type.get$isList())) { |
| 11392 var tmpi = this._scope.create('\$i', world.numType, null, false); | 11395 var tmpi = this._scope.create('\$i', world.numType, null, false); |
| 11393 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code
+ ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); | 11396 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code
+ ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); |
| 11394 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [
tmpi]), false); | 11397 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [
tmpi]), false); |
| 11395 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); | 11398 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); |
| 11396 } | 11399 } |
| 11397 else { | 11400 else { |
| 11398 this._pushBlock(false); | 11401 this._pushBlock(false); |
| 11399 var c = world.get$coreimpl().types.$index('ListIterator').getConstructor('')
; | 11402 var c = world.get$coreimpl().types.$index('ListIterator').getConstructor('')
; |
| 11400 c.invoke$4(this, node, null, new Arguments(null, [new Value(null, 'l', false
, true, false)])); | 11403 c.invoke$4(this, node, null, new Arguments(null, [new Value(null, 'l', node.
list.span, false, true, false)])); |
| 11401 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT
Y()); | 11404 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT
Y()); |
| 11402 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ
e()), null, false); | 11405 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ
e()), null, false); |
| 11403 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY(
)); | 11406 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY(
)); |
| 11404 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); | 11407 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); |
| 11405 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + ';
' + hasNext.code + '; ) {')); | 11408 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + ';
' + hasNext.code + '; ) {')); |
| 11406 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); | 11409 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); |
| 11407 } | 11410 } |
| 11408 this.visitStatementsInBlock(node.body); | 11411 this.visitStatementsInBlock(node.body); |
| 11409 this.writer.exitBlock('}'); | 11412 this.writer.exitBlock('}'); |
| 11410 this._popBlock(); | 11413 this._popBlock(); |
| 11411 return false; | 11414 return false; |
| 11412 } | 11415 } |
| 11413 MethodGenerator.prototype._genToDartException = function(ex, node) { | 11416 MethodGenerator.prototype._genToDartException = function(ex, node) { |
| 11414 var $0; | 11417 var $0; |
| 11415 var types = const$401/*const [ | 11418 var types = const$401/*const [ |
| 11416 'NullPointerException', 'ObjectNotClosureException', | 11419 'NullPointerException', 'ObjectNotClosureException', |
| 11417 'NoSuchMethodException', 'StackOverflowException']*/; | 11420 'NoSuchMethodException', 'StackOverflowException']*/; |
| 11418 var target = new Value(null, 'this', false, true, false); | 11421 var target = new Value(null, 'this', node.span, false, true, false); |
| 11419 for (var $i = types.iterator(); $i.hasNext(); ) { | 11422 for (var $i = types.iterator(); $i.hasNext(); ) { |
| 11420 var name = $i.next(); | 11423 var name = $i.next(); |
| 11421 world.corelib.types.$index(name).markUsed(); | 11424 world.corelib.types.$index(name).markUsed(); |
| 11422 world.corelib.types.$index(name).get$members().$index('toString').invoke$4(t
his, node, target, Arguments.get$EMPTY()); | 11425 world.corelib.types.$index(name).get$members().$index('toString').invoke$4(t
his, node, target, Arguments.get$EMPTY()); |
| 11423 } | 11426 } |
| 11424 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); | 11427 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); |
| 11425 world.gen.corejs.useToDartException = true; | 11428 world.gen.corejs.useToDartException = true; |
| 11426 } | 11429 } |
| 11427 MethodGenerator.prototype.visitTryStatement = function(node) { | 11430 MethodGenerator.prototype.visitTryStatement = function(node) { |
| 11428 var $0; | 11431 var $0; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11593 if ($notnull_bool(this.get$isStatic())) { | 11596 if ($notnull_bool(this.get$isStatic())) { |
| 11594 world.warning('not allowed in static method', node.span); | 11597 world.warning('not allowed in static method', node.span); |
| 11595 } | 11598 } |
| 11596 } | 11599 } |
| 11597 MethodGenerator.prototype._makeSuperValue = function(node) { | 11600 MethodGenerator.prototype._makeSuperValue = function(node) { |
| 11598 var parentType = this.method.declaringType.get$parent(); | 11601 var parentType = this.method.declaringType.get$parent(); |
| 11599 this._checkNonStatic(node); | 11602 this._checkNonStatic(node); |
| 11600 if ($notnull_bool(parentType == null)) { | 11603 if ($notnull_bool(parentType == null)) { |
| 11601 world.error('no super class', node.span); | 11604 world.error('no super class', node.span); |
| 11602 } | 11605 } |
| 11603 return new Value(parentType, 'this', true, false, false); | 11606 return new Value(parentType, 'this', node.span, true, false, false); |
| 11604 } | 11607 } |
| 11605 MethodGenerator.prototype._getOutermostMethod = function() { | 11608 MethodGenerator.prototype._getOutermostMethod = function() { |
| 11606 var result = this; | 11609 var result = this; |
| 11607 while ($notnull_bool(result.enclosingMethod != null)) { | 11610 while ($notnull_bool(result.enclosingMethod != null)) { |
| 11608 result = result.enclosingMethod; | 11611 result = result.enclosingMethod; |
| 11609 } | 11612 } |
| 11610 return result; | 11613 return result; |
| 11611 } | 11614 } |
| 11615 MethodGenerator.prototype._makeThisCode = function() { |
| 11616 if ($notnull_bool(this.enclosingMethod != null)) { |
| 11617 this._getOutermostMethod().needsThis = true; |
| 11618 return '\$this'; |
| 11619 } |
| 11620 else { |
| 11621 return 'this'; |
| 11622 } |
| 11623 } |
| 11612 MethodGenerator.prototype._makeThisValue = function(node) { | 11624 MethodGenerator.prototype._makeThisValue = function(node) { |
| 11613 if ($notnull_bool(this.enclosingMethod != null)) { | 11625 if ($notnull_bool(this.enclosingMethod != null)) { |
| 11614 var outermostMethod = this._getOutermostMethod(); | 11626 var outermostMethod = this._getOutermostMethod(); |
| 11615 outermostMethod._checkNonStatic(node); | 11627 outermostMethod._checkNonStatic(node); |
| 11616 outermostMethod.needsThis = true; | 11628 outermostMethod.needsThis = true; |
| 11617 return new Value(outermostMethod.method.declaringType, '\$this', false, fals
e, false); | 11629 return new Value(outermostMethod.method.declaringType, '\$this', $notnull_bo
ol(node != null) ? node.span : null, false, false, false); |
| 11618 } | 11630 } |
| 11619 else { | 11631 else { |
| 11620 this._checkNonStatic(node); | 11632 this._checkNonStatic(node); |
| 11621 return new Value(this.method.declaringType, 'this', false, false, false); | 11633 return new Value(this.method.declaringType, 'this', $notnull_bool(node != nu
ll) ? node.span : null, false, false, false); |
| 11622 } | 11634 } |
| 11623 } | 11635 } |
| 11624 MethodGenerator.prototype.visitLambdaExpression = function(node) { | 11636 MethodGenerator.prototype.visitLambdaExpression = function(node) { |
| 11625 var name = ''; | 11637 var name = ''; |
| 11626 if ($notnull_bool(node.func.name != null)) { | 11638 if ($notnull_bool(node.func.name != null)) { |
| 11627 name = world.toJsIdentifier(node.func.name.name); | 11639 name = world.toJsIdentifier(node.func.name.name); |
| 11628 } | 11640 } |
| 11629 var meth = this._makeLambdaMethod($assert_String(name), node.func); | 11641 var meth = this._makeLambdaMethod($assert_String(name), node.func); |
| 11630 var w = new CodeWriter(); | 11642 var w = new CodeWriter(); |
| 11631 meth.generator.writeDefinition((w && w.is$CodeWriter()), node); | 11643 meth.generator.writeDefinition((w && w.is$CodeWriter()), node); |
| 11632 return new Value(meth.get$functionType(), w.get$text(), false, true, false); | 11644 return new Value(meth.get$functionType(), w.get$text(), node.span, false, true
, false); |
| 11633 } | 11645 } |
| 11634 MethodGenerator.prototype.visitCallExpression = function(node) { | 11646 MethodGenerator.prototype.visitCallExpression = function(node) { |
| 11635 var $0; | 11647 var $0; |
| 11636 var target; | 11648 var target; |
| 11637 var position = node.target; | 11649 var position = node.target; |
| 11638 var name = '\$call'; | 11650 var name = '\$call'; |
| 11639 if ($notnull_bool((node.target instanceof DotExpression))) { | 11651 if ($notnull_bool((node.target instanceof DotExpression))) { |
| 11640 var dot = (($0 = node.target) && $0.is$DotExpression()); | 11652 var dot = (($0 = node.target) && $0.is$DotExpression()); |
| 11641 target = dot.self.visit(this); | 11653 target = dot.self.visit(this); |
| 11642 name = dot.name.name; | 11654 name = dot.name.name; |
| 11643 position = dot.name; | 11655 position = dot.name; |
| 11644 } | 11656 } |
| 11645 else if ($notnull_bool((node.target instanceof VarExpression))) { | 11657 else if ($notnull_bool((node.target instanceof VarExpression))) { |
| 11646 var varExpr = (($0 = node.target) && $0.is$VarExpression()); | 11658 var varExpr = (($0 = node.target) && $0.is$VarExpression()); |
| 11647 name = varExpr.name.name; | 11659 name = varExpr.name.name; |
| 11648 var meth = this.method.declaringType.resolveMember(name); | 11660 target = this._scope.lookup($assert_String(name)); |
| 11649 if ($notnull_bool($ne(meth, null))) { | 11661 if ($notnull_bool($ne(target, null))) { |
| 11650 target = this._makeThisOrType(); | 11662 return target.invoke$4(this, '\$call', node, this._makeArgs(node.arguments
)); |
| 11651 return meth.invoke$4(this, varExpr, target, this._makeArgs(node.arguments)
); | |
| 11652 } | 11663 } |
| 11653 meth = this.method.declaringType.get$library().lookup($assert_String(name),
varExpr.span); | 11664 target = this._makeThisOrType(varExpr.span); |
| 11654 if ($notnull_bool($ne(meth, null))) { | 11665 return target.invoke$4(this, name, node, this._makeArgs(node.arguments)); |
| 11655 return meth.invoke$4(this, varExpr, null, this._makeArgs(node.arguments)); | |
| 11656 } | |
| 11657 name = '\$call'; | |
| 11658 target = varExpr.visit(this); | |
| 11659 } | 11666 } |
| 11660 else { | 11667 else { |
| 11661 target = node.target.visit(this); | 11668 target = node.target.visit(this); |
| 11662 } | 11669 } |
| 11663 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); | 11670 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); |
| 11664 } | 11671 } |
| 11665 MethodGenerator.prototype.visitIndexExpression = function(node) { | 11672 MethodGenerator.prototype.visitIndexExpression = function(node) { |
| 11666 var target = this.visitValue(node.target); | 11673 var target = this.visitValue(node.target); |
| 11667 var index = this.visitValue(node.index); | 11674 var index = this.visitValue(node.index); |
| 11668 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); | 11675 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); |
| 11669 } | 11676 } |
| 11670 MethodGenerator.prototype.visitBinaryExpression = function(node) { | 11677 MethodGenerator.prototype.visitBinaryExpression = function(node) { |
| 11678 var $0; |
| 11671 var kind = node.op.kind; | 11679 var kind = node.op.kind; |
| 11672 if ($notnull_bool(kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/))
{ | 11680 if ($notnull_bool(kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/))
{ |
| 11673 var x = this.visitValue(node.x); | 11681 var x = this.visitValue(node.x); |
| 11674 var y = this.visitValue(node.y); | 11682 var y = this.visitValue(node.y); |
| 11675 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); | 11683 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); |
| 11676 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { | 11684 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { |
| 11677 var value = $notnull_bool((kind == 35/*TokenKind.AND*/)) ? x.get$actualVal
ue() && y.get$actualValue() : x.get$actualValue() || y.get$actualValue(); | 11685 var value = $notnull_bool((kind == 35/*TokenKind.AND*/)) ? x.get$actualVal
ue() && y.get$actualValue() : x.get$actualValue() || y.get$actualValue(); |
| 11678 return EvaluatedValue.EvaluatedValue$factory(x.type, value, ('' + value +
''), node.span); | 11686 return EvaluatedValue.EvaluatedValue$factory((($0 = x.type) && $0.is$lang_
Type()), value, ('' + value + ''), node.span); |
| 11679 } | 11687 } |
| 11680 return new Value(null, code, false, true, false); | 11688 return new Value(null, code, node.span, false, true, false); |
| 11681 } | 11689 } |
| 11682 else if ($notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenK
ind.NE_STRICT*/)) { | 11690 else if ($notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenK
ind.NE_STRICT*/)) { |
| 11683 var x = this.visitValue(node.x); | 11691 var x = this.visitValue(node.x); |
| 11684 var y = this.visitValue(node.y); | 11692 var y = this.visitValue(node.y); |
| 11685 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { | 11693 if ($notnull_bool(x.get$isConst() && y.get$isConst())) { |
| 11686 var value = $notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/) ? $eq(x.get$a
ctualValue(), y.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue(
)); | 11694 var value = $notnull_bool(kind == 50/*TokenKind.EQ_STRICT*/) ? $eq(x.get$a
ctualValue(), y.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue(
)); |
| 11687 return EvaluatedValue.EvaluatedValue$factory(world.boolType, value, ("" +
value + ""), node.span); | 11695 return EvaluatedValue.EvaluatedValue$factory(world.boolType, value, ("" +
value + ""), node.span); |
| 11688 } | 11696 } |
| 11689 if ($notnull_bool(x.code == 'null' || y.code == 'null')) { | 11697 if ($notnull_bool(x.code == 'null' || y.code == 'null')) { |
| 11690 var op = node.op.toString().substring(0, 2); | 11698 var op = node.op.toString().substring(0, 2); |
| 11691 return new Value(null, ('' + x.code + ' ' + op + ' ' + y.code + ''), false
, true, false); | 11699 return new Value(null, ('' + x.code + ' ' + op + ' ' + y.code + ''), node.
span, false, true, false); |
| 11692 } | 11700 } |
| 11693 else { | 11701 else { |
| 11694 return new Value(null, ('' + x.code + ' ' + node.op + ' ' + y.code + ''),
false, true, false); | 11702 return new Value(null, ('' + x.code + ' ' + node.op + ' ' + y.code + ''),
node.span, false, true, false); |
| 11695 } | 11703 } |
| 11696 } | 11704 } |
| 11697 var assignKind = TokenKind.kindFromAssign(node.op.kind); | 11705 var assignKind = TokenKind.kindFromAssign(node.op.kind); |
| 11698 if ($notnull_bool(assignKind == -1)) { | 11706 if ($notnull_bool(assignKind == -1)) { |
| 11699 var x = this.visitValue(node.x); | 11707 var x = this.visitValue(node.x); |
| 11700 var y = this.visitValue(node.y); | 11708 var y = this.visitValue(node.y); |
| 11701 var name = TokenKind.binaryMethodName(node.op.kind); | 11709 var name = TokenKind.binaryMethodName(node.op.kind); |
| 11702 if ($notnull_bool(node.op.kind == 49/*TokenKind.NE*/)) { | 11710 if ($notnull_bool(node.op.kind == 49/*TokenKind.NE*/)) { |
| 11703 name = '\$ne'; | 11711 name = '\$ne'; |
| 11704 } | 11712 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 11727 } | 11735 } |
| 11728 else if ($notnull_bool((xn instanceof DotExpression))) { | 11736 else if ($notnull_bool((xn instanceof DotExpression))) { |
| 11729 return this._visitDotAssign(kind, (xn && xn.is$DotExpression()), yn, positio
n, captureOriginal); | 11737 return this._visitDotAssign(kind, (xn && xn.is$DotExpression()), yn, positio
n, captureOriginal); |
| 11730 } | 11738 } |
| 11731 else { | 11739 else { |
| 11732 world.error('illegal lhs', position.span); | 11740 world.error('illegal lhs', position.span); |
| 11733 } | 11741 } |
| 11734 } | 11742 } |
| 11735 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
tureOriginal) { | 11743 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap
tureOriginal) { |
| 11736 var $0; | 11744 var $0; |
| 11737 var x = this._scope.lookup(xn.name.name); | 11745 var name = xn.name.name; |
| 11746 var x = this._scope.lookup(name); |
| 11738 var y = this.visitValue(yn); | 11747 var y = this.visitValue(yn); |
| 11739 if ($notnull_bool(x == null)) { | 11748 if ($notnull_bool(x == null)) { |
| 11740 var members = this.method.declaringType.resolveMember(xn.name.name); | 11749 var members = this.method.declaringType.resolveMember(name); |
| 11741 if ($notnull_bool($ne(members, null))) { | 11750 if ($notnull_bool($ne(members, null))) { |
| 11742 x = this._makeThisOrType(); | 11751 x = this._makeThisOrType(position.span); |
| 11752 if ($notnull_bool(kind == 0)) { |
| 11753 return x.set_(this, name, position, (y && y.is$Value()), false); |
| 11754 } |
| 11755 else if ($notnull_bool(!$notnull_bool(members.get$treatAsField()) || membe
rs.get$containsMethods())) { |
| 11756 var right = x.get_(this, name, position); |
| 11757 right = captureOriginal((right && right.is$Value())); |
| 11758 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new
Arguments(null, [y])); |
| 11759 return x.set_(this, name, position, (y && y.is$Value()), false); |
| 11760 } |
| 11761 else { |
| 11762 x = x.get_(this, name, position); |
| 11763 } |
| 11743 } | 11764 } |
| 11744 else { | 11765 else { |
| 11745 var member = this.method.declaringType.get$library().lookup(xn.name.name,
xn.name.span); | 11766 var member = this.get$library().lookup(name, xn.name.span); |
| 11746 if ($notnull_bool(member == null)) { | 11767 if ($notnull_bool(member == null)) { |
| 11747 world.warning(('can not resolve ' + xn.name.name + ''), xn.span); | 11768 world.warning(('can not resolve ' + name + ''), xn.span); |
| 11748 return this._makeMissingValue(xn.name.name); | 11769 return this._makeMissingValue(name); |
| 11749 } | 11770 } |
| 11750 members = new MemberSet(member); | 11771 members = new MemberSet(member); |
| 11772 if ($notnull_bool(!$notnull_bool(members.get$treatAsField()) || members.ge
t$containsMethods())) { |
| 11773 if ($notnull_bool(kind != 0)) { |
| 11774 var right = members._get$3(this, position, x); |
| 11775 right = captureOriginal((right && right.is$Value())); |
| 11776 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n
ew Arguments(null, [y])); |
| 11777 } |
| 11778 return members._set$4(this, position, x, y); |
| 11779 } |
| 11780 else { |
| 11781 x = members._get$3(this, position, x); |
| 11782 } |
| 11751 } | 11783 } |
| 11752 if ($notnull_bool(!$notnull_bool(members.get$treatAsField()) || members.get$
containsMethods())) { | |
| 11753 if ($notnull_bool(kind != 0)) { | |
| 11754 var right = members.get_$3(this, position, x); | |
| 11755 right = captureOriginal((right && right.is$Value())); | |
| 11756 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new
Arguments(null, [y])); | |
| 11757 } | |
| 11758 return members.set_$4(this, position, x, y); | |
| 11759 } | |
| 11760 x = members.get_$3(this, position, x); | |
| 11761 } | 11784 } |
| 11762 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false); | 11785 y = y.convertTo(this, (($0 = x.type) && $0.is$lang_Type()), yn, false); |
| 11763 if ($notnull_bool(kind == 0)) { | 11786 if ($notnull_bool(kind == 0)) { |
| 11764 x = captureOriginal((x && x.is$Value())); | 11787 x = captureOriginal((x && x.is$Value())); |
| 11765 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f
alse); | 11788 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span,
false, true, false); |
| 11766 } | 11789 } |
| 11767 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum() && (kind != 46
/*TokenKind.TRUNCDIV*/))) { | 11790 else if ($notnull_bool(x.type.get$isNum() && y.type.get$isNum() && (kind != 46
/*TokenKind.TRUNCDIV*/))) { |
| 11768 x = captureOriginal((x && x.is$Value())); | 11791 x = captureOriginal((x && x.is$Value())); |
| 11769 var op = TokenKind.kindToString(kind); | 11792 var op = TokenKind.kindToString(kind); |
| 11770 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), fals
e, true, false); | 11793 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi
tion.span, false, true, false); |
| 11771 } | 11794 } |
| 11772 else { | 11795 else { |
| 11773 var right = x; | 11796 var right = x; |
| 11774 right = captureOriginal((right && right.is$Value())); | 11797 right = captureOriginal((right && right.is$Value())); |
| 11775 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 11798 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 11776 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), false, true, f
alse); | 11799 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span,
false, true, false); |
| 11777 } | 11800 } |
| 11778 } | 11801 } |
| 11779 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
aptureOriginal) { | 11802 MethodGenerator.prototype._visitIndexAssign = function(kind, xn, yn, position, c
aptureOriginal) { |
| 11780 var target = this.visitValue(xn.target); | 11803 var target = this.visitValue(xn.target); |
| 11781 var index = this.visitValue(xn.index); | 11804 var index = this.visitValue(xn.index); |
| 11782 var y = this.visitValue(yn); | 11805 var y = this.visitValue(yn); |
| 11783 var tmptarget = target; | 11806 var tmptarget = target; |
| 11784 var tmpindex = index; | 11807 var tmpindex = index; |
| 11785 if ($notnull_bool(kind != 0)) { | 11808 if ($notnull_bool(kind != 0)) { |
| 11786 tmptarget = this.getTemp((target && target.is$Value())); | 11809 tmptarget = this.getTemp((target && target.is$Value())); |
| 11787 tmpindex = this.getTemp((index && index.is$Value())); | 11810 tmpindex = this.getTemp((index && index.is$Value())); |
| 11788 index = this.assignTemp((tmpindex && tmpindex.is$Value()), (index && index.i
s$Value())); | 11811 index = this.assignTemp((tmpindex && tmpindex.is$Value()), (index && index.i
s$Value())); |
| 11789 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null
, [tmpindex])); | 11812 var right = tmptarget.invoke$4(this, '\$index', position, new Arguments(null
, [tmpindex])); |
| 11790 right = captureOriginal((right && right.is$Value())); | 11813 right = captureOriginal((right && right.is$Value())); |
| 11791 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 11814 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 11792 } | 11815 } |
| 11793 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ
et.is$Value())).invoke(this, '\$setindex', position, new Arguments(null, [index,
y]), false); | 11816 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ
et.is$Value())).invoke(this, '\$setindex', position, new Arguments(null, [index,
y]), false); |
| 11794 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); | 11817 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); |
| 11795 if ($notnull_bool($ne(tmpindex, index))) this.freeTemp((tmpindex && tmpindex.i
s$Value())); | 11818 if ($notnull_bool($ne(tmpindex, index))) this.freeTemp((tmpindex && tmpindex.i
s$Value())); |
| 11796 return ret; | 11819 return ret; |
| 11797 } | 11820 } |
| 11798 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
tureOriginal) { | 11821 MethodGenerator.prototype._visitDotAssign = function(kind, xn, yn, position, cap
tureOriginal) { |
| 11799 var target = xn.self.visit(this); | 11822 var target = xn.self.visit(this); |
| 11800 var y = this.visitValue(yn); | 11823 var y = this.visitValue(yn); |
| 11801 var tmptarget = target; | 11824 var tmptarget = target; |
| 11802 if ($notnull_bool(kind != 0)) { | 11825 if ($notnull_bool(kind != 0)) { |
| 11803 tmptarget = this.getTemp((target && target.is$Value())); | 11826 tmptarget = this.getTemp((target && target.is$Value())); |
| 11804 var right = tmptarget.get_$3(this, xn.name.name, xn.name); | 11827 var right = tmptarget.get_(this, xn.name.name, xn.name); |
| 11805 right = captureOriginal((right && right.is$Value())); | 11828 right = captureOriginal((right && right.is$Value())); |
| 11806 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); | 11829 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arg
uments(null, [y])); |
| 11807 } | 11830 } |
| 11808 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ
et.is$Value())).set_(this, xn.name.name, xn.name, (y && y.is$Value()), false); | 11831 var ret = this.assignTemp((tmptarget && tmptarget.is$Value()), (target && targ
et.is$Value())).set_(this, xn.name.name, xn.name, (y && y.is$Value()), false); |
| 11809 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); | 11832 if ($notnull_bool($ne(tmptarget, target))) this.freeTemp((tmptarget && tmptarg
et.is$Value())); |
| 11810 return ret; | 11833 return ret; |
| 11811 } | 11834 } |
| 11812 MethodGenerator.prototype.visitUnaryExpression = function(node) { | 11835 MethodGenerator.prototype.visitUnaryExpression = function(node) { |
| 11836 var $0; |
| 11813 var value = this.visitValue(node.self); | 11837 var value = this.visitValue(node.self); |
| 11814 switch (node.op.kind) { | 11838 switch (node.op.kind) { |
| 11815 case 16/*TokenKind.INCR*/: | 11839 case 16/*TokenKind.INCR*/: |
| 11816 case 17/*TokenKind.DECR*/: | 11840 case 17/*TokenKind.DECR*/: |
| 11817 | 11841 |
| 11818 if ($notnull_bool(value.type.get$isNum())) { | 11842 if ($notnull_bool(value.type.get$isNum())) { |
| 11819 return new Value(value.type, ('' + node.op + '' + value.code + ''), fals
e, true, false); | 11843 return new Value(value.type, ('' + node.op + '' + value.code + ''), node
.span, false, true, false); |
| 11820 } | 11844 } |
| 11821 else { | 11845 else { |
| 11822 var kind = ($notnull_bool(16/*TokenKind.INCR*/ == node.op.kind) ? 42/*To
kenKind.ADD*/ : 43/*TokenKind.SUB*/); | 11846 var kind = ($notnull_bool(16/*TokenKind.INCR*/ == node.op.kind) ? 42/*To
kenKind.ADD*/ : 43/*TokenKind.SUB*/); |
| 11823 var operand = new LiteralExpression(1, new TypeReference(node.span, worl
d.numType), '1', node.span); | 11847 var operand = new LiteralExpression(1, new TypeReference(node.span, worl
d.numType), '1', node.span); |
| 11824 return this._visitAssign($assert_num(kind), node.self, (operand && opera
nd.is$lang_Expression()), node, to$call$1(null)); | 11848 return this._visitAssign($assert_num(kind), node.self, (operand && opera
nd.is$lang_Expression()), node, to$call$1(null)); |
| 11825 } | 11849 } |
| 11826 | 11850 |
| 11827 case 19/*TokenKind.NOT*/: | 11851 case 19/*TokenKind.NOT*/: |
| 11828 | 11852 |
| 11829 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { | 11853 if ($notnull_bool(value.type.get$isBool() && value.get$isConst())) { |
| 11830 var newVal = !$notnull_bool(value.get$actualValue()); | 11854 var newVal = !$notnull_bool(value.get$actualValue()); |
| 11831 return EvaluatedValue.EvaluatedValue$factory(value.type, newVal, ('' + n
ewVal + ''), node.span); | 11855 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is
$lang_Type()), newVal, ('' + newVal + ''), node.span); |
| 11832 } | 11856 } |
| 11833 else { | 11857 else { |
| 11834 var newVal = value.convertToNonNullBool(this, node); | 11858 var newVal = value.convertToNonNullBool(this, node); |
| 11835 return new Value(world.boolType, ('!' + newVal.code + ''), false, true,
false); | 11859 return new Value(world.boolType, ('!' + newVal.code + ''), node.span, fa
lse, true, false); |
| 11836 } | 11860 } |
| 11837 | 11861 |
| 11838 case 42/*TokenKind.ADD*/: | 11862 case 42/*TokenKind.ADD*/: |
| 11839 | 11863 |
| 11840 return value.convertTo(this, world.numType, node, false); | 11864 return value.convertTo(this, world.numType, node, false); |
| 11841 | 11865 |
| 11842 case 43/*TokenKind.SUB*/: | 11866 case 43/*TokenKind.SUB*/: |
| 11843 case 18/*TokenKind.BIT_NOT*/: | 11867 case 18/*TokenKind.BIT_NOT*/: |
| 11844 | 11868 |
| 11845 if ($notnull_bool(node.op.kind == 18/*TokenKind.BIT_NOT*/)) { | 11869 if ($notnull_bool(node.op.kind == 18/*TokenKind.BIT_NOT*/)) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 11856 default: | 11880 default: |
| 11857 | 11881 |
| 11858 world.internalError(('unimplemented: ' + node.op + ''), node.span); | 11882 world.internalError(('unimplemented: ' + node.op + ''), node.span); |
| 11859 | 11883 |
| 11860 } | 11884 } |
| 11861 } | 11885 } |
| 11862 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { | 11886 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { |
| 11863 var $this = this; // closure support | 11887 var $this = this; // closure support |
| 11864 var value = this.visitValue(node.body); | 11888 var value = this.visitValue(node.body); |
| 11865 if ($notnull_bool(value.type.get$isNum())) { | 11889 if ($notnull_bool(value.type.get$isNum())) { |
| 11866 return new Value(value.type, ('' + value.code + '' + node.op + ''), false, t
rue, false); | 11890 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa
n, false, true, false); |
| 11867 } | 11891 } |
| 11868 var kind = $notnull_bool((16/*TokenKind.INCR*/ == node.op.kind)) ? 42/*TokenKi
nd.ADD*/ : 43/*TokenKind.SUB*/; | 11892 var kind = $notnull_bool((16/*TokenKind.INCR*/ == node.op.kind)) ? 42/*TokenKi
nd.ADD*/ : 43/*TokenKind.SUB*/; |
| 11869 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT
ype), '1', node.span); | 11893 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT
ype), '1', node.span); |
| 11870 var tmpleft = null, left = null; | 11894 var tmpleft = null, left = null; |
| 11871 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand.
is$lang_Expression()), node, (function (l) { | 11895 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand.
is$lang_Expression()), node, (function (l) { |
| 11872 if ($notnull_bool(isVoid)) { | 11896 if ($notnull_bool(isVoid)) { |
| 11873 return l; | 11897 return l; |
| 11874 } | 11898 } |
| 11875 else { | 11899 else { |
| 11876 left = l; | 11900 left = l; |
| 11877 tmpleft = $this.forceTemp((l && l.is$Value())); | 11901 tmpleft = $this.forceTemp((l && l.is$Value())); |
| 11878 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$
Value())); | 11902 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$
Value())); |
| 11879 } | 11903 } |
| 11880 }) | 11904 }) |
| 11881 ); | 11905 ); |
| 11882 if ($notnull_bool($ne(tmpleft, null))) { | 11906 if ($notnull_bool($ne(tmpleft, null))) { |
| 11883 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), fals
e, true, false); | 11907 ret = new Value(ret.type, ("(" + ret.code + ", " + tmpleft.code + ")"), node
.span, false, true, false); |
| 11884 } | 11908 } |
| 11885 if ($notnull_bool($ne(tmpleft, left))) { | 11909 if ($notnull_bool($ne(tmpleft, left))) { |
| 11886 this.freeTemp((tmpleft && tmpleft.is$Value())); | 11910 this.freeTemp((tmpleft && tmpleft.is$Value())); |
| 11887 } | 11911 } |
| 11888 return ret; | 11912 return ret; |
| 11889 } | 11913 } |
| 11890 MethodGenerator.prototype.visitNewExpression = function(node) { | 11914 MethodGenerator.prototype.visitNewExpression = function(node) { |
| 11891 var $0; | 11915 var $0; |
| 11892 var typeRef = node.type; | 11916 var typeRef = node.type; |
| 11893 var constructorName = ''; | 11917 var constructorName = ''; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11944 else { | 11968 else { |
| 11945 argsCode.add(arg.canonicalCode); | 11969 argsCode.add(arg.canonicalCode); |
| 11946 } | 11970 } |
| 11947 } | 11971 } |
| 11948 else { | 11972 else { |
| 11949 argsCode.add(arg.code); | 11973 argsCode.add(arg.code); |
| 11950 } | 11974 } |
| 11951 } | 11975 } |
| 11952 world.get$coreimpl().types.$index('ListFactory').markUsed(); | 11976 world.get$coreimpl().types.$index('ListFactory').markUsed(); |
| 11953 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ")
+ ']'); | 11977 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ")
+ ']'); |
| 11954 var value = new Value(world.listType, code, false, true, false); | 11978 var value = new Value(world.listType, code, node.span, false, true, false); |
| 11955 if ($notnull_bool(node.isConst)) { | 11979 if ($notnull_bool(node.isConst)) { |
| 11956 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); | 11980 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); |
| 11957 var immutableListCtor = immutableList.getConstructor('from'); | 11981 var immutableListCtor = immutableList.getConstructor('from'); |
| 11958 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null
, [value])); | 11982 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null
, [value])); |
| 11959 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu
tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval
uatedValue()), ('const ' + code + ''), result.code, node.span), (argValues && ar
gValues.is$List$Value())); | 11983 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu
tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval
uatedValue()), ('const ' + code + ''), result.code, node.span), (argValues && ar
gValues.is$List$Value())); |
| 11960 } | 11984 } |
| 11961 return value; | 11985 return value; |
| 11962 } | 11986 } |
| 11963 MethodGenerator.prototype.visitMapExpression = function(node) { | 11987 MethodGenerator.prototype.visitMapExpression = function(node) { |
| 11964 var $0; | 11988 var $0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 11986 else { | 12010 else { |
| 11987 argsCode.add(key.code); | 12011 argsCode.add(key.code); |
| 11988 argsCode.add(value.code); | 12012 argsCode.add(value.code); |
| 11989 } | 12013 } |
| 11990 } | 12014 } |
| 11991 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ",
") + ']'); | 12015 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ",
") + ']'); |
| 11992 var code = ('\$map(' + argList + ')'); | 12016 var code = ('\$map(' + argList + ')'); |
| 11993 if ($notnull_bool(node.isConst)) { | 12017 if ($notnull_bool(node.isConst)) { |
| 11994 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); | 12018 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); |
| 11995 var immutableMapCtor = immutableMap.getConstructor(''); | 12019 var immutableMapCtor = immutableMap.getConstructor(''); |
| 11996 var argsValue = new Value(world.listType, argList, false, true, false); | 12020 var argsValue = new Value(world.listType, argList, node.span, false, true, f
alse); |
| 11997 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null,
[argsValue])); | 12021 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null,
[argsValue])); |
| 11998 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa
p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, resu
lt.code, node.span); | 12022 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa
p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, resu
lt.code, node.span); |
| 11999 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value
())); | 12023 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value
())); |
| 12000 } | 12024 } |
| 12001 return new Value(mapImplType, code, false, true, false); | 12025 return new Value(mapImplType, code, node.span, false, true, false); |
| 12002 } | 12026 } |
| 12003 MethodGenerator.prototype.visitConditionalExpression = function(node) { | 12027 MethodGenerator.prototype.visitConditionalExpression = function(node) { |
| 12004 var $0; | 12028 var $0; |
| 12005 var test = this.visitBool(node.test); | 12029 var test = this.visitBool(node.test); |
| 12006 var trueBranch = this.visitValue(node.trueBranch); | 12030 var trueBranch = this.visitValue(node.trueBranch); |
| 12007 var falseBranch = this.visitValue(node.falseBranch); | 12031 var falseBranch = this.visitValue(node.falseBranch); |
| 12008 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod
e + ''); | 12032 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod
e + ''); |
| 12009 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type())
, (($0 = falseBranch.type) && $0.is$lang_Type())), code, false, true, false); | 12033 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type())
, (($0 = falseBranch.type) && $0.is$lang_Type())), code, node.span, false, true,
false); |
| 12010 } | 12034 } |
| 12011 MethodGenerator.prototype.visitIsExpression = function(node) { | 12035 MethodGenerator.prototype.visitIsExpression = function(node) { |
| 12012 var value = this.visitValue(node.x); | 12036 var value = this.visitValue(node.x); |
| 12013 var type = this.method.resolveType(node.type, false); | 12037 var type = this.method.resolveType(node.type, false); |
| 12014 return value.instanceOf(this, (type && type.is$lang_Type()), node.span, node.i
sTrue, false); | 12038 return value.instanceOf(this, (type && type.is$lang_Type()), node.span, node.i
sTrue, false); |
| 12015 } | 12039 } |
| 12016 MethodGenerator.prototype.visitParenExpression = function(node) { | 12040 MethodGenerator.prototype.visitParenExpression = function(node) { |
| 12041 var $0; |
| 12017 var body = this.visitValue(node.body); | 12042 var body = this.visitValue(node.body); |
| 12018 if ($notnull_bool(body.get$isConst())) { | 12043 if ($notnull_bool(body.get$isConst())) { |
| 12019 return EvaluatedValue.EvaluatedValue$factory(body.type, body.get$actualValue
(), ('(' + body.canonicalCode + ')'), node.span); | 12044 return EvaluatedValue.EvaluatedValue$factory((($0 = body.type) && $0.is$lang
_Type()), body.get$actualValue(), ('(' + body.canonicalCode + ')'), node.span); |
| 12020 } | 12045 } |
| 12021 return new Value(body.type, ('(' + body.code + ')'), false, true, false); | 12046 return new Value(body.type, ('(' + body.code + ')'), node.span, false, true, f
alse); |
| 12022 } | 12047 } |
| 12023 MethodGenerator.prototype.visitDotExpression = function(node) { | 12048 MethodGenerator.prototype.visitDotExpression = function(node) { |
| 12024 var target = node.self.visit(this); | 12049 var target = node.self.visit(this); |
| 12025 return target.get_$3(this, node.name.name, node.name); | 12050 return target.get_(this, node.name.name, node.name); |
| 12026 } | 12051 } |
| 12027 MethodGenerator.prototype.visitVarExpression = function(node) { | 12052 MethodGenerator.prototype.visitVarExpression = function(node) { |
| 12028 var ret = this._scope.lookup(node.name.name); | 12053 var name = node.name.name; |
| 12054 var ret = this._scope.lookup(name); |
| 12029 if ($notnull_bool($ne(ret, null))) return ret; | 12055 if ($notnull_bool($ne(ret, null))) return ret; |
| 12030 ret = this.method.declaringType.resolveMember(node.name.name); | 12056 return this._makeThisOrType(node.span).get_(this, name, node); |
| 12031 if ($notnull_bool($ne(ret, null))) { | |
| 12032 return ret.get_$3(this, node, this._makeThisOrType()); | |
| 12033 } | |
| 12034 ret = this.method.declaringType.get$library().lookup(node.name.name, node.span
); | |
| 12035 if ($notnull_bool($ne(ret, null))) { | |
| 12036 return ret.get_$3(this, node); | |
| 12037 } | |
| 12038 world.warning(('can not resolve ' + node.name.name + ''), node.span); | |
| 12039 return this._makeMissingValue(node.name.name); | |
| 12040 } | 12057 } |
| 12041 MethodGenerator.prototype._makeMissingValue = function(name) { | 12058 MethodGenerator.prototype._makeMissingValue = function(name) { |
| 12042 return new Value(null, ('' + name + '()/*NotFound*/'), false, true, false); | 12059 return new Value(null, ('' + name + '()/*NotFound*/'), null, false, true, fals
e); |
| 12043 } | 12060 } |
| 12044 MethodGenerator.prototype._makeThisOrType = function() { | 12061 MethodGenerator.prototype._makeThisOrType = function(span) { |
| 12045 var outermost = this._getOutermostMethod(); | 12062 var $0; |
| 12046 if ($notnull_bool(outermost.method.get$isStatic())) { | 12063 return new BareValue(this, (($0 = this._getOutermostMethod()) && $0.is$MethodG
enerator()), span); |
| 12047 return this._makeTypeValue(outermost.method.declaringType); | |
| 12048 } | |
| 12049 else { | |
| 12050 return this._makeThisValue(null); | |
| 12051 } | |
| 12052 } | |
| 12053 MethodGenerator.prototype._makeTypeValue = function(type) { | |
| 12054 return new Value(type, type.get$jsname(), false, false, true); | |
| 12055 } | 12064 } |
| 12056 MethodGenerator.prototype.visitThisExpression = function(node) { | 12065 MethodGenerator.prototype.visitThisExpression = function(node) { |
| 12057 return this._makeThisValue(node); | 12066 return this._makeThisValue(node); |
| 12058 } | 12067 } |
| 12059 MethodGenerator.prototype.visitSuperExpression = function(node) { | 12068 MethodGenerator.prototype.visitSuperExpression = function(node) { |
| 12060 return this._makeSuperValue(node); | 12069 return this._makeSuperValue(node); |
| 12061 } | 12070 } |
| 12062 MethodGenerator.prototype.visitNullExpression = function(node) { | 12071 MethodGenerator.prototype.visitNullExpression = function(node) { |
| 12063 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); | 12072 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); |
| 12064 } | 12073 } |
| 12065 MethodGenerator.prototype.visitLiteralExpression = function(node) { | 12074 MethodGenerator.prototype.visitLiteralExpression = function(node) { |
| 12066 var $0; | 12075 var $0; |
| 12067 var type = node.type.type; | 12076 var type = node.type.type; |
| 12068 $assert($ne(type, null), "type != null", "gen.dart", 2072, 12); | 12077 $assert($ne(type, null), "type != null", "gen.dart", 2072, 12); |
| 12069 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { | 12078 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { |
| 12070 var items = []; | 12079 var items = []; |
| 12071 var $list = node.value; | 12080 var $list = node.value; |
| 12072 for (var $i = node.value.iterator(); $i.hasNext(); ) { | 12081 for (var $i = node.value.iterator(); $i.hasNext(); ) { |
| 12073 var item = $i.next(); | 12082 var item = $i.next(); |
| 12074 var val = this.visitValue((item && item.is$lang_Expression())); | 12083 var val = this.visitValue((item && item.is$lang_Expression())); |
| 12075 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); | 12084 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); |
| 12076 var code = val.code; | 12085 var code = val.code; |
| 12077 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C
onditionalExpression))) { | 12086 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C
onditionalExpression))) { |
| 12078 code = ('(' + code + ')'); | 12087 code = ('(' + code + ')'); |
| 12079 } | 12088 } |
| 12080 items.add(code); | 12089 items.add(code); |
| 12081 } | 12090 } |
| 12082 return new Value(type, ('(' + Strings.join((items && items.is$List$String())
, " + ") + ')'), false, true, false); | 12091 return new Value(type, ('(' + Strings.join((items && items.is$List$String())
, " + ") + ')'), node.span, false, true, false); |
| 12083 } | 12092 } |
| 12084 var text = node.text; | 12093 var text = node.text; |
| 12085 if ($notnull_bool(type.get$isString())) { | 12094 if ($notnull_bool(type.get$isString())) { |
| 12086 if ($notnull_bool(text.startsWith('@'))) { | 12095 if ($notnull_bool(text.startsWith('@'))) { |
| 12087 text = MethodGenerator._escapeString(parseStringLiteral($assert_String(tex
t))); | 12096 text = MethodGenerator._escapeString(parseStringLiteral($assert_String(tex
t))); |
| 12088 text = ('"' + text + '"'); | 12097 text = ('"' + text + '"'); |
| 12089 } | 12098 } |
| 12090 else if ($notnull_bool(isMultilineString($assert_String(text)))) { | 12099 else if ($notnull_bool(isMultilineString($assert_String(text)))) { |
| 12091 text = parseStringLiteral($assert_String(text)); | 12100 text = parseStringLiteral($assert_String(text)); |
| 12092 text = text.replaceAll('\n', '\\n'); | 12101 text = text.replaceAll('\n', '\\n'); |
| 12093 text = text.replaceAll('"', '\\"'); | 12102 text = text.replaceAll('"', '\\"'); |
| 12094 text = ('"' + text + '"'); | 12103 text = ('"' + text + '"'); |
| 12095 } | 12104 } |
| 12096 if ($notnull_bool(text !== node.text)) { | 12105 if ($notnull_bool(text !== node.text)) { |
| 12097 node.value = text; | 12106 node.value = text; |
| 12098 node.text = $assert_String(text); | 12107 node.text = $assert_String(text); |
| 12099 } | 12108 } |
| 12100 } | 12109 } |
| 12101 return EvaluatedValue.EvaluatedValue$factory(type, node.value, node.text, null
); | 12110 return EvaluatedValue.EvaluatedValue$factory((type && type.is$lang_Type()), no
de.value, node.text, null); |
| 12102 } | 12111 } |
| 12103 MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { | 12112 MethodGenerator.prototype.visitPostfixExpression$1 = function($0) { |
| 12104 return this.visitPostfixExpression(($0 && $0.is$PostfixExpression()), false); | 12113 return this.visitPostfixExpression(($0 && $0.is$PostfixExpression()), false); |
| 12105 } | 12114 } |
| 12106 ; | 12115 ; |
| 12107 // ********** Code for Arguments ************** | 12116 // ********** Code for Arguments ************** |
| 12108 function Arguments(nodes, values) { | 12117 function Arguments(nodes, values) { |
| 12109 this.nodes = nodes; | 12118 this.nodes = nodes; |
| 12110 this.values = values; | 12119 this.values = values; |
| 12111 // Initializers done | 12120 // Initializers done |
| 12112 } | 12121 } |
| 12113 Arguments.prototype.is$Arguments = function(){return this;}; | 12122 Arguments.prototype.is$Arguments = function(){return this;}; |
| 12114 Arguments.Arguments$bare$factory = function(arity) { | 12123 Arguments.Arguments$bare$factory = function(arity) { |
| 12115 var values = []; | 12124 var values = []; |
| 12116 for (var i = 0; | 12125 for (var i = 0; |
| 12117 $notnull_bool(i < arity); i++) { | 12126 $notnull_bool(i < arity); i++) { |
| 12118 values.add(new Value(world.varType, ('\$' + i + ''), false, false, false)); | 12127 values.add(new Value(world.varType, ('\$' + i + ''), null, false, false, fal
se)); |
| 12119 } | 12128 } |
| 12120 return new Arguments(null, values); | 12129 return new Arguments(null, values); |
| 12121 } | 12130 } |
| 12122 Arguments.get$EMPTY = function() { | 12131 Arguments.get$EMPTY = function() { |
| 12123 if ($notnull_bool(Arguments._empty == null)) { | 12132 if ($notnull_bool(Arguments._empty == null)) { |
| 12124 Arguments._empty = new Arguments(null, []); | 12133 Arguments._empty = new Arguments(null, []); |
| 12125 } | 12134 } |
| 12126 return Arguments._empty; | 12135 return Arguments._empty; |
| 12127 } | 12136 } |
| 12128 Arguments.prototype.get$nameCount = function() { | 12137 Arguments.prototype.get$nameCount = function() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12187 for (var i = this.get$bareCount(); | 12196 for (var i = this.get$bareCount(); |
| 12188 $notnull_bool(i < this.get$length()); i++) { | 12197 $notnull_bool(i < this.get$length()); i++) { |
| 12189 names.add(this.getName(i)); | 12198 names.add(this.getName(i)); |
| 12190 } | 12199 } |
| 12191 return names; | 12200 return names; |
| 12192 } | 12201 } |
| 12193 Arguments.prototype.toCallStubArgs = function() { | 12202 Arguments.prototype.toCallStubArgs = function() { |
| 12194 var result = []; | 12203 var result = []; |
| 12195 for (var i = 0; | 12204 for (var i = 0; |
| 12196 $notnull_bool(i < this.get$bareCount()); i++) { | 12205 $notnull_bool(i < this.get$bareCount()); i++) { |
| 12197 result.add(new Value(world.varType, ('\$' + i + ''), false, false, false)); | 12206 result.add(new Value(world.varType, ('\$' + i + ''), null, false, false, fal
se)); |
| 12198 } | 12207 } |
| 12199 for (var i = this.get$bareCount(); | 12208 for (var i = this.get$bareCount(); |
| 12200 $notnull_bool(i < this.get$length()); i++) { | 12209 $notnull_bool(i < this.get$length()); i++) { |
| 12201 var name = this.getName(i); | 12210 var name = this.getName(i); |
| 12202 if ($notnull_bool(name == null)) name = ('\$' + i + ''); | 12211 if ($notnull_bool(name == null)) name = ('\$' + i + ''); |
| 12203 result.add(new Value(world.varType, name, false, false, false)); | 12212 result.add(new Value(world.varType, name, null, false, false, false)); |
| 12204 } | 12213 } |
| 12205 return new Arguments(this.nodes, result); | 12214 return new Arguments(this.nodes, result); |
| 12206 } | 12215 } |
| 12207 // ********** Code for LibraryImport ************** | 12216 // ********** Code for LibraryImport ************** |
| 12208 function LibraryImport(library, prefix) { | 12217 function LibraryImport(library, prefix) { |
| 12209 this.library = library; | 12218 this.library = library; |
| 12210 this.prefix = prefix; | 12219 this.prefix = prefix; |
| 12211 // Initializers done | 12220 // Initializers done |
| 12212 } | 12221 } |
| 12213 LibraryImport.prototype.get$library = function() { return this.library; }; | 12222 LibraryImport.prototype.get$library = function() { return this.library; }; |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12732 Member.prototype.set$initDelegate = function(ctor) { | 12741 Member.prototype.set$initDelegate = function(ctor) { |
| 12733 return world.internalError('cannot have initializers', this.get$span()); | 12742 return world.internalError('cannot have initializers', this.get$span()); |
| 12734 } | 12743 } |
| 12735 Member.prototype.get$definition = function() { | 12744 Member.prototype.get$definition = function() { |
| 12736 return null; | 12745 return null; |
| 12737 } | 12746 } |
| 12738 Member.prototype.get$parameters = function() { | 12747 Member.prototype.get$parameters = function() { |
| 12739 return []; | 12748 return []; |
| 12740 } | 12749 } |
| 12741 Member.prototype.canInvoke = function(context, args) { | 12750 Member.prototype.canInvoke = function(context, args) { |
| 12742 return this.get$canGet() && new Value(this.get$returnType(), null, false, true
, false).canInvoke(context, '\$call', args); | 12751 return this.get$canGet() && new Value(this.get$returnType(), null, null, false
, true, false).canInvoke(context, '\$call', args); |
| 12743 } | 12752 } |
| 12744 Member.prototype.invoke = function(context, node, target, args, isDynamic) { | 12753 Member.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 12745 var newTarget = this.get_(context, node, target, isDynamic); | 12754 var newTarget = this._get(context, node, target, isDynamic); |
| 12746 return newTarget.invoke(context, '\$call', node, args, isDynamic); | 12755 return newTarget.invoke(context, '\$call', node, args, isDynamic); |
| 12747 } | 12756 } |
| 12748 Member.prototype.override = function(other) { | 12757 Member.prototype.override = function(other) { |
| 12749 if ($notnull_bool(this.get$isStatic())) { | 12758 if ($notnull_bool(this.get$isStatic())) { |
| 12750 world.error('static members can not hide parent members', this.get$span(), o
ther.get$span()); | 12759 world.error('static members can not hide parent members', this.get$span(), o
ther.get$span()); |
| 12751 return false; | 12760 return false; |
| 12752 } | 12761 } |
| 12753 else if ($notnull_bool(other.get$isStatic())) { | 12762 else if ($notnull_bool(other.get$isStatic())) { |
| 12754 world.error('can not override static member', this.get$span(), other.get$spa
n()); | 12763 world.error('can not override static member', this.get$span(), other.get$spa
n()); |
| 12755 return false; | 12764 return false; |
| 12756 } | 12765 } |
| 12757 return true; | 12766 return true; |
| 12758 } | 12767 } |
| 12759 Member.prototype.get$generatedFactoryName = function() { | 12768 Member.prototype.get$generatedFactoryName = function() { |
| 12760 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 174, 12); | 12769 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 175, 12); |
| 12761 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); | 12770 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo
rName() + '\$'); |
| 12762 if ($notnull_bool(this.name == '')) { | 12771 if ($notnull_bool(this.name == '')) { |
| 12763 return ('' + prefix + 'factory'); | 12772 return ('' + prefix + 'factory'); |
| 12764 } | 12773 } |
| 12765 else { | 12774 else { |
| 12766 return ('' + prefix + '' + this.name + '\$factory'); | 12775 return ('' + prefix + '' + this.name + '\$factory'); |
| 12767 } | 12776 } |
| 12768 } | 12777 } |
| 12769 Member.prototype.resolveType = function(node, isRequired) { | 12778 Member.prototype.resolveType = function(node, isRequired) { |
| 12770 var type = this.declaringType.resolveType(node, isRequired); | 12779 var type = this.declaringType.resolveType(node, isRequired); |
| 12771 if ($notnull_bool(this.get$isStatic() && type.get$hasTypeParams())) { | 12780 if ($notnull_bool(this.get$isStatic() && type.get$hasTypeParams())) { |
| 12772 world.error('using type parameter in static context', node.span); | 12781 world.error('using type parameter in static context', node.span); |
| 12773 } | 12782 } |
| 12774 return type; | 12783 return type; |
| 12775 } | 12784 } |
| 12776 Member.prototype.get_$3 = function($0, $1, $2) { | 12785 Member.prototype._get$3 = function($0, $1, $2) { |
| 12777 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value())); | 12786 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value())); |
| 12787 } |
| 12788 ; |
| 12789 Member.prototype._set$4 = function($0, $1, $2, $3) { |
| 12790 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value())); |
| 12778 } | 12791 } |
| 12779 ; | 12792 ; |
| 12780 Member.prototype.invoke$4 = function($0, $1, $2, $3) { | 12793 Member.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 12781 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 12794 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 12782 } | 12795 } |
| 12783 ; | 12796 ; |
| 12784 Member.prototype.set_$4 = function($0, $1, $2, $3) { | |
| 12785 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value())); | |
| 12786 } | |
| 12787 ; | |
| 12788 // ********** Code for TypeMember ************** | 12797 // ********** Code for TypeMember ************** |
| 12789 function TypeMember(type) { | 12798 function TypeMember(type) { |
| 12790 this.type = type; | 12799 this.type = type; |
| 12791 Member.call(this, type.name, type.library.topType); | 12800 Member.call(this, type.name, type.library.topType); |
| 12792 // Initializers done | 12801 // Initializers done |
| 12793 } | 12802 } |
| 12794 $inherits(TypeMember, Member); | 12803 $inherits(TypeMember, Member); |
| 12795 TypeMember.prototype.get$span = function() { | 12804 TypeMember.prototype.get$span = function() { |
| 12796 return this.type.definition.span; | 12805 return this.type.definition.span; |
| 12797 } | 12806 } |
| 12798 TypeMember.prototype.get$isStatic = function() { | 12807 TypeMember.prototype.get$isStatic = function() { |
| 12799 return true; | 12808 return true; |
| 12800 } | 12809 } |
| 12801 TypeMember.prototype.get$returnType = function() { | 12810 TypeMember.prototype.get$returnType = function() { |
| 12802 return world.varType; | 12811 return world.varType; |
| 12803 } | 12812 } |
| 12804 TypeMember.prototype.canInvoke = function(context, args) { | 12813 TypeMember.prototype.canInvoke = function(context, args) { |
| 12805 return false; | 12814 return false; |
| 12806 } | 12815 } |
| 12807 TypeMember.prototype.get$canGet = function() { | 12816 TypeMember.prototype.get$canGet = function() { |
| 12808 return true; | 12817 return true; |
| 12809 } | 12818 } |
| 12810 TypeMember.prototype.get$canSet = function() { | 12819 TypeMember.prototype.get$canSet = function() { |
| 12811 return false; | 12820 return false; |
| 12812 } | 12821 } |
| 12813 TypeMember.prototype.resolve = function(inType) { | 12822 TypeMember.prototype.resolve = function(inType) { |
| 12814 | 12823 |
| 12815 } | 12824 } |
| 12816 TypeMember.prototype.get_ = function(context, node, target, isDynamic) { | 12825 TypeMember.prototype._get = function(context, node, target, isDynamic) { |
| 12817 $assert(target == null || target.type.get$isTop(), "target == null || target.t
ype.isTop", "member.dart", 222, 12); | 12826 return new Value(this.type, this.type.get$jsname(), node.span, false, false, t
rue); |
| 12818 return new Value(this.type, this.type.get$jsname(), false, false, true); | |
| 12819 } | 12827 } |
| 12820 TypeMember.prototype.set_ = function(context, node, target, value, isDynamic) { | 12828 TypeMember.prototype._set = function(context, node, target, value, isDynamic) { |
| 12821 world.error('can not set type', this.type.definition.span); | 12829 world.error('can not set type', this.type.definition.span); |
| 12822 } | 12830 } |
| 12823 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { | 12831 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 12824 world.error('can not invoke type', this.type.definition.span); | 12832 world.error('can not invoke type', this.type.definition.span); |
| 12825 } | 12833 } |
| 12826 TypeMember.prototype.get_$3 = function($0, $1, $2) { | 12834 TypeMember.prototype._get$3 = function($0, $1, $2) { |
| 12827 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 12835 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 12836 } |
| 12837 ; |
| 12838 TypeMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 12839 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 12828 } | 12840 } |
| 12829 ; | 12841 ; |
| 12830 TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 12842 TypeMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 12831 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 12843 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 12832 } | 12844 } |
| 12833 ; | 12845 ; |
| 12834 TypeMember.prototype.set_$4 = function($0, $1, $2, $3) { | |
| 12835 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | |
| 12836 } | |
| 12837 ; | |
| 12838 // ********** Code for FieldMember ************** | 12846 // ********** Code for FieldMember ************** |
| 12839 function FieldMember(name, declaringType, definition, value) { | 12847 function FieldMember(name, declaringType, definition, value) { |
| 12840 this._providePropertySyntax = false | 12848 this._providePropertySyntax = false |
| 12841 this._computing = false | 12849 this._computing = false |
| 12842 this.definition = definition; | 12850 this.definition = definition; |
| 12843 this.value = value; | 12851 this.value = value; |
| 12844 this.isNative = false; | 12852 this.isNative = false; |
| 12845 Member.call(this, name, declaringType); | 12853 Member.call(this, name, declaringType); |
| 12846 // Initializers done | 12854 // Initializers done |
| 12847 } | 12855 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12944 world.error('non constant field must be initialized in constructor', thi
s.value.span); | 12952 world.error('non constant field must be initialized in constructor', thi
s.value.span); |
| 12945 } | 12953 } |
| 12946 } | 12954 } |
| 12947 if ($notnull_bool(this.isStatic)) { | 12955 if ($notnull_bool(this.isStatic)) { |
| 12948 this._computedValue = world.gen.globalForStaticField(this, this._computedV
alue, [this._computedValue]); | 12956 this._computedValue = world.gen.globalForStaticField(this, this._computedV
alue, [this._computedValue]); |
| 12949 } | 12957 } |
| 12950 this._computing = false; | 12958 this._computing = false; |
| 12951 } | 12959 } |
| 12952 return this._computedValue; | 12960 return this._computedValue; |
| 12953 } | 12961 } |
| 12954 FieldMember.prototype.get_ = function(context, node, target, isDynamic) { | 12962 FieldMember.prototype._get = function(context, node, target, isDynamic) { |
| 12955 if ($notnull_bool(!$notnull_bool(isDynamic))) { | 12963 if ($notnull_bool(!$notnull_bool(isDynamic))) { |
| 12956 this.declaringType.markUsed(); | 12964 this.declaringType.markUsed(); |
| 12957 } | 12965 } |
| 12958 if ($notnull_bool(this.isStatic)) { | 12966 if ($notnull_bool(this.isStatic)) { |
| 12959 var cv = this.computeValue(); | 12967 var cv = this.computeValue(); |
| 12960 if ($notnull_bool(this.isFinal)) { | 12968 if ($notnull_bool(this.isFinal)) { |
| 12961 return cv; | 12969 return cv; |
| 12962 } | 12970 } |
| 12963 if ($notnull_bool(this.declaringType.get$isTop())) { | 12971 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 12964 return new Value(this.type, ('' + this.get$jsname() + ''), false, true, fa
lse); | 12972 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, fals
e, true, false); |
| 12965 } | 12973 } |
| 12966 else { | 12974 else { |
| 12967 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' +
this.get$jsname() + ''), false, true, false); | 12975 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' +
this.get$jsname() + ''), node.span, false, true, false); |
| 12968 } | 12976 } |
| 12969 } | 12977 } |
| 12970 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { | 12978 else if ($notnull_bool(target.get$isConst() && this.isFinal)) { |
| 12971 var constTarget = $notnull_bool((target instanceof GlobalValue)) ? target.ge
t$dynamic().exp : target; | 12979 var constTarget = $notnull_bool((target instanceof GlobalValue)) ? target.ge
t$dynamic().exp : target; |
| 12972 if ($notnull_bool((constTarget instanceof ConstObjectValue))) { | 12980 if ($notnull_bool((constTarget instanceof ConstObjectValue))) { |
| 12973 return constTarget.fields.$index(this.name); | 12981 return constTarget.fields.$index(this.name); |
| 12974 } | 12982 } |
| 12975 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name
== 'length')) { | 12983 else if ($notnull_bool($eq(constTarget.type, world.stringType) && this.name
== 'length')) { |
| 12976 return new Value(this.type, ('' + constTarget.get$actualValue().length + '
'), false, true, false); | 12984 return new Value(this.type, ('' + constTarget.get$actualValue().length + '
'), node.span, false, true, false); |
| 12977 } | 12985 } |
| 12978 } | 12986 } |
| 12979 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''),
false, true, false); | 12987 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''),
node.span, false, true, false); |
| 12980 } | 12988 } |
| 12981 FieldMember.prototype.set_ = function(context, node, target, value, isDynamic) { | 12989 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { |
| 12982 var lhs = this.get_(context, node, target, isDynamic); | 12990 var lhs = this._get(context, node, target, isDynamic); |
| 12983 value = value.convertTo(context, this.type, node, isDynamic); | 12991 value = value.convertTo(context, this.type, node, isDynamic); |
| 12984 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), false,
true, false); | 12992 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp
an, false, true, false); |
| 12985 } | 12993 } |
| 12986 FieldMember.prototype.get_$3 = function($0, $1, $2) { | 12994 FieldMember.prototype._get$3 = function($0, $1, $2) { |
| 12987 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 12995 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 12988 } | 12996 } |
| 12989 ; | 12997 ; |
| 12990 FieldMember.prototype.set_$4 = function($0, $1, $2, $3) { | 12998 FieldMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 12991 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 12999 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 12992 } | 13000 } |
| 12993 ; | 13001 ; |
| 12994 // ********** Code for PropertyMember ************** | 13002 // ********** Code for PropertyMember ************** |
| 12995 function PropertyMember(name, declaringType) { | 13003 function PropertyMember(name, declaringType) { |
| 12996 this._provideFieldSyntax = false | 13004 this._provideFieldSyntax = false |
| 12997 Member.call(this, name, declaringType); | 13005 Member.call(this, name, declaringType); |
| 12998 // Initializers done | 13006 // Initializers done |
| 12999 } | 13007 } |
| 13000 $inherits(PropertyMember, Member); | 13008 $inherits(PropertyMember, Member); |
| 13001 PropertyMember.prototype.is$PropertyMember = function(){return this;}; | 13009 PropertyMember.prototype.is$PropertyMember = function(){return this;}; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13034 if ($notnull_bool(other.get$isProperty() || other.get$isField())) { | 13042 if ($notnull_bool(other.get$isProperty() || other.get$isField())) { |
| 13035 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); | 13043 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); |
| 13036 else this._overriddenField = other; | 13044 else this._overriddenField = other; |
| 13037 return true; | 13045 return true; |
| 13038 } | 13046 } |
| 13039 else { | 13047 else { |
| 13040 world.error('property can only override field or property', this.get$span(),
other.get$span()); | 13048 world.error('property can only override field or property', this.get$span(),
other.get$span()); |
| 13041 return false; | 13049 return false; |
| 13042 } | 13050 } |
| 13043 } | 13051 } |
| 13044 PropertyMember.prototype.get_ = function(context, node, target, isDynamic) { | 13052 PropertyMember.prototype._get = function(context, node, target, isDynamic) { |
| 13045 if ($notnull_bool(this.getter == null)) { | 13053 if ($notnull_bool(this.getter == null)) { |
| 13046 if ($notnull_bool(this._overriddenField != null)) { | 13054 if ($notnull_bool(this._overriddenField != null)) { |
| 13047 return this._overriddenField.get_(context, node, target, isDynamic); | 13055 return this._overriddenField._get(context, node, target, isDynamic); |
| 13048 } | 13056 } |
| 13049 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); | 13057 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); |
| 13050 } | 13058 } |
| 13051 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false)
; | 13059 return this.getter.invoke(context, node, target, Arguments.get$EMPTY(), false)
; |
| 13052 } | 13060 } |
| 13053 PropertyMember.prototype.set_ = function(context, node, target, value, isDynamic
) { | 13061 PropertyMember.prototype._set = function(context, node, target, value, isDynamic
) { |
| 13054 if ($notnull_bool(this.setter == null)) { | 13062 if ($notnull_bool(this.setter == null)) { |
| 13055 if ($notnull_bool(this._overriddenField != null)) { | 13063 if ($notnull_bool(this._overriddenField != null)) { |
| 13056 return this._overriddenField.set_(context, node, target, value, isDynamic)
; | 13064 return this._overriddenField._set(context, node, target, value, isDynamic)
; |
| 13057 } | 13065 } |
| 13058 return target.invokeNoSuchMethod(context, ('set:' + this.name + ''), node, n
ew Arguments(null, [value])); | 13066 return target.invokeNoSuchMethod(context, ('set:' + this.name + ''), node, n
ew Arguments(null, [value])); |
| 13059 } | 13067 } |
| 13060 return this.setter.invoke(context, node, target, new Arguments(null, [value]),
isDynamic); | 13068 return this.setter.invoke(context, node, target, new Arguments(null, [value]),
isDynamic); |
| 13061 } | 13069 } |
| 13062 PropertyMember.prototype.addFromParent = function(parentMember) { | 13070 PropertyMember.prototype.addFromParent = function(parentMember) { |
| 13063 var $0; | 13071 var $0; |
| 13064 var parent; | 13072 var parent; |
| 13065 if ($notnull_bool((parentMember instanceof ConcreteMember))) { | 13073 if ($notnull_bool((parentMember instanceof ConcreteMember))) { |
| 13066 var c = (parentMember && parentMember.is$ConcreteMember()); | 13074 var c = (parentMember && parentMember.is$ConcreteMember()); |
| 13067 parent = (($0 = c.baseMember) && $0.is$PropertyMember()); | 13075 parent = (($0 = c.baseMember) && $0.is$PropertyMember()); |
| 13068 } | 13076 } |
| 13069 else { | 13077 else { |
| 13070 parent = (parentMember && parentMember.is$PropertyMember()); | 13078 parent = (parentMember && parentMember.is$PropertyMember()); |
| 13071 } | 13079 } |
| 13072 if ($notnull_bool(this.getter == null)) this.getter = parent.getter; | 13080 if ($notnull_bool(this.getter == null)) this.getter = parent.getter; |
| 13073 if ($notnull_bool(this.setter == null)) this.setter = parent.setter; | 13081 if ($notnull_bool(this.setter == null)) this.setter = parent.setter; |
| 13074 } | 13082 } |
| 13075 PropertyMember.prototype.resolve = function(inType) { | 13083 PropertyMember.prototype.resolve = function(inType) { |
| 13076 if ($notnull_bool(this.getter != null)) this.getter.resolve(inType); | 13084 if ($notnull_bool(this.getter != null)) this.getter.resolve(inType); |
| 13077 if ($notnull_bool(this.setter != null)) this.setter.resolve(inType); | 13085 if ($notnull_bool(this.setter != null)) this.setter.resolve(inType); |
| 13078 this.get$library()._addMember(this); | 13086 this.get$library()._addMember(this); |
| 13079 } | 13087 } |
| 13080 PropertyMember.prototype.get_$3 = function($0, $1, $2) { | 13088 PropertyMember.prototype._get$3 = function($0, $1, $2) { |
| 13081 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 13089 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 13082 } | 13090 } |
| 13083 ; | 13091 ; |
| 13084 PropertyMember.prototype.set_$4 = function($0, $1, $2, $3) { | 13092 PropertyMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 13085 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | 13093 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 13086 } | 13094 } |
| 13087 ; | 13095 ; |
| 13088 // ********** Code for ConcreteMember ************** | 13096 // ********** Code for ConcreteMember ************** |
| 13089 function ConcreteMember(name, declaringType, baseMember) { | 13097 function ConcreteMember(name, declaringType, baseMember) { |
| 13090 this.baseMember = baseMember; | 13098 this.baseMember = baseMember; |
| 13091 Member.call(this, name, declaringType); | 13099 Member.call(this, name, declaringType); |
| 13092 // Initializers done | 13100 // Initializers done |
| 13093 this.parameters = []; | 13101 this.parameters = []; |
| 13094 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring
Type); | 13102 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring
Type); |
| 13095 var $list = this.baseMember.get$parameters(); | 13103 var $list = this.baseMember.get$parameters(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13176 ConcreteMember.prototype.set$initDelegate = function(ctor) { | 13184 ConcreteMember.prototype.set$initDelegate = function(ctor) { |
| 13177 this.baseMember.set$initDelegate(ctor); | 13185 this.baseMember.set$initDelegate(ctor); |
| 13178 } | 13186 } |
| 13179 ConcreteMember.prototype.resolveType = function(node, isRequired) { | 13187 ConcreteMember.prototype.resolveType = function(node, isRequired) { |
| 13180 var type = this.baseMember.resolveType(node, isRequired); | 13188 var type = this.baseMember.resolveType(node, isRequired); |
| 13181 return type.resolveTypeParams(this.declaringType); | 13189 return type.resolveTypeParams(this.declaringType); |
| 13182 } | 13190 } |
| 13183 ConcreteMember.prototype.override = function(other) { | 13191 ConcreteMember.prototype.override = function(other) { |
| 13184 return this.baseMember.override(other); | 13192 return this.baseMember.override(other); |
| 13185 } | 13193 } |
| 13186 ConcreteMember.prototype.get_ = function(context, node, target, isDynamic) { | 13194 ConcreteMember.prototype._get = function(context, node, target, isDynamic) { |
| 13187 var ret = this.baseMember.get_(context, node, target, isDynamic); | 13195 var ret = this.baseMember._get(context, node, target, isDynamic); |
| 13188 return new Value(this.returnType, ret.code, false, true, false); | 13196 return new Value(this.returnType, ret.code, node.span, false, true, false); |
| 13189 } | 13197 } |
| 13190 ConcreteMember.prototype.set_ = function(context, node, target, value, isDynamic
) { | 13198 ConcreteMember.prototype._set = function(context, node, target, value, isDynamic
) { |
| 13191 var ret = this.baseMember.set_(context, node, target, value, isDynamic); | 13199 var ret = this.baseMember._set(context, node, target, value, isDynamic); |
| 13192 return new Value(this.returnType, ret.code, false, true, false); | 13200 return new Value(this.returnType, ret.code, node.span, false, true, false); |
| 13193 } | 13201 } |
| 13194 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami
c) { | 13202 ConcreteMember.prototype.invoke = function(context, node, target, args, isDynami
c) { |
| 13195 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); | 13203 var ret = this.baseMember.invoke(context, node, target, args, isDynamic); |
| 13196 var code = ret.code; | 13204 var code = ret.code; |
| 13197 if ($notnull_bool(this.get$isConstructor())) { | 13205 if ($notnull_bool(this.get$isConstructor())) { |
| 13198 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(),
this.declaringType.get$jsname()); | 13206 code = code.replaceFirst(this.declaringType.get$genericType().get$jsname(),
this.declaringType.get$jsname()); |
| 13199 } | 13207 } |
| 13200 this.declaringType.genMethod(this); | 13208 this.declaringType.genMethod(this); |
| 13201 return new Value(this.returnType, code, false, true, false); | 13209 return new Value(this.returnType, code, node.span, false, true, false); |
| 13202 } | 13210 } |
| 13203 ConcreteMember.prototype.get_$3 = function($0, $1, $2) { | 13211 ConcreteMember.prototype._get$3 = function($0, $1, $2) { |
| 13204 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 13212 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 13213 } |
| 13214 ; |
| 13215 ConcreteMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 13216 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 13205 } | 13217 } |
| 13206 ; | 13218 ; |
| 13207 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 13219 ConcreteMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 13208 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 13220 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 13209 } | 13221 } |
| 13210 ; | 13222 ; |
| 13211 ConcreteMember.prototype.set_$4 = function($0, $1, $2, $3) { | |
| 13212 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | |
| 13213 } | |
| 13214 ; | |
| 13215 // ********** Code for MethodMember ************** | 13223 // ********** Code for MethodMember ************** |
| 13216 function MethodMember(name, declaringType, definition) { | 13224 function MethodMember(name, declaringType, definition) { |
| 13217 this.isStatic = false | 13225 this.isStatic = false |
| 13218 this.isAbstract = false | 13226 this.isAbstract = false |
| 13219 this.isConst = false | 13227 this.isConst = false |
| 13220 this.isFactory = false | 13228 this.isFactory = false |
| 13221 this.isLambda = false | 13229 this.isLambda = false |
| 13222 this._providePropertySyntax = false | 13230 this._providePropertySyntax = false |
| 13223 this._provideFieldSyntax = false | 13231 this._provideFieldSyntax = false |
| 13224 this._provideOptionalParamInfo = false | 13232 this._provideOptionalParamInfo = false |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13325 } | 13333 } |
| 13326 MethodMember.prototype.get$requiresFieldSyntax = function() { | 13334 MethodMember.prototype.get$requiresFieldSyntax = function() { |
| 13327 return false; | 13335 return false; |
| 13328 } | 13336 } |
| 13329 MethodMember.prototype.provideFieldSyntax = function() { | 13337 MethodMember.prototype.provideFieldSyntax = function() { |
| 13330 return this._provideFieldSyntax = true; | 13338 return this._provideFieldSyntax = true; |
| 13331 } | 13339 } |
| 13332 MethodMember.prototype.providePropertySyntax = function() { | 13340 MethodMember.prototype.providePropertySyntax = function() { |
| 13333 return this._providePropertySyntax = true; | 13341 return this._providePropertySyntax = true; |
| 13334 } | 13342 } |
| 13335 MethodMember.prototype.set_ = function(context, Node, target, value, isDynamic)
{ | 13343 MethodMember.prototype._set = function(context, Node, target, value, isDynamic)
{ |
| 13336 world.error('can not set method', this.definition.span); | 13344 world.error('can not set method', this.definition.span); |
| 13337 } | 13345 } |
| 13338 MethodMember.prototype.get_ = function(context, node, target, isDynamic) { | 13346 MethodMember.prototype._get = function(context, node, target, isDynamic) { |
| 13339 this.declaringType.genMethod(this); | 13347 this.declaringType.genMethod(this); |
| 13340 this._provideOptionalParamInfo = true; | 13348 this._provideOptionalParamInfo = true; |
| 13341 if ($notnull_bool(this.isStatic)) { | 13349 if ($notnull_bool(this.isStatic)) { |
| 13342 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d
eclaringType.get$jsname() + '.'); | 13350 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d
eclaringType.get$jsname() + '.'); |
| 13343 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname(
) + ''), false, true, false); | 13351 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname(
) + ''), node.span, false, true, false); |
| 13344 } | 13352 } |
| 13345 this._providePropertySyntax = true; | 13353 this._providePropertySyntax = true; |
| 13346 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.
get$jsname() + '()'), false, true, false); | 13354 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this.
get$jsname() + '()'), node.span, false, true, false); |
| 13347 } | 13355 } |
| 13348 MethodMember.prototype.namesInOrder = function(args) { | 13356 MethodMember.prototype.namesInOrder = function(args) { |
| 13349 if ($notnull_bool(!$notnull_bool(args.get$hasNames()))) return true; | 13357 if ($notnull_bool(!$notnull_bool(args.get$hasNames()))) return true; |
| 13350 var lastParameter = null; | 13358 var lastParameter = null; |
| 13351 for (var i = args.get$bareCount(); | 13359 for (var i = args.get$bareCount(); |
| 13352 $notnull_bool(i < this.parameters.length); i++) { | 13360 $notnull_bool(i < this.parameters.length); i++) { |
| 13353 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam
e())); | 13361 var p = args.getIndexOfName($assert_String(this.parameters.$index(i).get$nam
e())); |
| 13354 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { | 13362 if ($notnull_bool(p >= 0 && args.values.$index(p).needsTemp)) { |
| 13355 if ($notnull_bool(lastParameter != null && lastParameter > $assert_num(p))
) { | 13363 if ($notnull_bool(lastParameter != null && lastParameter > $assert_num(p))
) { |
| 13356 return false; | 13364 return false; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13474 } | 13482 } |
| 13475 world.internalError(('wrong named arguments calling ' + this.name + ''), n
ode.span); | 13483 world.internalError(('wrong named arguments calling ' + this.name + ''), n
ode.span); |
| 13476 } | 13484 } |
| 13477 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); | 13485 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); |
| 13478 } | 13486 } |
| 13479 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); | 13487 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); |
| 13480 if ($notnull_bool(this.get$isConstructor())) { | 13488 if ($notnull_bool(this.get$isConstructor())) { |
| 13481 return this._invokeConstructor(context, node, target, args, argsString); | 13489 return this._invokeConstructor(context, node, target, args, argsString); |
| 13482 } | 13490 } |
| 13483 if ($notnull_bool(target != null && target.isSuper)) { | 13491 if ($notnull_bool(target != null && target.isSuper)) { |
| 13484 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
prototype.' + this.get$jsname() + '.call(' + argsString + ')'), false, true, fal
se); | 13492 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.span, false
, true, false); |
| 13485 } | 13493 } |
| 13486 if ($notnull_bool(this.name.startsWith('\$'))) { | 13494 if ($notnull_bool(this.name.startsWith('\$'))) { |
| 13487 return this._invokeBuiltin(context, node, target, args, argsCode); | 13495 return this._invokeBuiltin(context, node, target, args, argsCode); |
| 13488 } | 13496 } |
| 13489 if ($notnull_bool(this.isFactory)) { | 13497 if ($notnull_bool(this.isFactory)) { |
| 13490 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '(
' + argsString + ')'), false, true, false); | 13498 return new Value(this.returnType, ('' + this.get$generatedFactoryName() + '(
' + argsString + ')'), node.span, false, true, false); |
| 13491 } | 13499 } |
| 13492 if ($notnull_bool(this.isStatic)) { | 13500 if ($notnull_bool(this.isStatic)) { |
| 13493 if ($notnull_bool(this.declaringType.get$isTop())) { | 13501 if ($notnull_bool(this.declaringType.get$isTop())) { |
| 13494 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri
ng + ')'), false, true, false); | 13502 return new Value(this.returnType, ('' + this.get$jsname() + '(' + argsStri
ng + ')'), $notnull_bool(node != null) ? node.span : node, false, true, false); |
| 13495 } | 13503 } |
| 13496 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
' + this.get$jsname() + '(' + argsString + ')'), false, true, false); | 13504 return new Value(this.returnType, ('' + this.declaringType.get$jsname() + '.
' + this.get$jsname() + '(' + argsString + ')'), node.span, false, true, false); |
| 13497 } | 13505 } |
| 13498 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); | 13506 var code = ('' + target.code + '.' + this.get$jsname() + '(' + argsString + ')
'); |
| 13499 if ($notnull_bool(target.get$isConst())) { | 13507 if ($notnull_bool(target.get$isConst())) { |
| 13500 if ($notnull_bool((target instanceof GlobalValue))) { | 13508 if ($notnull_bool((target instanceof GlobalValue))) { |
| 13501 target = target.get$dynamic().exp; | 13509 target = target.get$dynamic().exp; |
| 13502 } | 13510 } |
| 13503 if ($notnull_bool(this.name == 'get\$length')) { | 13511 if ($notnull_bool(this.name == 'get\$length')) { |
| 13504 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof
ConstMapValue))) { | 13512 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof
ConstMapValue))) { |
| 13505 code = ('' + target.get$dynamic().values.length + ''); | 13513 code = ('' + target.get$dynamic().values.length + ''); |
| 13506 } | 13514 } |
| 13507 } | 13515 } |
| 13508 else if ($notnull_bool(this.name == 'isEmpty')) { | 13516 else if ($notnull_bool(this.name == 'isEmpty')) { |
| 13509 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof
ConstMapValue))) { | 13517 if ($notnull_bool((target instanceof ConstListValue) || (target instanceof
ConstMapValue))) { |
| 13510 code = ('' + target.get$dynamic().values.isEmpty() + ''); | 13518 code = ('' + target.get$dynamic().values.isEmpty() + ''); |
| 13511 } | 13519 } |
| 13512 } | 13520 } |
| 13513 } | 13521 } |
| 13514 if ($notnull_bool(this.name == 'get\$typeName' && $eq(this.declaringType.get$l
ibrary(), world.get$dom()))) { | 13522 if ($notnull_bool(this.name == 'get\$typeName' && $eq(this.declaringType.get$l
ibrary(), world.get$dom()))) { |
| 13515 world.gen.corejs.useTypeNameOf = true; | 13523 world.gen.corejs.useTypeNameOf = true; |
| 13516 } | 13524 } |
| 13517 return new Value(this.returnType, code, false, true, false); | 13525 return new Value(this.returnType, code, node.span, false, true, false); |
| 13518 } | 13526 } |
| 13519 MethodMember.prototype._invokeConstructor = function(context, node, target, args
, argsString) { | 13527 MethodMember.prototype._invokeConstructor = function(context, node, target, args
, argsString) { |
| 13520 this.declaringType.markUsed(); | 13528 this.declaringType.markUsed(); |
| 13521 if ($notnull_bool(target != null)) { | 13529 if ($notnull_bool(target != null)) { |
| 13522 var code = $notnull_bool((this.get$constructorName() != '')) ? ('' + this.de
claringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + a
rgsString + ')') : ('' + this.declaringType.get$jsname() + '.call(' + argsString
+ ')'); | 13530 var code = $notnull_bool((this.get$constructorName() != '')) ? ('' + this.de
claringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + a
rgsString + ')') : ('' + this.declaringType.get$jsname() + '.call(' + argsString
+ ')'); |
| 13523 return new Value(this.declaringType, code, false, true, false); | 13531 return new Value(this.declaringType, code, node.span, false, true, false); |
| 13524 } | 13532 } |
| 13525 else { | 13533 else { |
| 13526 var code = $notnull_bool((this.get$constructorName() != '')) ? ('new ' + thi
s.declaringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + ar
gsString + ')') : ('new ' + this.declaringType.get$jsname() + '(' + argsString +
')'); | 13534 var code = $notnull_bool((this.get$constructorName() != '')) ? ('new ' + thi
s.declaringType.get$jsname() + '.' + this.get$constructorName() + '\$ctor(' + ar
gsString + ')') : ('new ' + this.declaringType.get$jsname() + '(' + argsString +
')'); |
| 13527 if ($notnull_bool(this.isConst && (node instanceof lang_NewExpression) && no
de.get$dynamic().get$isConst())) { | 13535 if ($notnull_bool(this.isConst && (node instanceof lang_NewExpression) && no
de.get$dynamic().get$isConst())) { |
| 13528 return this._invokeConstConstructor(node, $assert_String(code), target, ar
gs); | 13536 return this._invokeConstConstructor(node, $assert_String(code), target, ar
gs); |
| 13529 } | 13537 } |
| 13530 else { | 13538 else { |
| 13531 return new Value(this.declaringType, code, false, true, false); | 13539 return new Value(this.declaringType, code, node.span, false, true, false); |
| 13532 } | 13540 } |
| 13533 } | 13541 } |
| 13534 } | 13542 } |
| 13535 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
gs) { | 13543 MethodMember.prototype._invokeConstConstructor = function(node, code, target, ar
gs) { |
| 13536 var $0; | 13544 var $0; |
| 13537 var fields = new HashMapImplementation$String$EvaluatedValue(); | 13545 var fields = new HashMapImplementation$String$EvaluatedValue(); |
| 13538 for (var i = 0; | 13546 for (var i = 0; |
| 13539 $notnull_bool(i < this.parameters.length); i++) { | 13547 $notnull_bool(i < this.parameters.length); i++) { |
| 13540 var param = this.parameters.$index(i); | 13548 var param = this.parameters.$index(i); |
| 13541 if ($notnull_bool(param.isInitializer)) { | 13549 if ($notnull_bool(param.isInitializer)) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13623 code = ('~' + target.code + ''); | 13631 code = ('~' + target.code + ''); |
| 13624 } | 13632 } |
| 13625 else if ($notnull_bool(this.name == '\$truncdiv' || this.name == '\$mod'))
{ | 13633 else if ($notnull_bool(this.name == '\$truncdiv' || this.name == '\$mod'))
{ |
| 13626 world.gen.corejs.useOperator(this.name); | 13634 world.gen.corejs.useOperator(this.name); |
| 13627 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); | 13635 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) +
')'); |
| 13628 } | 13636 } |
| 13629 else { | 13637 else { |
| 13630 var op = TokenKind.rawOperatorFromMethod(this.name); | 13638 var op = TokenKind.rawOperatorFromMethod(this.name); |
| 13631 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); | 13639 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); |
| 13632 } | 13640 } |
| 13633 return new Value(this.returnType, code, false, true, false); | 13641 return new Value(this.returnType, code, node.span, false, true, false); |
| 13634 } | 13642 } |
| 13635 else { | 13643 else { |
| 13636 var value; | 13644 var value; |
| 13637 var val0, val1, ival0, ival1; | 13645 var val0, val1, ival0, ival1; |
| 13638 val0 = $assert_num(target.get$dynamic().get$actualValue()); | 13646 val0 = $assert_num(target.get$dynamic().get$actualValue()); |
| 13639 ival0 = val0.toInt(); | 13647 ival0 = val0.toInt(); |
| 13640 if ($notnull_bool(args.values.length > 0)) { | 13648 if ($notnull_bool(args.values.length > 0)) { |
| 13641 val1 = $assert_num(args.values.$index(0).get$dynamic().get$actualValue()
); | 13649 val1 = $assert_num(args.values.$index(0).get$dynamic().get$actualValue()
); |
| 13642 ival1 = val1.toInt(); | 13650 ival1 = val1.toInt(); |
| 13643 } | 13651 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13741 | 13749 |
| 13742 value = (ival0 >>> ival1).toDouble(); | 13750 value = (ival0 >>> ival1).toDouble(); |
| 13743 break; | 13751 break; |
| 13744 | 13752 |
| 13745 } | 13753 } |
| 13746 return EvaluatedValue.EvaluatedValue$factory(this.returnType, value, ("" +
value + ""), node.span); | 13754 return EvaluatedValue.EvaluatedValue$factory(this.returnType, value, ("" +
value + ""), node.span); |
| 13747 } | 13755 } |
| 13748 } | 13756 } |
| 13749 else if ($notnull_bool(this.declaringType.get$isString())) { | 13757 else if ($notnull_bool(this.declaringType.get$isString())) { |
| 13750 if ($notnull_bool(this.name == '\$index')) { | 13758 if ($notnull_bool(this.name == '\$index')) { |
| 13751 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i
ndex(0) + ']'), false, true, false); | 13759 return new Value(this.declaringType, ('' + target.code + '[' + argsCode.$i
ndex(0) + ']'), node.span, false, true, false); |
| 13752 } | 13760 } |
| 13753 else if ($notnull_bool(this.name == '\$add')) { | 13761 else if ($notnull_bool(this.name == '\$add')) { |
| 13754 if ($notnull_bool(allConst)) { | 13762 if ($notnull_bool(allConst)) { |
| 13755 var val0 = target.get$dynamic().get$actualValue(); | 13763 var val0 = target.get$dynamic().get$actualValue(); |
| 13756 val0 = val0.substring(1, val0.length - 1); | 13764 val0 = val0.substring(1, val0.length - 1); |
| 13757 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 13765 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 13758 if ($notnull_bool(args.values.$index(0).type.get$isString())) { | 13766 if ($notnull_bool(args.values.$index(0).type.get$isString())) { |
| 13759 val1 = val1.substring(1, val1.length - 1); | 13767 val1 = val1.substring(1, val1.length - 1); |
| 13760 } | 13768 } |
| 13761 var value = ('' + val0 + '' + val1 + ''); | 13769 var value = ('' + val0 + '' + val1 + ''); |
| 13762 value = '"' + value.replaceAll('"', '\\"') + '"'; | 13770 value = '"' + value.replaceAll('"', '\\"') + '"'; |
| 13763 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, va
lue, node.span); | 13771 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a
ssert_String(value), node.span); |
| 13764 } | 13772 } |
| 13765 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM
PTY()); | 13773 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM
PTY()); |
| 13766 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode.
$index(0) + ''), false, true, false); | 13774 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode.
$index(0) + ''), node.span, false, true, false); |
| 13767 } | 13775 } |
| 13768 } | 13776 } |
| 13769 else if ($notnull_bool(this.declaringType.get$isNativeType())) { | 13777 else if ($notnull_bool(this.declaringType.get$isNativeType())) { |
| 13770 if ($notnull_bool(this.name == '\$index')) { | 13778 if ($notnull_bool(this.name == '\$index')) { |
| 13771 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + ']')
, false, true, false); | 13779 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + ']')
, node.span, false, true, false); |
| 13772 } | 13780 } |
| 13773 else if ($notnull_bool(this.name == '\$setindex')) { | 13781 else if ($notnull_bool(this.name == '\$setindex')) { |
| 13774 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + '] =
' + argsCode.$index(1) + ''), false, true, false); | 13782 return new Value(null, ('' + target.code + '[' + argsCode.$index(0) + '] =
' + argsCode.$index(1) + ''), node.span, false, true, false); |
| 13775 } | 13783 } |
| 13776 } | 13784 } |
| 13777 if ($notnull_bool(this.name == '\$eq' || this.name == '\$ne')) { | 13785 if ($notnull_bool(this.name == '\$eq' || this.name == '\$ne')) { |
| 13778 var op = $notnull_bool(this.name == '\$eq') ? '==' : '!='; | 13786 var op = $notnull_bool(this.name == '\$eq') ? '==' : '!='; |
| 13779 if ($notnull_bool(allConst)) { | 13787 if ($notnull_bool(allConst)) { |
| 13780 var val0 = target.get$dynamic().get$actualValue(); | 13788 var val0 = target.get$dynamic().get$actualValue(); |
| 13781 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); | 13789 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); |
| 13782 var newVal = $notnull_bool(this.name == '\$eq') ? $eq(val0, val1) : $ne(va
l0, val1); | 13790 var newVal = $notnull_bool(this.name == '\$eq') ? $eq(val0, val1) : $ne(va
l0, val1); |
| 13783 return EvaluatedValue.EvaluatedValue$factory(world.boolType, newVal, ("" +
newVal + ""), node.span); | 13791 return EvaluatedValue.EvaluatedValue$factory(world.boolType, newVal, ("" +
newVal + ""), node.span); |
| 13784 } | 13792 } |
| 13785 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) { | 13793 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) { |
| 13786 return new Value(this.returnType, ('' + target.code + ' ' + op + ' null'),
false, true, false); | 13794 return new Value(this.returnType, ('' + target.code + ' ' + op + ' null'),
node.span, false, true, false); |
| 13787 } | 13795 } |
| 13788 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString()
)) { | 13796 else if ($notnull_bool(target.type.get$isNum() || target.type.get$isString()
)) { |
| 13789 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg
sCode.$index(0) + ''), false, true, false); | 13797 return new Value(this.returnType, ('' + target.code + ' ' + op + ' ' + arg
sCode.$index(0) + ''), node.span, false, true, false); |
| 13790 } | 13798 } |
| 13791 world.gen.corejs.useOperator(this.name); | 13799 world.gen.corejs.useOperator(this.name); |
| 13792 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', '
+ argsCode.$index(0) + ')'), false, true, false); | 13800 return new Value(this.returnType, ('' + this.name + '(' + target.code + ', '
+ argsCode.$index(0) + ')'), node.span, false, true, false); |
| 13793 } | 13801 } |
| 13794 if ($notnull_bool(this.name == '\$call')) { | 13802 if ($notnull_bool(this.name == '\$call')) { |
| 13795 this.declaringType.markUsed(); | 13803 this.declaringType.markUsed(); |
| 13796 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar
gsCode && argsCode.is$List$String()), ", ") + ')'), false, true, false); | 13804 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar
gsCode && argsCode.is$List$String()), ", ") + ')'), node.span, false, true, fals
e); |
| 13797 } | 13805 } |
| 13798 if ($notnull_bool(this.name == '\$index')) { | 13806 if ($notnull_bool(this.name == '\$index')) { |
| 13799 world.gen.corejs.useIndex = true; | 13807 world.gen.corejs.useIndex = true; |
| 13800 } | 13808 } |
| 13801 else if ($notnull_bool(this.name == '\$setindex')) { | 13809 else if ($notnull_bool(this.name == '\$setindex')) { |
| 13802 world.gen.corejs.useSetIndex = true; | 13810 world.gen.corejs.useSetIndex = true; |
| 13803 } | 13811 } |
| 13804 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); | 13812 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); |
| 13805 return new Value(this.returnType, ('' + target.code + '.' + this.get$jsname()
+ '(' + argsString + ')'), false, true, false); | 13813 return new Value(this.returnType, ('' + target.code + '.' + this.get$jsname()
+ '(' + argsString + ')'), node.span, false, true, false); |
| 13806 } | 13814 } |
| 13807 MethodMember.prototype.resolve = function(inType) { | 13815 MethodMember.prototype.resolve = function(inType) { |
| 13808 this.isStatic = inType.get$isTop(); | 13816 this.isStatic = inType.get$isTop(); |
| 13809 this.isConst = false; | 13817 this.isConst = false; |
| 13810 this.isFactory = false; | 13818 this.isFactory = false; |
| 13811 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); | 13819 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); |
| 13812 if ($notnull_bool(this.definition.modifiers != null)) { | 13820 if ($notnull_bool(this.definition.modifiers != null)) { |
| 13813 var $list = this.definition.modifiers; | 13821 var $list = this.definition.modifiers; |
| 13814 for (var $i = 0;$i < $list.length; $i++) { | 13822 for (var $i = 0;$i < $list.length; $i++) { |
| 13815 var mod = $list.$index($i); | 13823 var mod = $list.$index($i); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13880 for (var $i = 0;$i < $list.length; $i++) { | 13888 for (var $i = 0;$i < $list.length; $i++) { |
| 13881 var formal = $list.$index($i); | 13889 var formal = $list.$index($i); |
| 13882 var param = new Parameter(formal); | 13890 var param = new Parameter(formal); |
| 13883 param.resolve(this, inType); | 13891 param.resolve(this, inType); |
| 13884 this.parameters.add(param); | 13892 this.parameters.add(param); |
| 13885 } | 13893 } |
| 13886 if ($notnull_bool(!$notnull_bool(this.isLambda))) { | 13894 if ($notnull_bool(!$notnull_bool(this.isLambda))) { |
| 13887 this.get$library()._addMember(this); | 13895 this.get$library()._addMember(this); |
| 13888 } | 13896 } |
| 13889 } | 13897 } |
| 13890 MethodMember.prototype.get_$3 = function($0, $1, $2) { | 13898 MethodMember.prototype._get$3 = function($0, $1, $2) { |
| 13891 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 13899 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 13900 } |
| 13901 ; |
| 13902 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { |
| 13903 return this._set(($0 && $0.is$MethodGenerator()), $1, ($2 && $2.is$Value()), (
$3 && $3.is$Value()), false); |
| 13892 } | 13904 } |
| 13893 ; | 13905 ; |
| 13894 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 13906 MethodMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 13895 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 13907 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 13896 } | 13908 } |
| 13897 ; | 13909 ; |
| 13898 MethodMember.prototype.set_$4 = function($0, $1, $2, $3) { | |
| 13899 return this.set_(($0 && $0.is$MethodGenerator()), $1, ($2 && $2.is$Value()), (
$3 && $3.is$Value()), false); | |
| 13900 } | |
| 13901 ; | |
| 13902 // ********** Code for MemberSet ************** | 13910 // ********** Code for MemberSet ************** |
| 13903 function MemberSet(member) { | 13911 function MemberSet(member) { |
| 13904 this.name = member.name; | 13912 this.name = member.name; |
| 13905 this.members = [member]; | 13913 this.members = [member]; |
| 13906 this.jsname = member.get$jsname(); | 13914 this.jsname = member.get$jsname(); |
| 13907 // Initializers done | 13915 // Initializers done |
| 13908 } | 13916 } |
| 13909 MemberSet.prototype.is$MemberSet = function(){return this;}; | 13917 MemberSet.prototype.is$MemberSet = function(){return this;}; |
| 13910 MemberSet.prototype.get$name = function() { return this.name; }; | 13918 MemberSet.prototype.get$name = function() { return this.name; }; |
| 13911 MemberSet.prototype.get$members = function() { return this.members; }; | 13919 MemberSet.prototype.get$members = function() { return this.members; }; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 13928 MemberSet.prototype.canInvoke = function(context, args) { | 13936 MemberSet.prototype.canInvoke = function(context, args) { |
| 13929 return this.members.some((function (m) { | 13937 return this.members.some((function (m) { |
| 13930 return m.canInvoke(context, args); | 13938 return m.canInvoke(context, args); |
| 13931 }) | 13939 }) |
| 13932 ); | 13940 ); |
| 13933 } | 13941 } |
| 13934 MemberSet.prototype._makeError = function(node, target, action) { | 13942 MemberSet.prototype._makeError = function(node, target, action) { |
| 13935 if ($notnull_bool(!$notnull_bool(target.type.get$isVar()))) { | 13943 if ($notnull_bool(!$notnull_bool(target.type.get$isVar()))) { |
| 13936 world.warning(('could not find applicable ' + action + ' for "' + this.name
+ '"'), node.span); | 13944 world.warning(('could not find applicable ' + action + ' for "' + this.name
+ '"'), node.span); |
| 13937 } | 13945 } |
| 13938 return new Value(null, ('' + target.code + '.' + this.jsname + '() /*no applic
able ' + action + '*/'), false, true, false); | 13946 return new Value(null, ('' + target.code + '.' + this.jsname + '() /*no applic
able ' + action + '*/'), node.span, false, true, false); |
| 13939 } | 13947 } |
| 13940 MemberSet.prototype.get$treatAsField = function() { | 13948 MemberSet.prototype.get$treatAsField = function() { |
| 13941 if ($notnull_bool(this._treatAsField == null)) { | 13949 if ($notnull_bool(this._treatAsField == null)) { |
| 13942 this._treatAsField = true; | 13950 this._treatAsField = true; |
| 13943 var $list = this.members; | 13951 var $list = this.members; |
| 13944 for (var $i = 0;$i < $list.length; $i++) { | 13952 for (var $i = 0;$i < $list.length; $i++) { |
| 13945 var member = $list.$index($i); | 13953 var member = $list.$index($i); |
| 13946 if ($notnull_bool(member.get$requiresFieldSyntax())) { | 13954 if ($notnull_bool(member.get$requiresFieldSyntax())) { |
| 13947 this._treatAsField = true; | 13955 this._treatAsField = true; |
| 13948 break; | 13956 break; |
| 13949 } | 13957 } |
| 13950 if ($notnull_bool(member.get$prefersPropertySyntax())) { | 13958 if ($notnull_bool(member.get$prefersPropertySyntax())) { |
| 13951 this._treatAsField = false; | 13959 this._treatAsField = false; |
| 13952 } | 13960 } |
| 13953 } | 13961 } |
| 13954 var $list = this.members; | 13962 var $list = this.members; |
| 13955 for (var $i = 0;$i < $list.length; $i++) { | 13963 for (var $i = 0;$i < $list.length; $i++) { |
| 13956 var member = $list.$index($i); | 13964 var member = $list.$index($i); |
| 13957 if ($notnull_bool(this._treatAsField)) { | 13965 if ($notnull_bool(this._treatAsField)) { |
| 13958 member.provideFieldSyntax(); | 13966 member.provideFieldSyntax(); |
| 13959 } | 13967 } |
| 13960 else { | 13968 else { |
| 13961 member.providePropertySyntax(); | 13969 member.providePropertySyntax(); |
| 13962 } | 13970 } |
| 13963 } | 13971 } |
| 13964 } | 13972 } |
| 13965 return this._treatAsField; | 13973 return this._treatAsField; |
| 13966 } | 13974 } |
| 13967 MemberSet.prototype.get_ = function(context, node, target, isDynamic) { | 13975 MemberSet.prototype._get = function(context, node, target, isDynamic) { |
| 13968 var $0; | 13976 var $0; |
| 13969 if ($notnull_bool(this.members.length == 1)) { | 13977 if ($notnull_bool(this.members.length == 1)) { |
| 13970 return this.members.$index(0).get_(context, node, target, isDynamic); | 13978 return this.members.$index(0)._get(context, node, target, isDynamic); |
| 13971 } | 13979 } |
| 13972 var targets = this.members.filter((function (m) { | 13980 var targets = this.members.filter((function (m) { |
| 13973 return m.get$canGet(); | 13981 return m.get$canGet(); |
| 13974 }) | 13982 }) |
| 13975 ); | 13983 ); |
| 13976 if ($notnull_bool(targets.length == 1)) { | 13984 if ($notnull_bool(targets.length == 1)) { |
| 13977 return targets.$index(0).get_(context, node, target, isDynamic); | 13985 return targets.$index(0)._get(context, node, target, isDynamic); |
| 13978 } | 13986 } |
| 13979 var returnValue = null; | 13987 var returnValue = null; |
| 13980 for (var $i = targets.iterator(); $i.hasNext(); ) { | 13988 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 13981 var member = $i.next(); | 13989 var member = $i.next(); |
| 13982 var value = member.get_(context, node, target, true); | 13990 var value = member._get(context, node, target, true); |
| 13983 returnValue = this._tryUnion(returnValue, value, node); | 13991 returnValue = this._tryUnion(returnValue, value, node); |
| 13984 } | 13992 } |
| 13985 if ($notnull_bool(returnValue == null)) { | 13993 if ($notnull_bool(returnValue == null)) { |
| 13986 return this._makeError(node, target, 'getter'); | 13994 return this._makeError(node, target, 'getter'); |
| 13987 } | 13995 } |
| 13988 if ($notnull_bool(returnValue.code == null)) { | 13996 if ($notnull_bool(returnValue.code == null)) { |
| 13989 if ($notnull_bool(this.get$treatAsField())) { | 13997 if ($notnull_bool(this.get$treatAsField())) { |
| 13990 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
''), false, true, false); | 13998 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
''), node.span, false, true, false); |
| 13991 } | 13999 } |
| 13992 else { | 14000 else { |
| 13993 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn
ame + '()'), false, true, false); | 14001 return new Value(returnValue.type, ('' + target.code + '.get\$' + this.jsn
ame + '()'), node.span, false, true, false); |
| 13994 } | 14002 } |
| 13995 } | 14003 } |
| 13996 return returnValue; | 14004 return returnValue; |
| 13997 } | 14005 } |
| 13998 MemberSet.prototype.set_ = function(context, node, target, value, isDynamic) { | 14006 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { |
| 13999 var $0; | 14007 var $0; |
| 14000 if ($notnull_bool(this.members.length == 1)) { | 14008 if ($notnull_bool(this.members.length == 1)) { |
| 14001 return this.members.$index(0).set_(context, node, target, value, isDynamic); | 14009 return this.members.$index(0)._set(context, node, target, value, isDynamic); |
| 14002 } | 14010 } |
| 14003 var targets = this.members.filter((function (m) { | 14011 var targets = this.members.filter((function (m) { |
| 14004 return m.get$canSet(); | 14012 return m.get$canSet(); |
| 14005 }) | 14013 }) |
| 14006 ); | 14014 ); |
| 14007 if ($notnull_bool(targets.length == 1)) { | 14015 if ($notnull_bool(targets.length == 1)) { |
| 14008 return targets.$index(0).set_(context, node, target, value, isDynamic); | 14016 return targets.$index(0)._set(context, node, target, value, isDynamic); |
| 14009 } | 14017 } |
| 14010 var returnValue = null; | 14018 var returnValue = null; |
| 14011 for (var $i = targets.iterator(); $i.hasNext(); ) { | 14019 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 14012 var member = $i.next(); | 14020 var member = $i.next(); |
| 14013 var res = member.set_(context, node, target, value, true); | 14021 var res = member._set(context, node, target, value, true); |
| 14014 returnValue = this._tryUnion(returnValue, (res && res.is$Value()), node); | 14022 returnValue = this._tryUnion(returnValue, res, node); |
| 14015 } | 14023 } |
| 14016 if ($notnull_bool(returnValue == null)) { | 14024 if ($notnull_bool(returnValue == null)) { |
| 14017 return this._makeError(node, target, 'setter'); | 14025 return this._makeError(node, target, 'setter'); |
| 14018 } | 14026 } |
| 14019 if ($notnull_bool(returnValue.code == null)) { | 14027 if ($notnull_bool(returnValue.code == null)) { |
| 14020 if ($notnull_bool(this.get$treatAsField())) { | 14028 if ($notnull_bool(this.get$treatAsField())) { |
| 14021 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
' = ' + value.code + ''), false, true, false); | 14029 return new Value(returnValue.type, ('' + target.code + '.' + this.jsname +
' = ' + value.code + ''), node.span, false, true, false); |
| 14022 } | 14030 } |
| 14023 else { | 14031 else { |
| 14024 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn
ame + '(' + value.code + ')'), false, true, false); | 14032 return new Value(returnValue.type, ('' + target.code + '.set\$' + this.jsn
ame + '(' + value.code + ')'), node.span, false, true, false); |
| 14025 } | 14033 } |
| 14026 } | 14034 } |
| 14027 return returnValue; | 14035 return returnValue; |
| 14028 } | 14036 } |
| 14029 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { | 14037 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { |
| 14030 var $0; | 14038 var $0; |
| 14031 if ($notnull_bool(this.members.length == 1)) { | 14039 if ($notnull_bool(this.members.length == 1)) { |
| 14032 return this.members.$index(0).invoke(context, node, target, args, isDynamic)
; | 14040 return this.members.$index(0).invoke(context, node, target, args, isDynamic)
; |
| 14033 } | 14041 } |
| 14034 var targets = this.members.filter((function (m) { | 14042 var targets = this.members.filter((function (m) { |
| 14035 return m.canInvoke(context, args); | 14043 return m.canInvoke(context, args); |
| 14036 }) | 14044 }) |
| 14037 ); | 14045 ); |
| 14038 if ($notnull_bool(targets.length == 1)) { | 14046 if ($notnull_bool(targets.length == 1)) { |
| 14039 return targets.$index(0).invoke(context, node, target, args, isDynamic); | 14047 return targets.$index(0).invoke(context, node, target, args, isDynamic); |
| 14040 } | 14048 } |
| 14041 var returnValue = null; | 14049 var returnValue = null; |
| 14042 for (var $i = targets.iterator(); $i.hasNext(); ) { | 14050 for (var $i = targets.iterator(); $i.hasNext(); ) { |
| 14043 var member = $i.next(); | 14051 var member = $i.next(); |
| 14044 var res = member.invoke(context, node, target, args, true); | 14052 var res = member.invoke(context, node, target, args, true); |
| 14045 returnValue = this._tryUnion(returnValue, (res && res.is$Value()), node); | 14053 returnValue = this._tryUnion(returnValue, res, node); |
| 14046 } | 14054 } |
| 14047 if ($notnull_bool(returnValue == null)) { | 14055 if ($notnull_bool(returnValue == null)) { |
| 14048 return this._makeError(node, target, 'method'); | 14056 return this._makeError(node, target, 'method'); |
| 14049 } | 14057 } |
| 14050 if ($notnull_bool(returnValue.code == null)) { | 14058 if ($notnull_bool(returnValue.code == null)) { |
| 14051 if ($notnull_bool(this.name.startsWith('\$'))) { | 14059 if ($notnull_bool(this.name.startsWith('\$'))) { |
| 14052 return target.invokeSpecial(this.name, args, returnValue.type); | 14060 return target.invokeSpecial(this.name, args, returnValue.type); |
| 14053 } | 14061 } |
| 14054 else { | 14062 else { |
| 14055 return this.invokeOnVar(context, node, target, args); | 14063 return this.invokeOnVar(context, node, target, args); |
| 14056 } | 14064 } |
| 14057 } | 14065 } |
| 14058 return returnValue; | 14066 return returnValue; |
| 14059 } | 14067 } |
| 14060 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { | 14068 MemberSet.prototype.invokeOnVar = function(context, node, target, args) { |
| 14061 return this.getVarMember(context, node, args).invoke(context, node, target, ar
gs); | 14069 return this.getVarMember(context, node, args).invoke(context, node, target, ar
gs); |
| 14062 } | 14070 } |
| 14063 MemberSet.prototype._tryUnion = function(x, y, node) { | 14071 MemberSet.prototype._tryUnion = function(x, y, node) { |
| 14064 if ($notnull_bool(x == null)) return y; | 14072 if ($notnull_bool(x == null)) return y; |
| 14065 var type = lang_Type.union(x.type, y.type); | 14073 var type = lang_Type.union(x.type, y.type); |
| 14066 if ($notnull_bool(x.code == y.code)) { | 14074 if ($notnull_bool(x.code == y.code)) { |
| 14067 if ($notnull_bool($eq(type, x.type))) { | 14075 if ($notnull_bool($eq(type, x.type))) { |
| 14068 return x; | 14076 return x; |
| 14069 } | 14077 } |
| 14070 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) { | 14078 else if ($notnull_bool(x.get$isConst() || y.get$isConst())) { |
| 14071 world.internalError("unexpected: union of const values "); | 14079 world.internalError("unexpected: union of const values "); |
| 14072 } | 14080 } |
| 14073 else { | 14081 else { |
| 14074 return new Value(type, x.code, x.isSuper && y.isSuper, x.needsTemp || y.ne
edsTemp, x.isType && y.isType); | 14082 return new Value(type, x.code, node.span, x.isSuper && y.isSuper, x.needsT
emp || y.needsTemp, x.isType && y.isType); |
| 14075 } | 14083 } |
| 14076 } | 14084 } |
| 14077 else { | 14085 else { |
| 14078 return new Value(type, null, false, true, false); | 14086 return new Value(type, null, node.span, false, true, false); |
| 14079 } | 14087 } |
| 14080 } | 14088 } |
| 14081 MemberSet.prototype.getVarMember = function(context, node, args) { | 14089 MemberSet.prototype.getVarMember = function(context, node, args) { |
| 14082 if ($notnull_bool(world.objectType.varStubs == null)) { | 14090 if ($notnull_bool(world.objectType.varStubs == null)) { |
| 14083 world.objectType.varStubs = $map([]); | 14091 world.objectType.varStubs = $map([]); |
| 14084 } | 14092 } |
| 14085 var stubName = _getCallStubName(this.name, args); | 14093 var stubName = _getCallStubName(this.name, args); |
| 14086 var stub = world.objectType.varStubs.$index(stubName); | 14094 var stub = world.objectType.varStubs.$index(stubName); |
| 14087 if ($notnull_bool(stub == null)) { | 14095 if ($notnull_bool(stub == null)) { |
| 14088 var mset = context.findMembers(this.name).members; | 14096 var mset = context.findMembers(this.name).members; |
| 14089 var targets = mset.filter((function (m) { | 14097 var targets = mset.filter((function (m) { |
| 14090 return m.canInvoke(context, args); | 14098 return m.canInvoke(context, args); |
| 14091 }) | 14099 }) |
| 14092 ); | 14100 ); |
| 14093 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t
) { | 14101 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t
) { |
| 14094 return t.get$returnType(); | 14102 return t.get$returnType(); |
| 14095 }) | 14103 }) |
| 14096 ), lang_Type.union); | 14104 ), lang_Type.union); |
| 14097 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType)
; | 14105 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType)
; |
| 14098 world.objectType.varStubs.$setindex(stubName, stub); | 14106 world.objectType.varStubs.$setindex(stubName, stub); |
| 14099 } | 14107 } |
| 14100 return stub; | 14108 return stub; |
| 14101 } | 14109 } |
| 14102 MemberSet.prototype.get_$3 = function($0, $1, $2) { | 14110 MemberSet.prototype._get$3 = function($0, $1, $2) { |
| 14103 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); | 14111 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), false); |
| 14112 } |
| 14113 ; |
| 14114 MemberSet.prototype._set$4 = function($0, $1, $2, $3) { |
| 14115 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); |
| 14104 } | 14116 } |
| 14105 ; | 14117 ; |
| 14106 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { | 14118 MemberSet.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 14107 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); | 14119 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments()), false); |
| 14108 } | 14120 } |
| 14109 ; | 14121 ; |
| 14110 MemberSet.prototype.set_$4 = function($0, $1, $2, $3) { | |
| 14111 return this.set_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), (
$2 && $2.is$Value()), ($3 && $3.is$Value()), false); | |
| 14112 } | |
| 14113 ; | |
| 14114 // ********** Code for FactoryMap ************** | 14122 // ********** Code for FactoryMap ************** |
| 14115 function FactoryMap() { | 14123 function FactoryMap() { |
| 14116 this.factories = $map([]); | 14124 this.factories = $map([]); |
| 14117 // Initializers done | 14125 // Initializers done |
| 14118 } | 14126 } |
| 14119 FactoryMap.prototype.getFactoriesFor = function(typeName) { | 14127 FactoryMap.prototype.getFactoriesFor = function(typeName) { |
| 14120 var ret = this.factories.$index(typeName); | 14128 var ret = this.factories.$index(typeName); |
| 14121 if ($notnull_bool(ret == null)) { | 14129 if ($notnull_bool(ret == null)) { |
| 14122 ret = $map([]); | 14130 ret = $map([]); |
| 14123 this.factories.$setindex(typeName, ret); | 14131 this.factories.$setindex(typeName, ret); |
| (...skipping 5120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19244 } | 19252 } |
| 19245 // ********** Code for FixedIterator$E ************** | 19253 // ********** Code for FixedIterator$E ************** |
| 19246 function FixedIterator$E(value, length) { | 19254 function FixedIterator$E(value, length) { |
| 19247 this._index = 0 | 19255 this._index = 0 |
| 19248 this.value = value; | 19256 this.value = value; |
| 19249 this.length = length; | 19257 this.length = length; |
| 19250 // Initializers done | 19258 // Initializers done |
| 19251 } | 19259 } |
| 19252 $inherits(FixedIterator$E, FixedIterator); | 19260 $inherits(FixedIterator$E, FixedIterator); |
| 19253 // ********** Code for Value ************** | 19261 // ********** Code for Value ************** |
| 19254 function Value(type, code, isSuper, needsTemp, isType) { | 19262 function Value(type, code, span, isSuper, needsTemp, isType) { |
| 19255 this.type = type; | 19263 this.type = type; |
| 19256 this.code = code; | 19264 this.code = code; |
| 19265 this.span = span; |
| 19257 this.isSuper = isSuper; | 19266 this.isSuper = isSuper; |
| 19258 this.needsTemp = needsTemp; | 19267 this.needsTemp = needsTemp; |
| 19259 this.isType = isType; | 19268 this.isType = isType; |
| 19260 // Initializers done | 19269 // Initializers done |
| 19261 if ($notnull_bool(this.type == null)) this.type = world.varType; | 19270 if ($notnull_bool(this.type == null)) this.type = world.varType; |
| 19262 } | 19271 } |
| 19263 Value.prototype.is$Value = function(){return this;}; | 19272 Value.prototype.is$Value = function(){return this;}; |
| 19273 Value.prototype.get$span = function() { return this.span; }; |
| 19274 Value.prototype.set$span = function(value) { return this.span = value; }; |
| 19264 Value.prototype.get$isConst = function() { | 19275 Value.prototype.get$isConst = function() { |
| 19265 return false; | 19276 return false; |
| 19266 } | 19277 } |
| 19267 Value.prototype.get_ = function(context, name, node) { | 19278 Value.prototype.get_ = function(context, name, node) { |
| 19268 var member = this._resolveMember(context, name, node, false); | 19279 var member = this._resolveMember(context, name, node, false); |
| 19269 if ($notnull_bool($ne(member, null))) { | 19280 if ($notnull_bool($ne(member, null))) { |
| 19270 member = member.get_$3(context, node, this); | 19281 return member._get$3(context, node, this); |
| 19271 } | |
| 19272 if ($notnull_bool($ne(member, null))) { | |
| 19273 return member; | |
| 19274 } | 19282 } |
| 19275 else { | 19283 else { |
| 19276 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); | 19284 return this.invokeNoSuchMethod(context, ('get:' + name + ''), node); |
| 19277 } | 19285 } |
| 19278 } | 19286 } |
| 19279 Value.prototype.set_ = function(context, name, node, value, isDynamic) { | 19287 Value.prototype.set_ = function(context, name, node, value, isDynamic) { |
| 19280 var member = this._resolveMember(context, name, node, isDynamic); | 19288 var member = this._resolveMember(context, name, node, isDynamic); |
| 19281 if ($notnull_bool($ne(member, null))) { | 19289 if ($notnull_bool($ne(member, null))) { |
| 19282 member = member.set_(context, node, this, value, isDynamic); | 19290 return member._set(context, node, this, value, isDynamic); |
| 19283 } | |
| 19284 if ($notnull_bool($ne(member, null))) { | |
| 19285 return member; | |
| 19286 } | 19291 } |
| 19287 else { | 19292 else { |
| 19288 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu
ments(null, [value])); | 19293 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu
ments(null, [value])); |
| 19289 } | 19294 } |
| 19290 } | 19295 } |
| 19291 Value.prototype.invoke = function(context, name, node, args, isDynamic) { | 19296 Value.prototype.invoke = function(context, name, node, args, isDynamic) { |
| 19292 if ($notnull_bool(this.type.get$isVar() && name == '\$ne')) { | 19297 if ($notnull_bool(this.type.get$isVar() && name == '\$ne')) { |
| 19293 if ($notnull_bool(args.values.length != 1)) { | 19298 if ($notnull_bool(args.values.length != 1)) { |
| 19294 world.warning('wrong number of arguments for !=', node.span); | 19299 world.warning('wrong number of arguments for !=', node.span); |
| 19295 } | 19300 } |
| 19296 world.gen.corejs.useOperator('\$ne'); | 19301 world.gen.corejs.useOperator('\$ne'); |
| 19297 return new Value(null, ('\$ne(' + this.code + ', ' + args.values.$index(0).c
ode + ')'), false, true, false); | 19302 return new Value(null, ('\$ne(' + this.code + ', ' + args.values.$index(0).c
ode + ')'), node.span, false, true, false); |
| 19298 } | 19303 } |
| 19299 if ($notnull_bool(name == '\$call')) { | 19304 if ($notnull_bool(name == '\$call')) { |
| 19300 if ($notnull_bool(this.isType)) { | 19305 if ($notnull_bool(this.isType)) { |
| 19301 world.error('must use "new" or "const" to construct a new instance', node.
span); | 19306 world.error('must use "new" or "const" to construct a new instance', node.
span); |
| 19302 } | 19307 } |
| 19303 if ($notnull_bool(this.type.needsVarCall(args))) { | 19308 if ($notnull_bool(this.type.needsVarCall(args))) { |
| 19304 return this._varCall(context, args); | 19309 return this._varCall(context, args); |
| 19305 } | 19310 } |
| 19306 } | 19311 } |
| 19307 var member = this._resolveMember(context, name, node, isDynamic); | 19312 var member = this._resolveMember(context, name, node, isDynamic); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 19324 } | 19329 } |
| 19325 Value.prototype._hasOverriddenNoSuchMethod = function() { | 19330 Value.prototype._hasOverriddenNoSuchMethod = function() { |
| 19326 if ($notnull_bool(this.isSuper)) { | 19331 if ($notnull_bool(this.isSuper)) { |
| 19327 var m = this.type.getMember('noSuchMethod'); | 19332 var m = this.type.getMember('noSuchMethod'); |
| 19328 return $ne(m, null) && !$notnull_bool(m.declaringType.get$isObject()); | 19333 return $ne(m, null) && !$notnull_bool(m.declaringType.get$isObject()); |
| 19329 } | 19334 } |
| 19330 else { | 19335 else { |
| 19331 return this.type.resolveMember('noSuchMethod').members.length > 1; | 19336 return this.type.resolveMember('noSuchMethod').members.length > 1; |
| 19332 } | 19337 } |
| 19333 } | 19338 } |
| 19339 Value.prototype._tryResolveMember = function(context, name) { |
| 19340 if ($notnull_bool(this.isSuper)) { |
| 19341 return this.type.getMember(name); |
| 19342 } |
| 19343 else { |
| 19344 return this.type.resolveMember(name); |
| 19345 } |
| 19346 } |
| 19334 Value.prototype._resolveMember = function(context, name, node, isDynamic) { | 19347 Value.prototype._resolveMember = function(context, name, node, isDynamic) { |
| 19335 var member; | 19348 var member; |
| 19336 if ($notnull_bool(!$notnull_bool(this.type.get$isVar()) && !(this.type instanc
eof ParameterType))) { | 19349 if ($notnull_bool(!$notnull_bool(this.type.get$isVar()) && !(this.type instanc
eof ParameterType))) { |
| 19337 if ($notnull_bool(this.isSuper)) { | 19350 member = this._tryResolveMember(context, name); |
| 19338 member = this.type.getMember(name); | |
| 19339 } | |
| 19340 else { | |
| 19341 member = this.type.resolveMember(name); | |
| 19342 } | |
| 19343 if ($notnull_bool($ne(member, null) && this.isType && !$notnull_bool(member.
get$isStatic()))) { | 19351 if ($notnull_bool($ne(member, null) && this.isType && !$notnull_bool(member.
get$isStatic()))) { |
| 19344 if ($notnull_bool(!$notnull_bool(isDynamic))) { | 19352 if ($notnull_bool(!$notnull_bool(isDynamic))) { |
| 19345 world.error('can not refer to instance member as static', node.span); | 19353 world.error('can not refer to instance member as static', node.span); |
| 19346 } | 19354 } |
| 19347 return null; | 19355 return null; |
| 19348 } | 19356 } |
| 19349 if ($notnull_bool(member == null && !$notnull_bool(isDynamic) && !$notnull_b
ool(this._hasOverriddenNoSuchMethod()))) { | 19357 if ($notnull_bool(member == null && !$notnull_bool(isDynamic) && !$notnull_b
ool(this._hasOverriddenNoSuchMethod()))) { |
| 19350 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$libra
ry().name : this.type.name; | 19358 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$libra
ry().name : this.type.name; |
| 19351 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); | 19359 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); |
| 19352 if ($notnull_bool(this.isType)) { | 19360 if ($notnull_bool(this.isType)) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 19365 } | 19373 } |
| 19366 return member; | 19374 return member; |
| 19367 } | 19375 } |
| 19368 Value.prototype.checkFirstClass = function(span) { | 19376 Value.prototype.checkFirstClass = function(span) { |
| 19369 if ($notnull_bool(this.isType)) { | 19377 if ($notnull_bool(this.isType)) { |
| 19370 world.error('Types are not first class', span); | 19378 world.error('Types are not first class', span); |
| 19371 } | 19379 } |
| 19372 } | 19380 } |
| 19373 Value.prototype._varCall = function(context, args) { | 19381 Value.prototype._varCall = function(context, args) { |
| 19374 var stub = world.functionType.getCallStub(args); | 19382 var stub = world.functionType.getCallStub(args); |
| 19375 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge
tCode() + ')'), false, true, false); | 19383 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge
tCode() + ')'), this.span, false, true, false); |
| 19376 } | 19384 } |
| 19377 Value.prototype.needsConversion = function(toType) { | 19385 Value.prototype.needsConversion = function(toType) { |
| 19378 var callMethod = toType.getCallMethod(); | 19386 var callMethod = toType.getCallMethod(); |
| 19379 if ($notnull_bool($ne(callMethod, null))) { | 19387 if ($notnull_bool($ne(callMethod, null))) { |
| 19380 var arity = callMethod.get$parameters().length; | 19388 var arity = callMethod.get$parameters().length; |
| 19381 var myCall = this.type.getCallMethod(); | 19389 var myCall = this.type.getCallMethod(); |
| 19382 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity)
) { | 19390 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity)
) { |
| 19383 return true; | 19391 return true; |
| 19384 } | 19392 } |
| 19385 } | 19393 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 19397 var checked = !$notnull_bool(isDynamic); | 19405 var checked = !$notnull_bool(isDynamic); |
| 19398 var callMethod = toType.getCallMethod(); | 19406 var callMethod = toType.getCallMethod(); |
| 19399 if ($notnull_bool($ne(callMethod, null))) { | 19407 if ($notnull_bool($ne(callMethod, null))) { |
| 19400 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type)))
) { | 19408 if ($notnull_bool(checked && !$notnull_bool(toType.isAssignable(this.type)))
) { |
| 19401 this.convertWarning(toType, node); | 19409 this.convertWarning(toType, node); |
| 19402 } | 19410 } |
| 19403 var arity = callMethod.get$parameters().length; | 19411 var arity = callMethod.get$parameters().length; |
| 19404 var myCall = this.type.getCallMethod(); | 19412 var myCall = this.type.getCallMethod(); |
| 19405 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity)
) { | 19413 if ($notnull_bool(myCall == null || myCall.get$parameters().length != arity)
) { |
| 19406 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory
(arity)); | 19414 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory
(arity)); |
| 19407 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'),
false, true, false); | 19415 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'),
node.span, false, true, false); |
| 19408 return $notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i
sDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val; | 19416 return $notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i
sDomCallback(this.type))) ? val._wrapDomCallback(toType, arity) : val; |
| 19409 } | 19417 } |
| 19410 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i
sDomCallback(this.type)))) { | 19418 else if ($notnull_bool(this._isDomCallback(toType) && !$notnull_bool(this._i
sDomCallback(this.type)))) { |
| 19411 return this._wrapDomCallback(toType, arity); | 19419 return this._wrapDomCallback(toType, arity); |
| 19412 } | 19420 } |
| 19413 } | 19421 } |
| 19414 var fromType = this.type; | 19422 var fromType = this.type; |
| 19415 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { | 19423 if ($notnull_bool(this.type.get$isVar() && this.code != 'null')) { |
| 19416 fromType = world.objectType; | 19424 fromType = world.objectType; |
| 19417 } | 19425 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 19435 } | 19443 } |
| 19436 if ($notnull_bool(!$notnull_bool(options.enableTypeChecks))) { | 19444 if ($notnull_bool(!$notnull_bool(options.enableTypeChecks))) { |
| 19437 return this; | 19445 return this; |
| 19438 } | 19446 } |
| 19439 else { | 19447 else { |
| 19440 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) { | 19448 if ($notnull_bool(this.code.startsWith('\$notnull_bool'))) { |
| 19441 return this; | 19449 return this; |
| 19442 } | 19450 } |
| 19443 else { | 19451 else { |
| 19444 world.gen.corejs.useNotNullBool = true; | 19452 world.gen.corejs.useNotNullBool = true; |
| 19445 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), fa
lse, true, false); | 19453 return new Value(world.boolType, ('\$notnull_bool(' + this.code + ')'), th
is.span, false, true, false); |
| 19446 } | 19454 } |
| 19447 } | 19455 } |
| 19448 } | 19456 } |
| 19449 Value.prototype._isDomCallback = function(toType) { | 19457 Value.prototype._isDomCallback = function(toType) { |
| 19450 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT
ype.get$library(), world.get$dom())); | 19458 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT
ype.get$library(), world.get$dom())); |
| 19451 } | 19459 } |
| 19452 Value.prototype._wrapDomCallback = function(toType, arity) { | 19460 Value.prototype._wrapDomCallback = function(toType, arity) { |
| 19453 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), fa
lse, true, false); | 19461 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th
is.span, false, true, false); |
| 19454 } | 19462 } |
| 19455 Value.prototype._typeAssert = function(context, toType, node) { | 19463 Value.prototype._typeAssert = function(context, toType, node) { |
| 19456 if ($notnull_bool((toType instanceof ParameterType))) { | 19464 if ($notnull_bool((toType instanceof ParameterType))) { |
| 19457 var p = (toType && toType.is$ParameterType()); | 19465 var p = (toType && toType.is$ParameterType()); |
| 19458 toType = p.extendsType; | 19466 toType = p.extendsType; |
| 19459 } | 19467 } |
| 19460 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { | 19468 if ($notnull_bool(toType.get$isObject() || toType.get$isVar())) { |
| 19461 world.internalError(('We thought ' + this.type.name + ' is not a subtype of
' + toType.name + '?')); | 19469 world.internalError(('We thought ' + this.type.name + ' is not a subtype of
' + toType.name + '?')); |
| 19462 } | 19470 } |
| 19463 if ($notnull_bool(toType.get$isNum())) toType = world.numType; | 19471 if ($notnull_bool(toType.get$isNum())) toType = world.numType; |
| 19464 var check; | 19472 var check; |
| 19465 if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofName()
!= null)) { | 19473 if ($notnull_bool(toType.get$library().get$isCore() && toType.get$typeofName()
!= null)) { |
| 19466 check = ('\$assert_' + toType.name + '(' + this.code + ')'); | 19474 check = ('\$assert_' + toType.name + '(' + this.code + ')'); |
| 19467 if ($notnull_bool(toType.typeCheckCode == null)) { | 19475 if ($notnull_bool(toType.typeCheckCode == null)) { |
| 19468 toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if (
x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n thro
w new TypeError(\"'\" + x + \"' is not a " + toType.name + ".\");\n}"); | 19476 toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if (
x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n thro
w new TypeError(\"'\" + x + \"' is not a " + toType.name + ".\");\n}"); |
| 19469 } | 19477 } |
| 19470 } | 19478 } |
| 19471 else { | 19479 else { |
| 19472 toType.isTested = true; | 19480 toType.isTested = true; |
| 19473 var temp = context.getTemp(this); | 19481 var temp = context.getTemp(this); |
| 19474 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + '
&&'); | 19482 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + '
&&'); |
| 19475 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); | 19483 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); |
| 19476 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value(
))); | 19484 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value(
))); |
| 19477 } | 19485 } |
| 19478 return new Value(toType, check, false, true, false); | 19486 return new Value(toType, check, this.span, false, true, false); |
| 19479 } | 19487 } |
| 19480 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck)
{ | 19488 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck)
{ |
| 19481 if ($notnull_bool(toType.get$isVar())) { | 19489 if ($notnull_bool(toType.get$isVar())) { |
| 19482 world.error('can not resolve type', span); | 19490 world.error('can not resolve type', span); |
| 19483 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n
ull); | 19491 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n
ull); |
| 19484 } | 19492 } |
| 19485 if ($notnull_bool((toType instanceof ParameterType))) { | 19493 if ($notnull_bool((toType instanceof ParameterType))) { |
| 19486 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n
ull); | 19494 return EvaluatedValue.EvaluatedValue$factory(world.boolType, true, 'true', n
ull); |
| 19487 } | 19495 } |
| 19488 var testCode = null; | 19496 var testCode = null; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 19505 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code +
' &&'); | 19513 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code +
' &&'); |
| 19506 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')'
); | 19514 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')'
); |
| 19507 if ($notnull_bool(isTrue)) { | 19515 if ($notnull_bool(isTrue)) { |
| 19508 testCode = '!!' + testCode; | 19516 testCode = '!!' + testCode; |
| 19509 } | 19517 } |
| 19510 else { | 19518 else { |
| 19511 testCode = '!' + testCode; | 19519 testCode = '!' + testCode; |
| 19512 } | 19520 } |
| 19513 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value(
))); | 19521 if ($notnull_bool($ne(this, temp))) context.freeTemp((temp && temp.is$Value(
))); |
| 19514 } | 19522 } |
| 19515 return new Value(world.boolType, testCode, false, true, false); | 19523 return new Value(world.boolType, testCode, span, false, true, false); |
| 19516 } | 19524 } |
| 19517 Value.prototype.convertWarning = function(toType, node) { | 19525 Value.prototype.convertWarning = function(toType, node) { |
| 19518 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType
.name + '"'), node.span); | 19526 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType
.name + '"'), node.span); |
| 19519 } | 19527 } |
| 19520 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { | 19528 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { |
| 19521 var pos = ''; | 19529 var pos = ''; |
| 19522 if ($notnull_bool(args != null)) { | 19530 if ($notnull_bool(args != null)) { |
| 19523 var argsCode = []; | 19531 var argsCode = []; |
| 19524 for (var i = 0; | 19532 for (var i = 0; |
| 19525 $notnull_bool(i < args.get$length()); i++) { | 19533 $notnull_bool(i < args.get$length()); i++) { |
| 19526 argsCode.add(args.values.$index(i).code); | 19534 argsCode.add(args.values.$index(i).code); |
| 19527 } | 19535 } |
| 19528 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); | 19536 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); |
| 19529 } | 19537 } |
| 19530 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), false, true,
false), new Value(world.listType, ('[' + pos + ']'), false, true, false)]; | 19538 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, f
alse, true, false), new Value(world.listType, ('[' + pos + ']'), node.span, fals
e, true, false)]; |
| 19531 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont
ext, node, this, new Arguments(null, noSuchArgs)); | 19539 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont
ext, node, this, new Arguments(null, noSuchArgs)); |
| 19532 } | 19540 } |
| 19533 Value.prototype.invokeSpecial = function(name, args, returnType) { | 19541 Value.prototype.invokeSpecial = function(name, args, returnType) { |
| 19534 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 443, 12
); | 19542 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 446, 12
); |
| 19535 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4
44, 12); | 19543 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4
47, 12); |
| 19536 var argsString = args.getCode(); | 19544 var argsString = args.getCode(); |
| 19537 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { | 19545 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { |
| 19538 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString
+ ')'), false, true, false); | 19546 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString
+ ')'), this.span, false, true, false); |
| 19539 } | 19547 } |
| 19540 else { | 19548 else { |
| 19541 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString +
''); | 19549 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString +
''); |
| 19542 world.gen.corejs.useOperator(name); | 19550 world.gen.corejs.useOperator(name); |
| 19543 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString
+ ')'), false, true, false); | 19551 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString
+ ')'), this.span, false, true, false); |
| 19544 } | 19552 } |
| 19545 } | 19553 } |
| 19546 Value.prototype.get_$3 = function($0, $1, $2) { | |
| 19547 return this.get_(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $
2.is$lang_Node())); | |
| 19548 } | |
| 19549 ; | |
| 19550 Value.prototype.invoke$4 = function($0, $1, $2, $3) { | 19554 Value.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 19551 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 &&
$2.is$lang_Node()), ($3 && $3.is$Arguments()), false); | 19555 return this.invoke(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 &&
$2.is$lang_Node()), ($3 && $3.is$Arguments()), false); |
| 19552 } | 19556 } |
| 19553 ; | 19557 ; |
| 19554 Value.prototype.set_$4 = function($0, $1, $2, $3) { | |
| 19555 return this.set_(($0 && $0.is$MethodGenerator()), $assert_String($1), ($2 && $
2.is$lang_Node()), ($3 && $3.is$Value()), false); | |
| 19556 } | |
| 19557 ; | |
| 19558 // ********** Code for EvaluatedValue ************** | 19558 // ********** Code for EvaluatedValue ************** |
| 19559 function EvaluatedValue() {} | 19559 function EvaluatedValue() {} |
| 19560 EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, origi
nal, code) { | 19560 EvaluatedValue._internal$ctor = function(type, actualValue, canonicalCode, span,
code) { |
| 19561 this.actualValue = actualValue; | 19561 this.actualValue = actualValue; |
| 19562 this.canonicalCode = canonicalCode; | 19562 this.canonicalCode = canonicalCode; |
| 19563 this.original = original; | 19563 Value.call(this, type, code, span, false, false, false); |
| 19564 Value.call(this, type, code, false, false, false); | |
| 19565 // Initializers done | 19564 // Initializers done |
| 19566 } | 19565 } |
| 19567 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; | 19566 EvaluatedValue._internal$ctor.prototype = EvaluatedValue.prototype; |
| 19568 $inherits(EvaluatedValue, Value); | 19567 $inherits(EvaluatedValue, Value); |
| 19569 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod
e, original) { | 19568 EvaluatedValue.EvaluatedValue$factory = function(type, actualValue, canonicalCod
e, span) { |
| 19570 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, ori
ginal, EvaluatedValue.codeWithComments($assert_String(canonicalCode), (original
&& original.is$SourceSpan()))); | 19569 return new EvaluatedValue._internal$ctor(type, actualValue, canonicalCode, spa
n, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 19571 } | 19570 } |
| 19572 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue;
}; | 19571 EvaluatedValue.prototype.get$actualValue = function() { return this.actualValue;
}; |
| 19573 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV
alue = value; }; | 19572 EvaluatedValue.prototype.set$actualValue = function(value) { return this.actualV
alue = value; }; |
| 19574 EvaluatedValue.prototype.get$isConst = function() { | 19573 EvaluatedValue.prototype.get$isConst = function() { |
| 19575 return true; | 19574 return true; |
| 19576 } | 19575 } |
| 19577 EvaluatedValue.codeWithComments = function(canonicalCode, original) { | 19576 EvaluatedValue.codeWithComments = function(canonicalCode, span) { |
| 19578 return $notnull_bool((original != null && original.get$text() != canonicalCode
)) ? ('' + canonicalCode + '/*' + original.get$text() + '*/') : canonicalCode; | 19577 return $notnull_bool((span != null && span.get$text() != canonicalCode)) ? (''
+ canonicalCode + '/*' + span.get$text() + '*/') : canonicalCode; |
| 19579 } | 19578 } |
| 19580 // ********** Code for ConstListValue ************** | 19579 // ********** Code for ConstListValue ************** |
| 19581 function ConstListValue() {} | 19580 function ConstListValue() {} |
| 19582 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod
e, original, code) { | 19581 ConstListValue._internal$ctor = function(type, values, actualValue, canonicalCod
e, span, code) { |
| 19583 this.values = values; | 19582 this.values = values; |
| 19584 EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, ori
ginal, code); | 19583 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual
Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); |
| 19585 // Initializers done | 19584 // Initializers done |
| 19586 } | 19585 } |
| 19587 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; | 19586 ConstListValue._internal$ctor.prototype = ConstListValue.prototype; |
| 19588 $inherits(ConstListValue, EvaluatedValue); | 19587 $inherits(ConstListValue, EvaluatedValue); |
| 19589 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano
nicalCode, original) { | 19588 ConstListValue.ConstListValue$factory = function(type, values, actualValue, cano
nicalCode, span) { |
| 19590 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC
ode, original, EvaluatedValue.codeWithComments(canonicalCode, original)); | 19589 return new ConstListValue._internal$ctor(type, values, actualValue, canonicalC
ode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 19591 } | 19590 } |
| 19592 // ********** Code for ConstMapValue ************** | 19591 // ********** Code for ConstMapValue ************** |
| 19593 function ConstMapValue() {} | 19592 function ConstMapValue() {} |
| 19594 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode
, original, code) { | 19593 ConstMapValue._internal$ctor = function(type, values, actualValue, canonicalCode
, span, code) { |
| 19595 this.values = values; | 19594 this.values = values; |
| 19596 EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, ori
ginal, code); | 19595 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual
Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); |
| 19597 // Initializers done | 19596 // Initializers done |
| 19598 } | 19597 } |
| 19599 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; | 19598 ConstMapValue._internal$ctor.prototype = ConstMapValue.prototype; |
| 19600 $inherits(ConstMapValue, EvaluatedValue); | 19599 $inherits(ConstMapValue, EvaluatedValue); |
| 19601 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue,
canonicalCode, original) { | 19600 ConstMapValue.ConstMapValue$factory = function(type, keyValuePairs, actualValue,
canonicalCode, span) { |
| 19602 var values = new HashMapImplementation$String$EvaluatedValue(); | 19601 var values = new HashMapImplementation$String$EvaluatedValue(); |
| 19603 for (var i = 0; | 19602 for (var i = 0; |
| 19604 $notnull_bool(i < keyValuePairs.length); i += 2) { | 19603 $notnull_bool(i < keyValuePairs.length); i += 2) { |
| 19605 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i
ndex(i + 1)); | 19604 values.$setindex(keyValuePairs.$index(i).get$actualValue(), keyValuePairs.$i
ndex(i + 1)); |
| 19606 } | 19605 } |
| 19607 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo
de, original, EvaluatedValue.codeWithComments(canonicalCode, original)); | 19606 return new ConstMapValue._internal$ctor(type, values, actualValue, canonicalCo
de, span, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 19608 } | 19607 } |
| 19609 // ********** Code for ConstObjectValue ************** | 19608 // ********** Code for ConstObjectValue ************** |
| 19610 function ConstObjectValue() {} | 19609 function ConstObjectValue() {} |
| 19611 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC
ode, original, code) { | 19610 ConstObjectValue._internal$ctor = function(type, fields, actualValue, canonicalC
ode, span, code) { |
| 19612 this.fields = fields; | 19611 this.fields = fields; |
| 19613 EvaluatedValue._internal$ctor.call(this, type, actualValue, canonicalCode, ori
ginal, code); | 19612 EvaluatedValue._internal$ctor.call(this, (type && type.is$lang_Type()), actual
Value, canonicalCode, (span && span.is$SourceSpan()), $assert_String(code)); |
| 19614 // Initializers done | 19613 // Initializers done |
| 19615 } | 19614 } |
| 19616 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; | 19615 ConstObjectValue._internal$ctor.prototype = ConstObjectValue.prototype; |
| 19617 $inherits(ConstObjectValue, EvaluatedValue); | 19616 $inherits(ConstObjectValue, EvaluatedValue); |
| 19618 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode
, original) { | 19617 ConstObjectValue.ConstObjectValue$factory = function(type, fields, canonicalCode
, span) { |
| 19619 var $0; | 19618 var $0; |
| 19620 var fieldValues = []; | 19619 var fieldValues = []; |
| 19621 var $list = fields.getKeys(); | 19620 var $list = fields.getKeys(); |
| 19622 for (var $i = fields.getKeys().iterator(); $i.hasNext(); ) { | 19621 for (var $i = fields.getKeys().iterator(); $i.hasNext(); ) { |
| 19623 var f = $i.next(); | 19622 var f = $i.next(); |
| 19624 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + '')); | 19623 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + '')); |
| 19625 } | 19624 } |
| 19626 fieldValues.sort((function (a, b) { | 19625 fieldValues.sort((function (a, b) { |
| 19627 return a.compareTo(b); | 19626 return a.compareTo(b); |
| 19628 }) | 19627 }) |
| 19629 ); | 19628 ); |
| 19630 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa
lues, ',') + ']'; | 19629 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa
lues, ',') + ']'; |
| 19631 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica
lCode, original, EvaluatedValue.codeWithComments(canonicalCode, original)); | 19630 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica
lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); |
| 19632 } | 19631 } |
| 19633 // ********** Code for GlobalValue ************** | 19632 // ********** Code for GlobalValue ************** |
| 19634 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, origi
nal, dependencies) { | 19633 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span,
dependencies) { |
| 19635 this.field = field; | 19634 this.field = field; |
| 19636 this.name = name; | 19635 this.name = name; |
| 19637 this.exp = exp; | 19636 this.exp = exp; |
| 19638 this.canonicalCode = canonicalCode; | 19637 this.canonicalCode = canonicalCode; |
| 19639 this.original = original; | |
| 19640 this.dependencies = dependencies; | 19638 this.dependencies = dependencies; |
| 19641 Value.call(this, type, code, false, !$notnull_bool(isConst), false); | 19639 Value.call(this, type, code, span, false, !$notnull_bool(isConst), false); |
| 19642 // Initializers done | 19640 // Initializers done |
| 19643 } | 19641 } |
| 19644 $inherits(GlobalValue, Value); | 19642 $inherits(GlobalValue, Value); |
| 19645 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies)
{ | 19643 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies)
{ |
| 19646 var code = ($notnull_bool(exp.get$isConst()) ? exp.canonicalCode : exp.code); | 19644 var code = ($notnull_bool(exp.get$isConst()) ? exp.canonicalCode : exp.code); |
| 19647 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie
ld.get$name() + '*/'); | 19645 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie
ld.get$name() + '*/'); |
| 19648 return new GlobalValue(exp.type, codeWithComment, field.isFinal, field, null,
exp, code, null, dependencies.filter((function (d) { | 19646 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.isFina
l, field, null, exp, code, exp.span, dependencies.filter((function (d) { |
| 19649 return (d instanceof GlobalValue); | 19647 return (d instanceof GlobalValue); |
| 19650 }) | 19648 }) |
| 19651 )); | 19649 )); |
| 19652 } | 19650 } |
| 19653 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies
) { | 19651 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies
) { |
| 19654 var name = ("const\$" + uniqueId + ""); | 19652 var name = ("const\$" + uniqueId + ""); |
| 19655 var codeWithComment = ("" + name + "/*" + exp.original.get$text() + "*/"); | 19653 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/"); |
| 19656 return new GlobalValue(exp.type, codeWithComment, true, null, name, exp, name,
exp.original, dependencies.filter((function (d) { | 19654 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null,
name, exp, name, exp.span, dependencies.filter((function (d) { |
| 19657 return (d instanceof GlobalValue); | 19655 return (d instanceof GlobalValue); |
| 19658 }) | 19656 }) |
| 19659 )); | 19657 )); |
| 19660 } | 19658 } |
| 19661 GlobalValue.prototype.get$name = function() { return this.name; }; | 19659 GlobalValue.prototype.get$name = function() { return this.name; }; |
| 19662 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; | 19660 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; |
| 19663 GlobalValue.prototype.get$isConst = function() { | 19661 GlobalValue.prototype.get$isConst = function() { |
| 19664 return this.exp.get$isConst() && (this.field == null || this.field.isFinal); | 19662 return this.exp.get$isConst() && (this.field == null || this.field.isFinal); |
| 19665 } | 19663 } |
| 19666 GlobalValue.prototype.get$actualValue = function() { | 19664 GlobalValue.prototype.get$actualValue = function() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 19688 else if ($notnull_bool(this.name != null && other.name == null)) { | 19686 else if ($notnull_bool(this.name != null && other.name == null)) { |
| 19689 return -1; | 19687 return -1; |
| 19690 } | 19688 } |
| 19691 else if ($notnull_bool(this.name != null)) { | 19689 else if ($notnull_bool(this.name != null)) { |
| 19692 return this.name.compareTo(other.name); | 19690 return this.name.compareTo(other.name); |
| 19693 } | 19691 } |
| 19694 else { | 19692 else { |
| 19695 return this.field.name.compareTo(other.field.name); | 19693 return this.field.name.compareTo(other.field.name); |
| 19696 } | 19694 } |
| 19697 } | 19695 } |
| 19696 // ********** Code for BareValue ************** |
| 19697 function BareValue(home, outermost, span) { |
| 19698 this.home = home; |
| 19699 Value.call(this, outermost.method.declaringType, null, span, false, false, out
ermost.get$isStatic()); |
| 19700 // Initializers done |
| 19701 } |
| 19702 $inherits(BareValue, Value); |
| 19703 BareValue.prototype._tryResolveMember = function(context, name) { |
| 19704 $assert($eq(context, this.home), "context == home", "value.dart", 650, 12); |
| 19705 var member = this.type.resolveMember(name); |
| 19706 if ($notnull_bool($ne(member, null))) { |
| 19707 $assert(this.code == null, "code == null", "value.dart", 655, 14); |
| 19708 if ($notnull_bool(this.isType)) { |
| 19709 this.code = this.type.get$jsname(); |
| 19710 } |
| 19711 else { |
| 19712 this.code = this.home._makeThisCode(); |
| 19713 } |
| 19714 return member; |
| 19715 } |
| 19716 member = this.home.get$library().lookup(name, this.span); |
| 19717 if ($notnull_bool($ne(member, null))) { |
| 19718 return member; |
| 19719 } |
| 19720 return null; |
| 19721 } |
| 19698 // ********** Code for CompilerException ************** | 19722 // ********** Code for CompilerException ************** |
| 19699 function CompilerException(_message, _location) { | 19723 function CompilerException(_message, _location) { |
| 19700 this._lang_message = _message; | 19724 this._lang_message = _message; |
| 19701 this._location = _location; | 19725 this._location = _location; |
| 19702 // Initializers done | 19726 // Initializers done |
| 19703 } | 19727 } |
| 19704 CompilerException.prototype.toString = function() { | 19728 CompilerException.prototype.toString = function() { |
| 19705 if ($notnull_bool(this._location != null)) { | 19729 if ($notnull_bool(this._location != null)) { |
| 19706 return ('CompilerException: ' + this._location.toMessageString(this._lang_me
ssage) + ''); | 19730 return ('CompilerException: ' + this._location.toMessageString(this._lang_me
ssage) + ''); |
| 19707 } | 19731 } |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20162 function VarMember(name) { | 20186 function VarMember(name) { |
| 20163 this.name = name; | 20187 this.name = name; |
| 20164 // Initializers done | 20188 // Initializers done |
| 20165 } | 20189 } |
| 20166 VarMember.prototype.is$VarMember = function(){return this;}; | 20190 VarMember.prototype.is$VarMember = function(){return this;}; |
| 20167 VarMember.prototype.get$name = function() { return this.name; }; | 20191 VarMember.prototype.get$name = function() { return this.name; }; |
| 20168 VarMember.prototype.get$returnType = function() { | 20192 VarMember.prototype.get$returnType = function() { |
| 20169 return world.varType; | 20193 return world.varType; |
| 20170 } | 20194 } |
| 20171 VarMember.prototype.invoke = function(context, node, target, args) { | 20195 VarMember.prototype.invoke = function(context, node, target, args) { |
| 20172 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name +
'(' + args.getCode() + ')'), false, true, false); | 20196 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name +
'(' + args.getCode() + ')'), node.span, false, true, false); |
| 20173 } | 20197 } |
| 20174 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) { | 20198 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) { |
| 20175 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments())); | 20199 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()),
($2 && $2.is$Value()), ($3 && $3.is$Arguments())); |
| 20176 } | 20200 } |
| 20177 ; | 20201 ; |
| 20178 // ********** Code for VarFunctionStub ************** | 20202 // ********** Code for VarFunctionStub ************** |
| 20179 function VarFunctionStub(name, callArgs) { | 20203 function VarFunctionStub(name, callArgs) { |
| 20180 this.args = callArgs.toCallStubArgs(); | 20204 this.args = callArgs.toCallStubArgs(); |
| 20181 VarMember.call(this, name); | 20205 VarMember.call(this, name); |
| 20182 // Initializers done | 20206 // Initializers done |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20277 VarMethodSet.prototype.invoke = function(context, node, target, args) { | 20301 VarMethodSet.prototype.invoke = function(context, node, target, args) { |
| 20278 this._invokeMembers(context, node); | 20302 this._invokeMembers(context, node); |
| 20279 return VarMember.prototype.invoke.call(this, context, node, target, args); | 20303 return VarMember.prototype.invoke.call(this, context, node, target, args); |
| 20280 } | 20304 } |
| 20281 VarMethodSet.prototype._invokeMembers = function(context, node) { | 20305 VarMethodSet.prototype._invokeMembers = function(context, node) { |
| 20282 if ($notnull_bool(this._fallbackStubs != null)) return; | 20306 if ($notnull_bool(this._fallbackStubs != null)) return; |
| 20283 this._fallbackStubs = []; | 20307 this._fallbackStubs = []; |
| 20284 var $list = this.members; | 20308 var $list = this.members; |
| 20285 for (var $i = 0;$i < $list.length; $i++) { | 20309 for (var $i = 0;$i < $list.length; $i++) { |
| 20286 var member = $list.$index($i); | 20310 var member = $list.$index($i); |
| 20287 var target = new Value(member.declaringType, 'this', false, true, false); | 20311 var target = new Value(member.declaringType, 'this', node.span, false, true,
false); |
| 20288 var result = member.invoke$4(context, node, target, this.args); | 20312 var result = member.invoke$4(context, node, target, this.args); |
| 20289 var stub = new VarMethodStub(this.name, member, this.args, result); | 20313 var stub = new VarMethodStub(this.name, member, this.args, result); |
| 20290 var type = member.declaringType; | 20314 var type = member.declaringType; |
| 20291 if ($notnull_bool($ne(type.get$library(), world.get$dom()) && !$notnull_bool
(type.get$isObject()))) { | 20315 if ($notnull_bool($ne(type.get$library(), world.get$dom()) && !$notnull_bool
(type.get$isObject()))) { |
| 20292 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V
arMember())); | 20316 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V
arMember())); |
| 20293 } | 20317 } |
| 20294 else { | 20318 else { |
| 20295 this._fallbackStubs.add(stub); | 20319 this._fallbackStubs.add(stub); |
| 20296 } | 20320 } |
| 20297 } | 20321 } |
| 20298 var target = new Value(world.objectType, 'this', false, true, false); | 20322 var target = new Value(world.objectType, 'this', node.span, false, true, false
); |
| 20299 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi
s.args); | 20323 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, thi
s.args); |
| 20300 var stub = new VarMethodStub(this.name, null, this.args, result); | 20324 var stub = new VarMethodStub(this.name, null, this.args, result); |
| 20301 if ($notnull_bool(this._fallbackStubs.length == 0)) { | 20325 if ($notnull_bool(this._fallbackStubs.length == 0)) { |
| 20302 VarMethodSet._addVarStub(world.objectType, (stub && stub.is$VarMember())); | 20326 VarMethodSet._addVarStub(world.objectType, (stub && stub.is$VarMember())); |
| 20303 } | 20327 } |
| 20304 else { | 20328 else { |
| 20305 this._fallbackStubs.add(stub); | 20329 this._fallbackStubs.add(stub); |
| 20306 world.gen.corejs.useVarMethod = true; | 20330 world.gen.corejs.useVarMethod = true; |
| 20307 } | 20331 } |
| 20308 } | 20332 } |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20592 INTERFACE, | 20616 INTERFACE, |
| 20593 LIBRARY, | 20617 LIBRARY, |
| 20594 NATIVE, | 20618 NATIVE, |
| 20595 NEGATE, | 20619 NEGATE, |
| 20596 OPERATOR, | 20620 OPERATOR, |
| 20597 SET, | 20621 SET, |
| 20598 SOURCE, | 20622 SOURCE, |
| 20599 STATIC, | 20623 STATIC, |
| 20600 TYPEDEF ]*/; | 20624 TYPEDEF ]*/; |
| 20601 RunEntry(function () {main();}, []); | 20625 RunEntry(function () {main();}, []); |
| OLD | NEW |