| 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) { return this($0, $1, true, capture); } | 7 * function($0, $1, capture) { return 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 3739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3750 $globals.world.error('const constructor expects const arguments', arg.ge
t$span()); | 3750 $globals.world.error('const constructor expects const arguments', arg.ge
t$span()); |
| 3751 } | 3751 } |
| 3752 } | 3752 } |
| 3753 } | 3753 } |
| 3754 var target = new Value.type$ctor(type, typeRef.get$span()); | 3754 var target = new Value.type$ctor(type, typeRef.get$span()); |
| 3755 return m.invoke$4(this, node, target, this._makeArgs(node.arguments)); | 3755 return m.invoke$4(this, node, target, this._makeArgs(node.arguments)); |
| 3756 } | 3756 } |
| 3757 MethodGenerator.prototype.visitListExpression = function(node) { | 3757 MethodGenerator.prototype.visitListExpression = function(node) { |
| 3758 var argsCode = []; | 3758 var argsCode = []; |
| 3759 var argValues = []; | 3759 var argValues = []; |
| 3760 var type = null; |
| 3761 if (node.type != null) { |
| 3762 type = this.method.resolveType(node.type, true).get$typeArgsInOrder().$index
(0); |
| 3763 if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypePara
ms())) { |
| 3764 $globals.world.error('type parameter cannot be used in const list literals
'); |
| 3765 } |
| 3766 } |
| 3760 var $$list = node.values; | 3767 var $$list = node.values; |
| 3761 for (var $$i = 0;$$i < $$list.length; $$i++) { | 3768 for (var $$i = 0;$$i < $$list.length; $$i++) { |
| 3762 var item = $$list.$index($$i); | 3769 var item = $$list.$index($$i); |
| 3763 var arg = this.visitValue(item); | 3770 var arg = type == null ? this.visitValue(item) : this.visitTypedValue(item,
type); |
| 3764 argValues.add$1(arg); | 3771 argValues.add$1(arg); |
| 3765 if (node.isConst) { | 3772 if (node.isConst) { |
| 3766 if (!arg.get$isConst()) { | 3773 if (!arg.get$isConst()) { |
| 3767 $globals.world.error('const list can only contain const values', item.ge
t$span()); | 3774 $globals.world.error('const list can only contain const values', item.ge
t$span()); |
| 3768 argsCode.add$1(arg.get$code()); | 3775 argsCode.add$1(arg.get$code()); |
| 3769 } | 3776 } |
| 3770 else { | 3777 else { |
| 3771 argsCode.add$1(arg.get$canonicalCode()); | 3778 argsCode.add$1(arg.get$canonicalCode()); |
| 3772 } | 3779 } |
| 3773 } | 3780 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3785 value = $globals.world.gen.globalForConst(ConstListValue.ConstListValue$fact
ory(immutableList, argValues, ('const ' + code), result.get$code(), node.span),
argValues); | 3792 value = $globals.world.gen.globalForConst(ConstListValue.ConstListValue$fact
ory(immutableList, argValues, ('const ' + code), result.get$code(), node.span),
argValues); |
| 3786 } | 3793 } |
| 3787 return value; | 3794 return value; |
| 3788 } | 3795 } |
| 3789 MethodGenerator.prototype.visitMapExpression = function(node) { | 3796 MethodGenerator.prototype.visitMapExpression = function(node) { |
| 3790 if (node.items.length == 0 && !node.isConst) { | 3797 if (node.items.length == 0 && !node.isConst) { |
| 3791 return $globals.world.mapType.getConstructor('').invoke$4(this, node, new Va
lue.type$ctor($globals.world.mapType, node.span), Arguments.get$EMPTY()); | 3798 return $globals.world.mapType.getConstructor('').invoke$4(this, node, new Va
lue.type$ctor($globals.world.mapType, node.span), Arguments.get$EMPTY()); |
| 3792 } | 3799 } |
| 3793 var argValues = []; | 3800 var argValues = []; |
| 3794 var argsCode = []; | 3801 var argsCode = []; |
| 3802 var type = null; |
| 3803 if (node.type != null) { |
| 3804 type = this.method.resolveType(node.type, true).get$typeArgsInOrder().$index
(1); |
| 3805 if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypePara
ms())) { |
| 3806 $globals.world.error('type parameter cannot be used in const map literals'
); |
| 3807 } |
| 3808 } |
| 3795 for (var i = 0; | 3809 for (var i = 0; |
| 3796 i < node.items.length; i += 2) { | 3810 i < node.items.length; i += 2) { |
| 3797 var key = this.visitTypedValue(node.items.$index(i), $globals.world.stringTy
pe); | 3811 var key = this.visitTypedValue(node.items.$index(i), $globals.world.stringTy
pe); |
| 3798 var valueItem = node.items.$index(i + 1); | 3812 var valueItem = node.items.$index(i + 1); |
| 3799 var value = this.visitValue(valueItem); | 3813 var value = type == null ? this.visitValue(valueItem) : this.visitTypedValue
(valueItem, type); |
| 3800 argValues.add$1(key); | 3814 argValues.add$1(key); |
| 3801 argValues.add$1(value); | 3815 argValues.add$1(value); |
| 3802 if (node.isConst) { | 3816 if (node.isConst) { |
| 3803 if (!key.get$isConst() || !value.get$isConst()) { | 3817 if (!key.get$isConst() || !value.get$isConst()) { |
| 3804 $globals.world.error('const map can only contain const values', valueIte
m.get$span()); | 3818 $globals.world.error('const map can only contain const values', valueIte
m.get$span()); |
| 3805 argsCode.add$1(key.get$code()); | 3819 argsCode.add$1(key.get$code()); |
| 3806 argsCode.add$1(value.get$code()); | 3820 argsCode.add$1(value.get$code()); |
| 3807 } | 3821 } |
| 3808 else { | 3822 else { |
| 3809 argsCode.add$1(key.get$canonicalCode()); | 3823 argsCode.add$1(key.get$canonicalCode()); |
| (...skipping 5547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9357 break; | 9371 break; |
| 9358 } | 9372 } |
| 9359 } | 9373 } |
| 9360 return new MapExpression(isConst, type, items, this._makeSpan(start)); | 9374 return new MapExpression(isConst, type, items, this._makeSpan(start)); |
| 9361 } | 9375 } |
| 9362 Parser.prototype.finishTypedLiteral = function(start, isConst) { | 9376 Parser.prototype.finishTypedLiteral = function(start, isConst) { |
| 9363 var span = this._makeSpan(start); | 9377 var span = this._makeSpan(start); |
| 9364 var typeToBeNamedLater = new NameTypeReference(false, null, null, span); | 9378 var typeToBeNamedLater = new NameTypeReference(false, null, null, span); |
| 9365 var genericType = this.addTypeArguments(typeToBeNamedLater, 0); | 9379 var genericType = this.addTypeArguments(typeToBeNamedLater, 0); |
| 9366 if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.INDE
X*/)) { | 9380 if (this._peekKind(4/*TokenKind.LBRACK*/) || this._peekKind(56/*TokenKind.INDE
X*/)) { |
| 9381 genericType.set$baseType(new TypeReference(span, $globals.world.listType)); |
| 9367 return this.finishListLiteral(start, isConst, genericType); | 9382 return this.finishListLiteral(start, isConst, genericType); |
| 9368 } | 9383 } |
| 9369 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { | 9384 else if (this._peekKind(6/*TokenKind.LBRACE*/)) { |
| 9385 genericType.set$baseType(new TypeReference(span, $globals.world.mapType)); |
| 9386 if ($ne(genericType.get$typeArguments().length, 1)) { |
| 9387 this._error('a map literal takes one type argument specfying the value typ
e', $eq(genericType.get$typeArguments().length, 0) ? genericType.get$typeArgumen
ts().get$span() : genericType.get$typeArguments().$index(1).get$span()); |
| 9388 } |
| 9389 genericType.set$typeArguments([new TypeReference(span, $globals.world.string
Type), genericType.get$typeArguments().$index(0)]); |
| 9370 return this.finishMapLiteral(start, isConst, genericType); | 9390 return this.finishMapLiteral(start, isConst, genericType); |
| 9371 } | 9391 } |
| 9372 else { | 9392 else { |
| 9373 this._errorExpected('array or map literal'); | 9393 this._errorExpected('array or map literal'); |
| 9374 } | 9394 } |
| 9375 } | 9395 } |
| 9376 Parser.prototype._readModifiers = function() { | 9396 Parser.prototype._readModifiers = function() { |
| 9377 var modifiers = null; | 9397 var modifiers = null; |
| 9378 while (true) { | 9398 while (true) { |
| 9379 switch (this._peek()) { | 9399 switch (this._peek()) { |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10337 function GenericTypeReference(baseType, typeArguments, depth, span) { | 10357 function GenericTypeReference(baseType, typeArguments, depth, span) { |
| 10338 this.baseType = baseType; | 10358 this.baseType = baseType; |
| 10339 this.typeArguments = typeArguments; | 10359 this.typeArguments = typeArguments; |
| 10340 this.depth = depth; | 10360 this.depth = depth; |
| 10341 // Initializers done | 10361 // Initializers done |
| 10342 TypeReference.call(this, span); | 10362 TypeReference.call(this, span); |
| 10343 } | 10363 } |
| 10344 $inherits(GenericTypeReference, TypeReference); | 10364 $inherits(GenericTypeReference, TypeReference); |
| 10345 GenericTypeReference.prototype.get$baseType = function() { return this.baseType;
}; | 10365 GenericTypeReference.prototype.get$baseType = function() { return this.baseType;
}; |
| 10346 GenericTypeReference.prototype.set$baseType = function(value) { return this.base
Type = value; }; | 10366 GenericTypeReference.prototype.set$baseType = function(value) { return this.base
Type = value; }; |
| 10367 GenericTypeReference.prototype.get$typeArguments = function() { return this.type
Arguments; }; |
| 10368 GenericTypeReference.prototype.set$typeArguments = function(value) { return this
.typeArguments = value; }; |
| 10347 GenericTypeReference.prototype.get$depth = function() { return this.depth; }; | 10369 GenericTypeReference.prototype.get$depth = function() { return this.depth; }; |
| 10348 GenericTypeReference.prototype.set$depth = function(value) { return this.depth =
value; }; | 10370 GenericTypeReference.prototype.set$depth = function(value) { return this.depth =
value; }; |
| 10349 GenericTypeReference.prototype.visit = function(visitor) { | 10371 GenericTypeReference.prototype.visit = function(visitor) { |
| 10350 return visitor.visitGenericTypeReference(this); | 10372 return visitor.visitGenericTypeReference(this); |
| 10351 } | 10373 } |
| 10352 GenericTypeReference.prototype.visit$1 = GenericTypeReference.prototype.visit; | 10374 GenericTypeReference.prototype.visit$1 = GenericTypeReference.prototype.visit; |
| 10353 // ********** Code for FunctionTypeReference ************** | 10375 // ********** Code for FunctionTypeReference ************** |
| 10354 function FunctionTypeReference(isFinal, func, span) { | 10376 function FunctionTypeReference(isFinal, func, span) { |
| 10355 this.isFinal = isFinal; | 10377 this.isFinal = isFinal; |
| 10356 this.func = func; | 10378 this.func = func; |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10999 this.typeArguments = typeArguments; | 11021 this.typeArguments = typeArguments; |
| 11000 this.typeArgsInOrder = typeArgsInOrder; | 11022 this.typeArgsInOrder = typeArgsInOrder; |
| 11001 this.constructors = new HashMapImplementation(); | 11023 this.constructors = new HashMapImplementation(); |
| 11002 this.members = new HashMapImplementation(); | 11024 this.members = new HashMapImplementation(); |
| 11003 this.factories = new FactoryMap(); | 11025 this.factories = new FactoryMap(); |
| 11004 // Initializers done | 11026 // Initializers done |
| 11005 Type.call(this, name); | 11027 Type.call(this, name); |
| 11006 } | 11028 } |
| 11007 $inherits(ConcreteType, Type); | 11029 $inherits(ConcreteType, Type); |
| 11008 ConcreteType.prototype.get$genericType = function() { return this.genericType; }
; | 11030 ConcreteType.prototype.get$genericType = function() { return this.genericType; }
; |
| 11031 ConcreteType.prototype.get$typeArguments = function() { return this.typeArgument
s; }; |
| 11032 ConcreteType.prototype.set$typeArguments = function(value) { return this.typeArg
uments = value; }; |
| 11009 ConcreteType.prototype.get$_parent = function() { return this._parent; }; | 11033 ConcreteType.prototype.get$_parent = function() { return this._parent; }; |
| 11010 ConcreteType.prototype.set$_parent = function(value) { return this._parent = val
ue; }; | 11034 ConcreteType.prototype.set$_parent = function(value) { return this._parent = val
ue; }; |
| 11011 ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsIn
Order; }; | 11035 ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsIn
Order; }; |
| 11012 ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeA
rgsInOrder = value; }; | 11036 ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeA
rgsInOrder = value; }; |
| 11013 ConcreteType.prototype.get$isList = function() { | 11037 ConcreteType.prototype.get$isList = function() { |
| 11014 return this.genericType.get$isList(); | 11038 return this.genericType.get$isList(); |
| 11015 } | 11039 } |
| 11016 ConcreteType.prototype.get$isClass = function() { | 11040 ConcreteType.prototype.get$isClass = function() { |
| 11017 return this.genericType.isClass; | 11041 return this.genericType.isClass; |
| 11018 } | 11042 } |
| (...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13111 $globals._MAGENTA_COLOR = '\u001b[35m'; | 13135 $globals._MAGENTA_COLOR = '\u001b[35m'; |
| 13112 $globals._NO_COLOR = '\u001b[0m'; | 13136 $globals._NO_COLOR = '\u001b[0m'; |
| 13113 $globals._RED_COLOR = '\u001b[31m'; | 13137 $globals._RED_COLOR = '\u001b[31m'; |
| 13114 } | 13138 } |
| 13115 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 13139 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
| 13116 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; | 13140 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; |
| 13117 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; | 13141 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; |
| 13118 var $globals = {}; | 13142 var $globals = {}; |
| 13119 $static_init(); | 13143 $static_init(); |
| 13120 main(); | 13144 main(); |
| OLD | NEW |