| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return this.noSuchMethod("writeDefinition", [$0, $1]); | 390 return this.noSuchMethod("writeDefinition", [$0, $1]); |
| 391 }; | 391 }; |
| 392 // ********** Code for Clock ************** | 392 // ********** Code for Clock ************** |
| 393 function Clock() {} | 393 function Clock() {} |
| 394 Clock.now = function() { | 394 Clock.now = function() { |
| 395 return new Date().getTime(); | 395 return new Date().getTime(); |
| 396 } | 396 } |
| 397 Clock.frequency = function() { | 397 Clock.frequency = function() { |
| 398 return 1000; | 398 return 1000; |
| 399 } | 399 } |
| 400 // ********** Code for IllegalAccessException ************** |
| 401 function IllegalAccessException() { |
| 402 // Initializers done |
| 403 } |
| 404 IllegalAccessException.prototype.toString = function() { |
| 405 return "Attempt to modify an immutable object"; |
| 406 } |
| 407 IllegalAccessException.prototype.toString$0 = IllegalAccessException.prototype.t
oString; |
| 400 // ********** Code for NoSuchMethodException ************** | 408 // ********** Code for NoSuchMethodException ************** |
| 401 function NoSuchMethodException(_receiver, _functionName, _arguments) { | 409 function NoSuchMethodException(_receiver, _functionName, _arguments) { |
| 402 this._receiver = _receiver; | 410 this._receiver = _receiver; |
| 403 this._functionName = _functionName; | 411 this._functionName = _functionName; |
| 404 this._arguments = _arguments; | 412 this._arguments = _arguments; |
| 405 // Initializers done | 413 // Initializers done |
| 406 } | 414 } |
| 407 NoSuchMethodException.prototype.toString = function() { | 415 NoSuchMethodException.prototype.toString = function() { |
| 408 var sb = new StringBufferImpl(""); | 416 var sb = new StringBufferImpl(""); |
| 409 for (var i = 0; | 417 for (var i = 0; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 return this._array.get$length() > this._dart_coreimpl_pos; | 677 return this._array.get$length() > this._dart_coreimpl_pos; |
| 670 } | 678 } |
| 671 ListIterator.prototype.next = function() { | 679 ListIterator.prototype.next = function() { |
| 672 if (!this.hasNext()) { | 680 if (!this.hasNext()) { |
| 673 $throw(const$8/*const NoMoreElementsException()*/); | 681 $throw(const$8/*const NoMoreElementsException()*/); |
| 674 } | 682 } |
| 675 return this._array.$index(this._dart_coreimpl_pos++); | 683 return this._array.$index(this._dart_coreimpl_pos++); |
| 676 } | 684 } |
| 677 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; | 685 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; |
| 678 ListIterator.prototype.next$0 = ListIterator.prototype.next; | 686 ListIterator.prototype.next$0 = ListIterator.prototype.next; |
| 687 // ********** Code for ImmutableList ************** |
| 688 /** Implements extends for Dart classes on JavaScript prototypes. */ |
| 689 function $inherits(child, parent) { |
| 690 if (child.prototype.__proto__) { |
| 691 child.prototype.__proto__ = parent.prototype; |
| 692 } else { |
| 693 function tmp() {}; |
| 694 tmp.prototype = parent.prototype; |
| 695 child.prototype = new tmp(); |
| 696 child.prototype.constructor = child; |
| 697 } |
| 698 } |
| 699 $inherits(ImmutableList, ListFactory_E); |
| 700 function ImmutableList(length) { |
| 701 this._length = length; |
| 702 // Initializers done |
| 703 ListFactory_E.call(this, length); |
| 704 } |
| 705 ImmutableList.ImmutableList$from$factory = function(other) { |
| 706 var list = new ImmutableList(other.get$length()); |
| 707 for (var i = 0; |
| 708 i < other.get$length(); i++) { |
| 709 list._setindex(i, other.$index(i)); |
| 710 } |
| 711 return list; |
| 712 } |
| 713 ImmutableList.prototype.get$length = function() { |
| 714 return this._length; |
| 715 } |
| 716 ImmutableList.prototype.set$length = function(length) { |
| 717 $throw(const$127/*const IllegalAccessException()*/); |
| 718 } |
| 719 Object.defineProperty(ImmutableList.prototype, "length", { |
| 720 get: ImmutableList.prototype.get$length, |
| 721 set: ImmutableList.prototype.set$length |
| 722 }); |
| 723 ImmutableList.prototype._setindex = function(index, value) { |
| 724 return this[index] = value; |
| 725 } |
| 726 ImmutableList.prototype.$setindex = function(index, value) { |
| 727 $throw(const$127/*const IllegalAccessException()*/); |
| 728 } |
| 729 ImmutableList.prototype.sort = function(compare) { |
| 730 $throw(const$127/*const IllegalAccessException()*/); |
| 731 } |
| 732 ImmutableList.prototype.add = function(element) { |
| 733 $throw(const$127/*const IllegalAccessException()*/); |
| 734 } |
| 735 ImmutableList.prototype.addLast = function(element) { |
| 736 $throw(const$127/*const IllegalAccessException()*/); |
| 737 } |
| 738 ImmutableList.prototype.addAll = function(elements) { |
| 739 $throw(const$127/*const IllegalAccessException()*/); |
| 740 } |
| 741 ImmutableList.prototype.clear = function() { |
| 742 $throw(const$127/*const IllegalAccessException()*/); |
| 743 } |
| 744 ImmutableList.prototype.removeLast = function() { |
| 745 $throw(const$127/*const IllegalAccessException()*/); |
| 746 } |
| 747 ImmutableList.prototype.toString = function() { |
| 748 return ListFactory.ListFactory$from$factory(this).toString(); |
| 749 } |
| 750 ImmutableList.prototype.add$1 = ImmutableList.prototype.add; |
| 751 ImmutableList.prototype.addAll$1 = ImmutableList.prototype.addAll; |
| 752 ImmutableList.prototype.removeLast$0 = ImmutableList.prototype.removeLast; |
| 753 ImmutableList.prototype.sort$1 = function($0) { |
| 754 return this.sort(to$call$2($0)); |
| 755 }; |
| 756 ImmutableList.prototype.toString$0 = ImmutableList.prototype.toString; |
| 679 // ********** Code for NumImplementation ************** | 757 // ********** Code for NumImplementation ************** |
| 680 NumImplementation = Number; | 758 NumImplementation = Number; |
| 681 NumImplementation.prototype.isNaN = function() { | 759 NumImplementation.prototype.isNaN = function() { |
| 682 return isNaN(this); | 760 return isNaN(this); |
| 683 } | 761 } |
| 684 NumImplementation.prototype.isNegative = function() { | 762 NumImplementation.prototype.isNegative = function() { |
| 685 return this == 0 ? (1 / this) < 0 : this < 0; | 763 return this == 0 ? (1 / this) < 0 : this < 0; |
| 686 } | 764 } |
| 687 NumImplementation.prototype.hashCode = function() { | 765 NumImplementation.prototype.hashCode = function() { |
| 688 return this & 0xFFFFFFF; | 766 return this & 0xFFFFFFF; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 return (this._probeForLookup(key) != -1); | 964 return (this._probeForLookup(key) != -1); |
| 887 } | 965 } |
| 888 HashMapImplementation.prototype.containsKey$1 = HashMapImplementation.prototype.
containsKey; | 966 HashMapImplementation.prototype.containsKey$1 = HashMapImplementation.prototype.
containsKey; |
| 889 HashMapImplementation.prototype.forEach$1 = function($0) { | 967 HashMapImplementation.prototype.forEach$1 = function($0) { |
| 890 return this.forEach(to$call$2($0)); | 968 return this.forEach(to$call$2($0)); |
| 891 }; | 969 }; |
| 892 HashMapImplementation.prototype.getKeys$0 = HashMapImplementation.prototype.getK
eys; | 970 HashMapImplementation.prototype.getKeys$0 = HashMapImplementation.prototype.getK
eys; |
| 893 HashMapImplementation.prototype.getValues$0 = HashMapImplementation.prototype.ge
tValues; | 971 HashMapImplementation.prototype.getValues$0 = HashMapImplementation.prototype.ge
tValues; |
| 894 HashMapImplementation.prototype.isEmpty$0 = HashMapImplementation.prototype.isEm
pty; | 972 HashMapImplementation.prototype.isEmpty$0 = HashMapImplementation.prototype.isEm
pty; |
| 895 // ********** Code for HashMapImplementation_E$E ************** | 973 // ********** Code for HashMapImplementation_E$E ************** |
| 896 /** Implements extends for Dart classes on JavaScript prototypes. */ | |
| 897 function $inherits(child, parent) { | |
| 898 if (child.prototype.__proto__) { | |
| 899 child.prototype.__proto__ = parent.prototype; | |
| 900 } else { | |
| 901 function tmp() {}; | |
| 902 tmp.prototype = parent.prototype; | |
| 903 child.prototype = new tmp(); | |
| 904 child.prototype.constructor = child; | |
| 905 } | |
| 906 } | |
| 907 $inherits(HashMapImplementation_E$E, HashMapImplementation); | 974 $inherits(HashMapImplementation_E$E, HashMapImplementation); |
| 908 function HashMapImplementation_E$E() { | 975 function HashMapImplementation_E$E() { |
| 909 // Initializers done | 976 // Initializers done |
| 910 this._numberOfEntries = 0; | 977 this._numberOfEntries = 0; |
| 911 this._numberOfDeleted = 0; | 978 this._numberOfDeleted = 0; |
| 912 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); | 979 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa
tion._INITIAL_CAPACITY*/); |
| 913 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 980 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 914 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); | 981 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); |
| 915 } | 982 } |
| 916 HashMapImplementation_E$E._computeLoadLimit = function(capacity) { | 983 HashMapImplementation_E$E._computeLoadLimit = function(capacity) { |
| (...skipping 3989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4906 $globals.world.error('duplicate final modifier', mod.get$span()); | 4973 $globals.world.error('duplicate final modifier', mod.get$span()); |
| 4907 } | 4974 } |
| 4908 this.isFinal = true; | 4975 this.isFinal = true; |
| 4909 } | 4976 } |
| 4910 else { | 4977 else { |
| 4911 $globals.world.error(('' + mod + ' modifier not allowed on field'), mod.
get$span()); | 4978 $globals.world.error(('' + mod + ' modifier not allowed on field'), mod.
get$span()); |
| 4912 } | 4979 } |
| 4913 } | 4980 } |
| 4914 } | 4981 } |
| 4915 this.type = this.resolveType(this.definition.type, false); | 4982 this.type = this.resolveType(this.definition.type, false); |
| 4916 if (this.isStatic && this.type.get$hasTypeParams()) { | 4983 if (this.isStatic && !this.get$isFactory() && this.type.get$hasTypeParams()) { |
| 4917 $globals.world.error('using type parameter in static context', this.definiti
on.type.span); | 4984 $globals.world.error('using type parameter in static context', this.definiti
on.type.span); |
| 4918 } | 4985 } |
| 4919 if (this.isStatic && this.isFinal && this.value == null) { | 4986 if (this.isStatic && this.isFinal && this.value == null) { |
| 4920 $globals.world.error('static final field is missing initializer', this.get$s
pan()); | 4987 $globals.world.error('static final field is missing initializer', this.get$s
pan()); |
| 4921 } | 4988 } |
| 4922 this.get$library()._addMember(this); | 4989 this.get$library()._addMember(this); |
| 4923 } | 4990 } |
| 4924 FieldMember.prototype.computeValue = function() { | 4991 FieldMember.prototype.computeValue = function() { |
| 4925 if (this.value == null) return null; | 4992 if (this.value == null) return null; |
| 4926 if (this._computedValue == null) { | 4993 if (this._computedValue == null) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4945 this._computedValue = $globals.world.gen.globalForStaticField(this, this._
computedValue, [this._computedValue]); | 5012 this._computedValue = $globals.world.gen.globalForStaticField(this, this._
computedValue, [this._computedValue]); |
| 4946 } | 5013 } |
| 4947 this._computing = false; | 5014 this._computing = false; |
| 4948 } | 5015 } |
| 4949 return this._computedValue; | 5016 return this._computedValue; |
| 4950 } | 5017 } |
| 4951 FieldMember.prototype._get = function(context, node, target, isDynamic) { | 5018 FieldMember.prototype._get = function(context, node, target, isDynamic) { |
| 4952 if (this.isNative && this.get$returnType() != null) { | 5019 if (this.isNative && this.get$returnType() != null) { |
| 4953 this.get$returnType().markUsed(); | 5020 this.get$returnType().markUsed(); |
| 4954 if ((this.get$returnType() instanceof DefinedType)) { | 5021 if ((this.get$returnType() instanceof DefinedType)) { |
| 4955 var factory_ = this.get$returnType().get$genericType().factory_; | 5022 var defaultType = this.get$returnType().get$genericType().defaultType; |
| 4956 if (factory_ != null && factory_.get$isNative()) { | 5023 if (defaultType != null && defaultType.get$isNative()) { |
| 4957 factory_.markUsed$0(); | 5024 defaultType.markUsed$0(); |
| 4958 } | 5025 } |
| 4959 } | 5026 } |
| 4960 } | 5027 } |
| 4961 if (this.isStatic) { | 5028 if (this.isStatic) { |
| 4962 this.declaringType.markUsed(); | 5029 this.declaringType.markUsed(); |
| 4963 var cv = this.computeValue(); | 5030 var cv = this.computeValue(); |
| 4964 if (this.isFinal) { | 5031 if (this.isFinal) { |
| 4965 return cv; | 5032 return cv; |
| 4966 } | 5033 } |
| 4967 $globals.world.gen.hasStatics = true; | 5034 $globals.world.gen.hasStatics = true; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5281 this.definition = definition; | 5348 this.definition = definition; |
| 5282 // Initializers done | 5349 // Initializers done |
| 5283 Member.call(this, name, declaringType); | 5350 Member.call(this, name, declaringType); |
| 5284 } | 5351 } |
| 5285 MethodMember.prototype.get$definition = function() { return this.definition; }; | 5352 MethodMember.prototype.get$definition = function() { return this.definition; }; |
| 5286 MethodMember.prototype.set$definition = function(value) { return this.definition
= value; }; | 5353 MethodMember.prototype.set$definition = function(value) { return this.definition
= value; }; |
| 5287 MethodMember.prototype.get$returnType = function() { return this.returnType; }; | 5354 MethodMember.prototype.get$returnType = function() { return this.returnType; }; |
| 5288 MethodMember.prototype.set$returnType = function(value) { return this.returnType
= value; }; | 5355 MethodMember.prototype.set$returnType = function(value) { return this.returnType
= value; }; |
| 5289 MethodMember.prototype.get$parameters = function() { return this.parameters; }; | 5356 MethodMember.prototype.get$parameters = function() { return this.parameters; }; |
| 5290 MethodMember.prototype.set$parameters = function(value) { return this.parameters
= value; }; | 5357 MethodMember.prototype.set$parameters = function(value) { return this.parameters
= value; }; |
| 5291 MethodMember.prototype.get$typeParameters = function() { return this.typeParamet
ers; }; | |
| 5292 MethodMember.prototype.set$typeParameters = function(value) { return this.typePa
rameters = value; }; | |
| 5293 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; | 5358 MethodMember.prototype.get$isStatic = function() { return this.isStatic; }; |
| 5294 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v
alue; }; | 5359 MethodMember.prototype.set$isStatic = function(value) { return this.isStatic = v
alue; }; |
| 5295 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; | 5360 MethodMember.prototype.get$isAbstract = function() { return this.isAbstract; }; |
| 5296 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract
= value; }; | 5361 MethodMember.prototype.set$isAbstract = function(value) { return this.isAbstract
= value; }; |
| 5297 MethodMember.prototype.get$isConst = function() { return this.isConst; }; | 5362 MethodMember.prototype.get$isConst = function() { return this.isConst; }; |
| 5298 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val
ue; }; | 5363 MethodMember.prototype.set$isConst = function(value) { return this.isConst = val
ue; }; |
| 5299 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; | 5364 MethodMember.prototype.get$isFactory = function() { return this.isFactory; }; |
| 5300 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory =
value; }; | 5365 MethodMember.prototype.set$isFactory = function(value) { return this.isFactory =
value; }; |
| 5301 MethodMember.prototype.get$isLambda = function() { return this.isLambda; }; | 5366 MethodMember.prototype.get$isLambda = function() { return this.isLambda; }; |
| 5302 MethodMember.prototype.set$isLambda = function(value) { return this.isLambda = v
alue; }; | 5367 MethodMember.prototype.set$isLambda = function(value) { return this.isLambda = v
alue; }; |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5937 this.isAbstract = true; | 6002 this.isAbstract = true; |
| 5938 } | 6003 } |
| 5939 else { | 6004 else { |
| 5940 $globals.world.error(('' + mod + ' modifier not allowed on method'), mod
.get$span()); | 6005 $globals.world.error(('' + mod + ' modifier not allowed on method'), mod
.get$span()); |
| 5941 } | 6006 } |
| 5942 } | 6007 } |
| 5943 } | 6008 } |
| 5944 if (this.isFactory) { | 6009 if (this.isFactory) { |
| 5945 this.isStatic = true; | 6010 this.isStatic = true; |
| 5946 } | 6011 } |
| 5947 if (this.definition.typeParameters != null) { | |
| 5948 if (!this.isFactory) { | |
| 5949 $globals.world.error('Only factories are allowed to have explicit type par
ameters', this.definition.typeParameters.$index(0).get$span()); | |
| 5950 } | |
| 5951 else { | |
| 5952 this.typeParameters = this.definition.typeParameters; | |
| 5953 var $$list = this.definition.typeParameters; | |
| 5954 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { | |
| 5955 var tp = $$list.$index($$i); | |
| 5956 tp.set$enclosingElement(this); | |
| 5957 tp.resolve$0(); | |
| 5958 } | |
| 5959 } | |
| 5960 } | |
| 5961 if (this.get$isOperator() && this.isStatic && !this.get$isCallMethod()) { | 6012 if (this.get$isOperator() && this.isStatic && !this.get$isCallMethod()) { |
| 5962 $globals.world.error(('operator method may not be static "' + this.name + '"
'), this.get$span()); | 6013 $globals.world.error(('operator method may not be static "' + this.name + '"
'), this.get$span()); |
| 5963 } | 6014 } |
| 5964 if (this.isAbstract) { | 6015 if (this.isAbstract) { |
| 5965 if (this.definition.body != null && !(this.declaringType.get$definition() in
stanceof FunctionTypeDefinition)) { | 6016 if (this.definition.body != null && !(this.declaringType.get$definition() in
stanceof FunctionTypeDefinition)) { |
| 5966 $globals.world.error('abstract method can not have a body', this.get$span(
)); | 6017 $globals.world.error('abstract method can not have a body', this.get$span(
)); |
| 5967 } | 6018 } |
| 5968 if (this.isStatic && !(this.declaringType.get$definition() instanceof Functi
onTypeDefinition)) { | 6019 if (this.isStatic && !(this.declaringType.get$definition() instanceof Functi
onTypeDefinition)) { |
| 5969 $globals.world.error('static method can not be abstract', this.get$span())
; | 6020 $globals.world.error('static method can not be abstract', this.get$span())
; |
| 5970 } | 6021 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 5987 var param = new Parameter(formal, this); | 6038 var param = new Parameter(formal, this); |
| 5988 param.resolve$0(); | 6039 param.resolve$0(); |
| 5989 this.parameters.add(param); | 6040 this.parameters.add(param); |
| 5990 } | 6041 } |
| 5991 if (!this.isLambda) { | 6042 if (!this.isLambda) { |
| 5992 this.get$library()._addMember(this); | 6043 this.get$library()._addMember(this); |
| 5993 } | 6044 } |
| 5994 } | 6045 } |
| 5995 MethodMember.prototype.resolveType = function(node, typeErrors) { | 6046 MethodMember.prototype.resolveType = function(node, typeErrors) { |
| 5996 var t = Element.prototype.resolveType.call(this, node, typeErrors); | 6047 var t = Element.prototype.resolveType.call(this, node, typeErrors); |
| 5997 if (this.isStatic && (t instanceof ParameterType) && (this.typeParameters == n
ull || !this.typeParameters.some((function (p) { | 6048 if (this.isStatic && !this.isFactory && (t instanceof ParameterType)) { |
| 5998 return p === t; | |
| 5999 }) | |
| 6000 ))) { | |
| 6001 $globals.world.error('using type parameter in static context.', node.span); | 6049 $globals.world.error('using type parameter in static context.', node.span); |
| 6002 } | 6050 } |
| 6003 return t; | 6051 return t; |
| 6004 } | 6052 } |
| 6005 MethodMember.prototype._get$3 = function($0, $1, $2) { | 6053 MethodMember.prototype._get$3 = function($0, $1, $2) { |
| 6006 return this._get($0, $1, $2, false); | 6054 return this._get($0, $1, $2, false); |
| 6007 }; | 6055 }; |
| 6008 MethodMember.prototype._get$3$isDynamic = MethodMember.prototype._get; | 6056 MethodMember.prototype._get$3$isDynamic = MethodMember.prototype._get; |
| 6009 MethodMember.prototype._get$4 = MethodMember.prototype._get; | 6057 MethodMember.prototype._get$4 = MethodMember.prototype._get; |
| 6010 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { | 6058 MethodMember.prototype._set$4 = function($0, $1, $2, $3) { |
| (...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8379 } | 8427 } |
| 8380 var _implements = null; | 8428 var _implements = null; |
| 8381 if (this._maybeEat(77/*TokenKind.IMPLEMENTS*/)) { | 8429 if (this._maybeEat(77/*TokenKind.IMPLEMENTS*/)) { |
| 8382 _implements = this.typeList(); | 8430 _implements = this.typeList(); |
| 8383 } | 8431 } |
| 8384 var _native = null; | 8432 var _native = null; |
| 8385 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { | 8433 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { |
| 8386 _native = this.maybeStringLiteral(); | 8434 _native = this.maybeStringLiteral(); |
| 8387 if (_native != null) _native = new NativeType(_native); | 8435 if (_native != null) _native = new NativeType(_native); |
| 8388 } | 8436 } |
| 8389 var _factory = null; | 8437 var oldFactory = this._maybeEat(75/*TokenKind.FACTORY*/); |
| 8390 if (this._maybeEat(75/*TokenKind.FACTORY*/)) { | 8438 var defaultType = null; |
| 8391 _factory = this.nameTypeReference(); | 8439 if (oldFactory || this._maybeEat(94/*TokenKind.DEFAULT*/)) { |
| 8440 if (oldFactory) { |
| 8441 $globals.world.warning('factory no longer supported, use "default" instead
', this._previousToken.get$span()); |
| 8442 } |
| 8443 var baseType = this.nameTypeReference(); |
| 8444 var typeParams0 = null; |
| 8392 if (this._peekKind(52/*TokenKind.LT*/)) { | 8445 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 8393 this.typeParameters(); | 8446 typeParams0 = this.typeParameters(); |
| 8394 } | 8447 } |
| 8448 defaultType = new DefaultTypeReference(oldFactory, baseType, typeParams0, th
is._makeSpan(baseType.get$span().get$start())); |
| 8395 } | 8449 } |
| 8396 var body = []; | 8450 var body = []; |
| 8397 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { | 8451 if (this._maybeEat(6/*TokenKind.LBRACE*/)) { |
| 8398 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { | 8452 while (!this._maybeEat(7/*TokenKind.RBRACE*/)) { |
| 8399 body.add$1(this.declaration(true)); | 8453 body.add$1(this.declaration(true)); |
| 8400 if (this._recover) { | 8454 if (this._recover) { |
| 8401 if (!this._recoverTo(7/*TokenKind.RBRACE*/, 10/*TokenKind.SEMICOLON*/))
break; | 8455 if (!this._recoverTo(7/*TokenKind.RBRACE*/, 10/*TokenKind.SEMICOLON*/))
break; |
| 8402 this._maybeEat(10/*TokenKind.SEMICOLON*/); | 8456 this._maybeEat(10/*TokenKind.SEMICOLON*/); |
| 8403 } | 8457 } |
| 8404 } | 8458 } |
| 8405 } | 8459 } |
| 8406 else { | 8460 else { |
| 8407 this._errorExpected('block starting with "{" or ";"'); | 8461 this._errorExpected('block starting with "{" or ";"'); |
| 8408 } | 8462 } |
| 8409 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, _factory, body, this._makeSpan(start)); | 8463 return new TypeDefinition(kind == 73/*TokenKind.CLASS*/, name, typeParams, _ex
tends, _implements, _native, defaultType, body, this._makeSpan(start)); |
| 8410 } | 8464 } |
| 8411 Parser.prototype.functionTypeAlias = function() { | 8465 Parser.prototype.functionTypeAlias = function() { |
| 8412 var start = this._peekToken.start; | 8466 var start = this._peekToken.start; |
| 8413 this._eat(87/*TokenKind.TYPEDEF*/); | 8467 this._eat(87/*TokenKind.TYPEDEF*/); |
| 8414 var di = this.declaredIdentifier(false); | 8468 var di = this.declaredIdentifier(false); |
| 8415 var typeParams = null; | 8469 var typeParams = null; |
| 8416 if (this._peekKind(52/*TokenKind.LT*/)) { | 8470 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 8417 typeParams = this.typeParameters(); | 8471 typeParams = this.typeParameters(); |
| 8418 } | 8472 } |
| 8419 var formals = this.formalParameterList(); | 8473 var formals = this.formalParameterList(); |
| 8420 this._eatSemicolon(); | 8474 this._eatSemicolon(); |
| 8421 var func = new FunctionDefinition(null, di.get$type(), di.get$name(), formals,
null, null, null, null, this._makeSpan(start)); | 8475 var func = new FunctionDefinition(null, di.get$type(), di.get$name(), formals,
null, null, null, this._makeSpan(start)); |
| 8422 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); | 8476 return new FunctionTypeDefinition(func, typeParams, this._makeSpan(start)); |
| 8423 } | 8477 } |
| 8424 Parser.prototype.initializers = function() { | 8478 Parser.prototype.initializers = function() { |
| 8425 this._inhibitLambda = true; | 8479 this._inhibitLambda = true; |
| 8426 var ret = []; | 8480 var ret = []; |
| 8427 do { | 8481 do { |
| 8428 ret.add$1(this.expression()); | 8482 ret.add$1(this.expression()); |
| 8429 } | 8483 } |
| 8430 while (this._maybeEat(11/*TokenKind.COMMA*/)) | 8484 while (this._maybeEat(11/*TokenKind.COMMA*/)) |
| 8431 this._inhibitLambda = false; | 8485 this._inhibitLambda = false; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 8452 return this.block(); | 8506 return this.block(); |
| 8453 } | 8507 } |
| 8454 } | 8508 } |
| 8455 else if (!inExpression) { | 8509 else if (!inExpression) { |
| 8456 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { | 8510 if (this._maybeEat(10/*TokenKind.SEMICOLON*/)) { |
| 8457 return null; | 8511 return null; |
| 8458 } | 8512 } |
| 8459 } | 8513 } |
| 8460 this._error('Expected function body (neither { nor => found)'); | 8514 this._error('Expected function body (neither { nor => found)'); |
| 8461 } | 8515 } |
| 8462 Parser.prototype.finishField = function(start, modifiers, typeParams, type, name
, value) { | 8516 Parser.prototype.finishField = function(start, modifiers, type, name, value) { |
| 8463 if (typeParams != null) { | |
| 8464 $globals.world.internalError('trying to create a generic field', this._makeS
pan(start)); | |
| 8465 } | |
| 8466 var names = [name]; | 8517 var names = [name]; |
| 8467 var values = [value]; | 8518 var values = [value]; |
| 8468 while (this._maybeEat(11/*TokenKind.COMMA*/)) { | 8519 while (this._maybeEat(11/*TokenKind.COMMA*/)) { |
| 8469 names.add$1(this.identifier()); | 8520 names.add$1(this.identifier()); |
| 8470 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 8521 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 8471 values.add$1(this.expression()); | 8522 values.add$1(this.expression()); |
| 8472 } | 8523 } |
| 8473 else { | 8524 else { |
| 8474 values.add$1(); | 8525 values.add$1(); |
| 8475 } | 8526 } |
| 8476 } | 8527 } |
| 8477 this._eatSemicolon(); | 8528 this._eatSemicolon(); |
| 8478 return new VariableDefinition(modifiers, type, names, values, this._makeSpan(s
tart)); | 8529 return new VariableDefinition(modifiers, type, names, values, this._makeSpan(s
tart)); |
| 8479 } | 8530 } |
| 8480 Parser.prototype.finishDefinition = function(start, modifiers, di, typeParams) { | 8531 Parser.prototype.finishDefinition = function(start, modifiers, di) { |
| 8481 switch (this._peek()) { | 8532 switch (this._peek()) { |
| 8482 case 2/*TokenKind.LPAREN*/: | 8533 case 2/*TokenKind.LPAREN*/: |
| 8483 | 8534 |
| 8484 var formals = this.formalParameterList(); | 8535 var formals = this.formalParameterList(); |
| 8485 var inits = null, native_ = null; | 8536 var inits = null, native_ = null; |
| 8486 if (this._maybeEat(8/*TokenKind.COLON*/)) { | 8537 if (this._maybeEat(8/*TokenKind.COLON*/)) { |
| 8487 inits = this.initializers(); | 8538 inits = this.initializers(); |
| 8488 } | 8539 } |
| 8489 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { | 8540 if (this._maybeEat(81/*TokenKind.NATIVE*/)) { |
| 8490 native_ = this.maybeStringLiteral(); | 8541 native_ = this.maybeStringLiteral(); |
| 8491 if (native_ == null) native_ = ''; | 8542 if (native_ == null) native_ = ''; |
| 8492 } | 8543 } |
| 8493 var body = this.functionBody(false); | 8544 var body = this.functionBody(false); |
| 8494 if (di.get$name() == null) { | 8545 if (di.get$name() == null) { |
| 8495 di.set$name(di.get$type().get$name()); | 8546 di.set$name(di.get$type().get$name()); |
| 8496 } | 8547 } |
| 8497 return new FunctionDefinition(modifiers, di.get$type(), di.get$name(), for
mals, typeParams, inits, native_, body, this._makeSpan(start)); | 8548 return new FunctionDefinition(modifiers, di.get$type(), di.get$name(), for
mals, inits, native_, body, this._makeSpan(start)); |
| 8498 | 8549 |
| 8499 case 20/*TokenKind.ASSIGN*/: | 8550 case 20/*TokenKind.ASSIGN*/: |
| 8500 | 8551 |
| 8501 this._eat(20/*TokenKind.ASSIGN*/); | 8552 this._eat(20/*TokenKind.ASSIGN*/); |
| 8502 var value = this.expression(); | 8553 var value = this.expression(); |
| 8503 return this.finishField(start, modifiers, typeParams, di.get$type(), di.ge
t$name(), value); | 8554 return this.finishField(start, modifiers, di.get$type(), di.get$name(), va
lue); |
| 8504 | 8555 |
| 8505 case 11/*TokenKind.COMMA*/: | 8556 case 11/*TokenKind.COMMA*/: |
| 8506 case 10/*TokenKind.SEMICOLON*/: | 8557 case 10/*TokenKind.SEMICOLON*/: |
| 8507 | 8558 |
| 8508 return this.finishField(start, modifiers, typeParams, di.get$type(), di.ge
t$name(), null); | 8559 return this.finishField(start, modifiers, di.get$type(), di.get$name(), nu
ll); |
| 8509 | 8560 |
| 8510 default: | 8561 default: |
| 8511 | 8562 |
| 8512 this._errorExpected('declaration'); | 8563 this._errorExpected('declaration'); |
| 8513 return null; | 8564 return null; |
| 8514 | 8565 |
| 8515 } | 8566 } |
| 8516 } | 8567 } |
| 8517 Parser.prototype.declaration = function(includeOperators) { | 8568 Parser.prototype.declaration = function(includeOperators) { |
| 8518 var start = this._peekToken.start; | 8569 var start = this._peekToken.start; |
| 8519 if (this._peekKind(75/*TokenKind.FACTORY*/)) { | 8570 if (this._peekKind(75/*TokenKind.FACTORY*/)) { |
| 8520 return this.factoryConstructorDeclaration(); | 8571 return this.factoryConstructorDeclaration(); |
| 8521 } | 8572 } |
| 8522 var modifiers = this._readModifiers(); | 8573 var modifiers = this._readModifiers(); |
| 8523 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators), null); | 8574 return this.finishDefinition(start, modifiers, this.declaredIdentifier(include
Operators)); |
| 8524 } | 8575 } |
| 8525 Parser.prototype.factoryConstructorDeclaration = function() { | 8576 Parser.prototype.factoryConstructorDeclaration = function() { |
| 8526 var start = this._peekToken.start; | 8577 var start = this._peekToken.start; |
| 8527 var factoryToken = this._next(); | 8578 var factoryToken = this._next(); |
| 8528 var names = [this.identifier()]; | 8579 var names = [this.identifier()]; |
| 8529 while (this._maybeEat(14/*TokenKind.DOT*/)) { | 8580 while (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 8530 names.add$1(this.identifier()); | 8581 names.add$1(this.identifier()); |
| 8531 } | 8582 } |
| 8532 var typeParams = null; | |
| 8533 if (this._peekKind(52/*TokenKind.LT*/)) { | 8583 if (this._peekKind(52/*TokenKind.LT*/)) { |
| 8534 typeParams = this.typeParameters(); | 8584 var tp = this.typeParameters(); |
| 8585 $globals.world.warning('type parameters on factories are no longer supported
, place them on the class instead'/*'type parameters on factories are no longer
supported, ' |
| 8586 + 'place them on the class instead'*/, this._makeSpan(tp.$index(0)
.get$span().get$start())); |
| 8535 } | 8587 } |
| 8536 var name = null; | 8588 var name = null; |
| 8537 var type = null; | 8589 var type = null; |
| 8538 if (this._maybeEat(14/*TokenKind.DOT*/)) { | 8590 if (this._maybeEat(14/*TokenKind.DOT*/)) { |
| 8539 name = this.identifier(); | 8591 name = this.identifier(); |
| 8540 } | 8592 } |
| 8541 else if (typeParams == null) { | 8593 else { |
| 8542 if (names.get$length() > 1) { | 8594 if (names.get$length() > 1) { |
| 8543 name = names.removeLast$0(); | 8595 name = names.removeLast$0(); |
| 8544 } | 8596 } |
| 8545 else { | 8597 else { |
| 8546 name = new Identifier('', names.$index(0).get$span()); | 8598 name = new Identifier('', names.$index(0).get$span()); |
| 8547 } | 8599 } |
| 8548 } | 8600 } |
| 8549 else { | |
| 8550 name = new Identifier('', names.$index(0).get$span()); | |
| 8551 } | |
| 8552 if (names.get$length() > 1) { | 8601 if (names.get$length() > 1) { |
| 8553 this._error('unsupported qualified name for factory', names.$index(0).get$sp
an()); | 8602 this._error('unsupported qualified name for factory', names.$index(0).get$sp
an()); |
| 8554 } | 8603 } |
| 8555 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); | 8604 type = new NameTypeReference(false, names.$index(0), null, names.$index(0).get
$span()); |
| 8556 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); | 8605 var di = new DeclaredIdentifier(type, name, this._makeSpan(start)); |
| 8557 return this.finishDefinition(start, [factoryToken], di, typeParams); | 8606 return this.finishDefinition(start, [factoryToken], di); |
| 8558 } | 8607 } |
| 8559 Parser.prototype.statement = function() { | 8608 Parser.prototype.statement = function() { |
| 8560 switch (this._peek()) { | 8609 switch (this._peek()) { |
| 8561 case 89/*TokenKind.BREAK*/: | 8610 case 89/*TokenKind.BREAK*/: |
| 8562 | 8611 |
| 8563 return this.breakStatement(); | 8612 return this.breakStatement(); |
| 8564 | 8613 |
| 8565 case 93/*TokenKind.CONTINUE*/: | 8614 case 93/*TokenKind.CONTINUE*/: |
| 8566 | 8615 |
| 8567 return this.continueStatement(); | 8616 return this.continueStatement(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8635 this._eatSemicolon(); | 8684 this._eatSemicolon(); |
| 8636 expr.get$func().set$span(this._makeSpan(start)); | 8685 expr.get$func().set$span(this._makeSpan(start)); |
| 8637 } | 8686 } |
| 8638 return expr.get$func(); | 8687 return expr.get$func(); |
| 8639 } | 8688 } |
| 8640 else if ((expr instanceof DeclaredIdentifier)) { | 8689 else if ((expr instanceof DeclaredIdentifier)) { |
| 8641 var value = null; | 8690 var value = null; |
| 8642 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 8691 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 8643 value = this.expression(); | 8692 value = this.expression(); |
| 8644 } | 8693 } |
| 8645 return this.finishField(start, null, null, expr.get$type(), expr.get$name(),
value); | 8694 return this.finishField(start, null, expr.get$type(), expr.get$name(), value
); |
| 8646 } | 8695 } |
| 8647 else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get$x() instanceo
f DeclaredIdentifier))) { | 8696 else if (this._isBin(expr, 20/*TokenKind.ASSIGN*/) && ((expr.get$x() instanceo
f DeclaredIdentifier))) { |
| 8648 var di = expr.get$x(); | 8697 var di = expr.get$x(); |
| 8649 return this.finishField(start, null, null, di.type, di.name, expr.get$y()); | 8698 return this.finishField(start, null, di.type, di.name, expr.get$y()); |
| 8650 } | 8699 } |
| 8651 else if (this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat(11/*TokenKind
.COMMA*/)) { | 8700 else if (this._isBin(expr, 52/*TokenKind.LT*/) && this._maybeEat(11/*TokenKind
.COMMA*/)) { |
| 8652 var baseType = this._makeType(expr.get$x()); | 8701 var baseType = this._makeType(expr.get$x()); |
| 8653 var typeArgs = [this._makeType(expr.get$y())]; | 8702 var typeArgs = [this._makeType(expr.get$y())]; |
| 8654 var gt = this._finishTypeArguments(baseType, 0, typeArgs); | 8703 var gt = this._finishTypeArguments(baseType, 0, typeArgs); |
| 8655 var name = this.identifier(); | 8704 var name = this.identifier(); |
| 8656 var value = null; | 8705 var value = null; |
| 8657 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 8706 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 8658 value = this.expression(); | 8707 value = this.expression(); |
| 8659 } | 8708 } |
| 8660 return this.finishField(expr.get$span().get$start(), null, null, gt, name, v
alue); | 8709 return this.finishField(expr.get$span().get$start(), null, gt, name, value); |
| 8661 } | 8710 } |
| 8662 else { | 8711 else { |
| 8663 this._eatSemicolon(); | 8712 this._eatSemicolon(); |
| 8664 return new ExpressionStatement(expr, this._makeSpan(expr.get$span().get$star
t())); | 8713 return new ExpressionStatement(expr, this._makeSpan(expr.get$span().get$star
t())); |
| 8665 } | 8714 } |
| 8666 } | 8715 } |
| 8667 Parser.prototype.testCondition = function() { | 8716 Parser.prototype.testCondition = function() { |
| 8668 this._eatLeftParen(); | 8717 this._eatLeftParen(); |
| 8669 var ret = this.expression(); | 8718 var ret = this.expression(); |
| 8670 this._eat(3/*TokenKind.RPAREN*/); | 8719 this._eat(3/*TokenKind.RPAREN*/); |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9282 this._next(); | 9331 this._next(); |
| 9283 this._errorExpected('string literal, but found incomplete string'); | 9332 this._errorExpected('string literal, but found incomplete string'); |
| 9284 } | 9333 } |
| 9285 return null; | 9334 return null; |
| 9286 } | 9335 } |
| 9287 Parser.prototype._parenOrLambda = function() { | 9336 Parser.prototype._parenOrLambda = function() { |
| 9288 var start = this._peekToken.start; | 9337 var start = this._peekToken.start; |
| 9289 if (this._atClosureParameters()) { | 9338 if (this._atClosureParameters()) { |
| 9290 var formals = this.formalParameterList(); | 9339 var formals = this.formalParameterList(); |
| 9291 var body = this.functionBody(true); | 9340 var body = this.functionBody(true); |
| 9292 var func = new FunctionDefinition(null, null, null, formals, null, null, nul
l, body, this._makeSpan(start)); | 9341 var func = new FunctionDefinition(null, null, null, formals, null, null, bod
y, this._makeSpan(start)); |
| 9293 return new LambdaExpression(func, func.get$span()); | 9342 return new LambdaExpression(func, func.get$span()); |
| 9294 } | 9343 } |
| 9295 else { | 9344 else { |
| 9296 this._eatLeftParen(); | 9345 this._eatLeftParen(); |
| 9297 var saved = this._inhibitLambda; | 9346 var saved = this._inhibitLambda; |
| 9298 this._inhibitLambda = false; | 9347 this._inhibitLambda = false; |
| 9299 var expr = this.expression(); | 9348 var expr = this.expression(); |
| 9300 this._eat(3/*TokenKind.RPAREN*/); | 9349 this._eat(3/*TokenKind.RPAREN*/); |
| 9301 this._inhibitLambda = saved; | 9350 this._inhibitLambda = saved; |
| 9302 return new ParenExpression(expr, this._makeSpan(start)); | 9351 return new ParenExpression(expr, this._makeSpan(start)); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9685 var name = di.get$name(); | 9734 var name = di.get$name(); |
| 9686 var value = null; | 9735 var value = null; |
| 9687 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { | 9736 if (this._maybeEat(20/*TokenKind.ASSIGN*/)) { |
| 9688 if (!inOptionalBlock) { | 9737 if (!inOptionalBlock) { |
| 9689 this._error('default values only allowed inside [optional] section'); | 9738 this._error('default values only allowed inside [optional] section'); |
| 9690 } | 9739 } |
| 9691 value = this.expression(); | 9740 value = this.expression(); |
| 9692 } | 9741 } |
| 9693 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { | 9742 else if (this._peekKind(2/*TokenKind.LPAREN*/)) { |
| 9694 var formals = this.formalParameterList(); | 9743 var formals = this.formalParameterList(); |
| 9695 var func = new FunctionDefinition(null, type, name, formals, null, null, nul
l, null, this._makeSpan(start)); | 9744 var func = new FunctionDefinition(null, type, name, formals, null, null, nul
l, this._makeSpan(start)); |
| 9696 type = new FunctionTypeReference(false, func, func.get$span()); | 9745 type = new FunctionTypeReference(false, func, func.get$span()); |
| 9697 } | 9746 } |
| 9698 if (inOptionalBlock && value == null) { | 9747 if (inOptionalBlock && value == null) { |
| 9699 value = new NullExpression(this._makeSpan(start)); | 9748 value = new NullExpression(this._makeSpan(start)); |
| 9700 } | 9749 } |
| 9701 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); | 9750 return new FormalNode(isThis, isRest, type, name, value, this._makeSpan(start)
); |
| 9702 } | 9751 } |
| 9703 Parser.prototype.formalParameterList = function() { | 9752 Parser.prototype.formalParameterList = function() { |
| 9704 this._eatLeftParen(); | 9753 this._eatLeftParen(); |
| 9705 var formals = []; | 9754 var formals = []; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9739 type = null; | 9788 type = null; |
| 9740 } | 9789 } |
| 9741 else if ((expr instanceof DeclaredIdentifier)) { | 9790 else if ((expr instanceof DeclaredIdentifier)) { |
| 9742 name = expr.get$name(); | 9791 name = expr.get$name(); |
| 9743 type = expr.get$type(); | 9792 type = expr.get$type(); |
| 9744 } | 9793 } |
| 9745 else { | 9794 else { |
| 9746 this._error('bad function body', expr.get$span()); | 9795 this._error('bad function body', expr.get$span()); |
| 9747 } | 9796 } |
| 9748 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); | 9797 var span = new SourceSpan(expr.get$span().get$file(), expr.get$span().get$star
t(), body.get$span().get$end()); |
| 9749 var func = new FunctionDefinition(null, type, name, formals, null, null, null,
body, span); | 9798 var func = new FunctionDefinition(null, type, name, formals, null, null, body,
span); |
| 9750 return new LambdaExpression(func, func.get$span()); | 9799 return new LambdaExpression(func, func.get$span()); |
| 9751 } | 9800 } |
| 9752 Parser.prototype._makeDeclaredIdentifier = function(e) { | 9801 Parser.prototype._makeDeclaredIdentifier = function(e) { |
| 9753 if ((e instanceof VarExpression)) { | 9802 if ((e instanceof VarExpression)) { |
| 9754 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); | 9803 return new DeclaredIdentifier(null, e.get$name(), e.get$span()); |
| 9755 } | 9804 } |
| 9756 else if ((e instanceof DeclaredIdentifier)) { | 9805 else if ((e instanceof DeclaredIdentifier)) { |
| 9757 return e; | 9806 return e; |
| 9758 } | 9807 } |
| 9759 else { | 9808 else { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9857 DirectiveDefinition.prototype.get$name = function() { return this.name; }; | 9906 DirectiveDefinition.prototype.get$name = function() { return this.name; }; |
| 9858 DirectiveDefinition.prototype.set$name = function(value) { return this.name = va
lue; }; | 9907 DirectiveDefinition.prototype.set$name = function(value) { return this.name = va
lue; }; |
| 9859 DirectiveDefinition.prototype.get$arguments = function() { return this.arguments
; }; | 9908 DirectiveDefinition.prototype.get$arguments = function() { return this.arguments
; }; |
| 9860 DirectiveDefinition.prototype.set$arguments = function(value) { return this.argu
ments = value; }; | 9909 DirectiveDefinition.prototype.set$arguments = function(value) { return this.argu
ments = value; }; |
| 9861 DirectiveDefinition.prototype.visit = function(visitor) { | 9910 DirectiveDefinition.prototype.visit = function(visitor) { |
| 9862 return visitor.visitDirectiveDefinition(this); | 9911 return visitor.visitDirectiveDefinition(this); |
| 9863 } | 9912 } |
| 9864 DirectiveDefinition.prototype.visit$1 = DirectiveDefinition.prototype.visit; | 9913 DirectiveDefinition.prototype.visit$1 = DirectiveDefinition.prototype.visit; |
| 9865 // ********** Code for TypeDefinition ************** | 9914 // ********** Code for TypeDefinition ************** |
| 9866 $inherits(TypeDefinition, Definition); | 9915 $inherits(TypeDefinition, Definition); |
| 9867 function TypeDefinition(isClass, name, typeParameters, extendsTypes, implementsT
ypes, nativeType, factoryType, body, span) { | 9916 function TypeDefinition(isClass, name, typeParameters, extendsTypes, implementsT
ypes, nativeType, defaultType, body, span) { |
| 9868 this.isClass = isClass; | 9917 this.isClass = isClass; |
| 9869 this.name = name; | 9918 this.name = name; |
| 9870 this.typeParameters = typeParameters; | 9919 this.typeParameters = typeParameters; |
| 9871 this.extendsTypes = extendsTypes; | 9920 this.extendsTypes = extendsTypes; |
| 9872 this.implementsTypes = implementsTypes; | 9921 this.implementsTypes = implementsTypes; |
| 9873 this.nativeType = nativeType; | 9922 this.nativeType = nativeType; |
| 9874 this.factoryType = factoryType; | 9923 this.defaultType = defaultType; |
| 9875 this.body = body; | 9924 this.body = body; |
| 9876 // Initializers done | 9925 // Initializers done |
| 9877 Definition.call(this, span); | 9926 Definition.call(this, span); |
| 9878 } | 9927 } |
| 9879 TypeDefinition.prototype.get$isClass = function() { return this.isClass; }; | 9928 TypeDefinition.prototype.get$isClass = function() { return this.isClass; }; |
| 9880 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v
alue; }; | 9929 TypeDefinition.prototype.set$isClass = function(value) { return this.isClass = v
alue; }; |
| 9881 TypeDefinition.prototype.get$name = function() { return this.name; }; | 9930 TypeDefinition.prototype.get$name = function() { return this.name; }; |
| 9882 TypeDefinition.prototype.set$name = function(value) { return this.name = value;
}; | 9931 TypeDefinition.prototype.set$name = function(value) { return this.name = value;
}; |
| 9883 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam
eters; }; | 9932 TypeDefinition.prototype.get$typeParameters = function() { return this.typeParam
eters; }; |
| 9884 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type
Parameters = value; }; | 9933 TypeDefinition.prototype.set$typeParameters = function(value) { return this.type
Parameters = value; }; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9921 VariableDefinition.prototype.get$names = function() { return this.names; }; | 9970 VariableDefinition.prototype.get$names = function() { return this.names; }; |
| 9922 VariableDefinition.prototype.set$names = function(value) { return this.names = v
alue; }; | 9971 VariableDefinition.prototype.set$names = function(value) { return this.names = v
alue; }; |
| 9923 VariableDefinition.prototype.get$values = function() { return this.values; }; | 9972 VariableDefinition.prototype.get$values = function() { return this.values; }; |
| 9924 VariableDefinition.prototype.set$values = function(value) { return this.values =
value; }; | 9973 VariableDefinition.prototype.set$values = function(value) { return this.values =
value; }; |
| 9925 VariableDefinition.prototype.visit = function(visitor) { | 9974 VariableDefinition.prototype.visit = function(visitor) { |
| 9926 return visitor.visitVariableDefinition(this); | 9975 return visitor.visitVariableDefinition(this); |
| 9927 } | 9976 } |
| 9928 VariableDefinition.prototype.visit$1 = VariableDefinition.prototype.visit; | 9977 VariableDefinition.prototype.visit$1 = VariableDefinition.prototype.visit; |
| 9929 // ********** Code for FunctionDefinition ************** | 9978 // ********** Code for FunctionDefinition ************** |
| 9930 $inherits(FunctionDefinition, Definition); | 9979 $inherits(FunctionDefinition, Definition); |
| 9931 function FunctionDefinition(modifiers, returnType, name, formals, typeParameters
, initializers, nativeBody, body, span) { | 9980 function FunctionDefinition(modifiers, returnType, name, formals, initializers,
nativeBody, body, span) { |
| 9932 this.modifiers = modifiers; | 9981 this.modifiers = modifiers; |
| 9933 this.returnType = returnType; | 9982 this.returnType = returnType; |
| 9934 this.name = name; | 9983 this.name = name; |
| 9935 this.formals = formals; | 9984 this.formals = formals; |
| 9936 this.typeParameters = typeParameters; | |
| 9937 this.initializers = initializers; | 9985 this.initializers = initializers; |
| 9938 this.nativeBody = nativeBody; | 9986 this.nativeBody = nativeBody; |
| 9939 this.body = body; | 9987 this.body = body; |
| 9940 // Initializers done | 9988 // Initializers done |
| 9941 Definition.call(this, span); | 9989 Definition.call(this, span); |
| 9942 } | 9990 } |
| 9943 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp
e; }; | 9991 FunctionDefinition.prototype.get$returnType = function() { return this.returnTyp
e; }; |
| 9944 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu
rnType = value; }; | 9992 FunctionDefinition.prototype.set$returnType = function(value) { return this.retu
rnType = value; }; |
| 9945 FunctionDefinition.prototype.get$name = function() { return this.name; }; | 9993 FunctionDefinition.prototype.get$name = function() { return this.name; }; |
| 9946 FunctionDefinition.prototype.set$name = function(value) { return this.name = val
ue; }; | 9994 FunctionDefinition.prototype.set$name = function(value) { return this.name = val
ue; }; |
| 9947 FunctionDefinition.prototype.get$typeParameters = function() { return this.typeP
arameters; }; | |
| 9948 FunctionDefinition.prototype.set$typeParameters = function(value) { return this.
typeParameters = value; }; | |
| 9949 FunctionDefinition.prototype.get$initializers = function() { return this.initial
izers; }; | 9995 FunctionDefinition.prototype.get$initializers = function() { return this.initial
izers; }; |
| 9950 FunctionDefinition.prototype.set$initializers = function(value) { return this.in
itializers = value; }; | 9996 FunctionDefinition.prototype.set$initializers = function(value) { return this.in
itializers = value; }; |
| 9951 FunctionDefinition.prototype.get$nativeBody = function() { return this.nativeBod
y; }; | 9997 FunctionDefinition.prototype.get$nativeBody = function() { return this.nativeBod
y; }; |
| 9952 FunctionDefinition.prototype.set$nativeBody = function(value) { return this.nati
veBody = value; }; | 9998 FunctionDefinition.prototype.set$nativeBody = function(value) { return this.nati
veBody = value; }; |
| 9953 FunctionDefinition.prototype.get$body = function() { return this.body; }; | 9999 FunctionDefinition.prototype.get$body = function() { return this.body; }; |
| 9954 FunctionDefinition.prototype.set$body = function(value) { return this.body = val
ue; }; | 10000 FunctionDefinition.prototype.set$body = function(value) { return this.body = val
ue; }; |
| 9955 FunctionDefinition.prototype.visit = function(visitor) { | 10001 FunctionDefinition.prototype.visit = function(visitor) { |
| 9956 return visitor.visitFunctionDefinition(this); | 10002 return visitor.visitFunctionDefinition(this); |
| 9957 } | 10003 } |
| 9958 FunctionDefinition.prototype.visit$1 = FunctionDefinition.prototype.visit; | 10004 FunctionDefinition.prototype.visit$1 = FunctionDefinition.prototype.visit; |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10515 TypeReference.call(this, span); | 10561 TypeReference.call(this, span); |
| 10516 } | 10562 } |
| 10517 FunctionTypeReference.prototype.get$isFinal = function() { return this.isFinal;
}; | 10563 FunctionTypeReference.prototype.get$isFinal = function() { return this.isFinal;
}; |
| 10518 FunctionTypeReference.prototype.set$isFinal = function(value) { return this.isFi
nal = value; }; | 10564 FunctionTypeReference.prototype.set$isFinal = function(value) { return this.isFi
nal = value; }; |
| 10519 FunctionTypeReference.prototype.get$func = function() { return this.func; }; | 10565 FunctionTypeReference.prototype.get$func = function() { return this.func; }; |
| 10520 FunctionTypeReference.prototype.set$func = function(value) { return this.func =
value; }; | 10566 FunctionTypeReference.prototype.set$func = function(value) { return this.func =
value; }; |
| 10521 FunctionTypeReference.prototype.visit = function(visitor) { | 10567 FunctionTypeReference.prototype.visit = function(visitor) { |
| 10522 return visitor.visitFunctionTypeReference(this); | 10568 return visitor.visitFunctionTypeReference(this); |
| 10523 } | 10569 } |
| 10524 FunctionTypeReference.prototype.visit$1 = FunctionTypeReference.prototype.visit; | 10570 FunctionTypeReference.prototype.visit$1 = FunctionTypeReference.prototype.visit; |
| 10571 // ********** Code for DefaultTypeReference ************** |
| 10572 $inherits(DefaultTypeReference, TypeReference); |
| 10573 function DefaultTypeReference(oldFactory, baseType, typeParameters, span) { |
| 10574 this.oldFactory = oldFactory; |
| 10575 this.baseType = baseType; |
| 10576 this.typeParameters = typeParameters; |
| 10577 // Initializers done |
| 10578 TypeReference.call(this, span); |
| 10579 } |
| 10580 DefaultTypeReference.prototype.get$baseType = function() { return this.baseType;
}; |
| 10581 DefaultTypeReference.prototype.set$baseType = function(value) { return this.base
Type = value; }; |
| 10582 DefaultTypeReference.prototype.get$typeParameters = function() { return this.typ
eParameters; }; |
| 10583 DefaultTypeReference.prototype.set$typeParameters = function(value) { return thi
s.typeParameters = value; }; |
| 10584 DefaultTypeReference.prototype.visit = function(visitor) { |
| 10585 return visitor.visitDefaultTypeReference(this); |
| 10586 } |
| 10587 DefaultTypeReference.prototype.visit$1 = DefaultTypeReference.prototype.visit; |
| 10525 // ********** Code for ArgumentNode ************** | 10588 // ********** Code for ArgumentNode ************** |
| 10526 $inherits(ArgumentNode, Node); | 10589 $inherits(ArgumentNode, Node); |
| 10527 function ArgumentNode(label, value, span) { | 10590 function ArgumentNode(label, value, span) { |
| 10528 this.label = label; | 10591 this.label = label; |
| 10529 this.value = value; | 10592 this.value = value; |
| 10530 // Initializers done | 10593 // Initializers done |
| 10531 Node.call(this, span); | 10594 Node.call(this, span); |
| 10532 } | 10595 } |
| 10533 ArgumentNode.prototype.get$label = function() { return this.label; }; | 10596 ArgumentNode.prototype.get$label = function() { return this.label; }; |
| 10534 ArgumentNode.prototype.set$label = function(value) { return this.label = value;
}; | 10597 ArgumentNode.prototype.set$label = function(value) { return this.label = value;
}; |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11551 $globals.world.error(('class "' + this.name + '" has a cycle in its in
heritance chain'), extendsTypeRef.get$span()); | 11614 $globals.world.error(('class "' + this.name + '" has a cycle in its in
heritance chain'), extendsTypeRef.get$span()); |
| 11552 } | 11615 } |
| 11553 } | 11616 } |
| 11554 else { | 11617 else { |
| 11555 if (!this.get$isObject()) { | 11618 if (!this.get$isObject()) { |
| 11556 this.set$parent($globals.world.objectType); | 11619 this.set$parent($globals.world.objectType); |
| 11557 this.get$parent().addDirectSubtype(this); | 11620 this.get$parent().addDirectSubtype(this); |
| 11558 } | 11621 } |
| 11559 } | 11622 } |
| 11560 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); | 11623 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); |
| 11561 if (typeDef.factoryType != null) { | 11624 if (typeDef.defaultType != null) { |
| 11562 $globals.world.error('factory not allowed on classes', typeDef.factoryTy
pe.span); | 11625 $globals.world.error('default not allowed on classes', typeDef.defaultTy
pe.span); |
| 11563 } | 11626 } |
| 11564 } | 11627 } |
| 11565 else { | 11628 else { |
| 11566 if (typeDef.implementsTypes != null && typeDef.implementsTypes.get$length(
) > 0) { | 11629 if (typeDef.implementsTypes != null && typeDef.implementsTypes.get$length(
) > 0) { |
| 11567 $globals.world.error('implements not allowed on interfaces (use extends)
', typeDef.implementsTypes.$index(0).get$span()); | 11630 $globals.world.error('implements not allowed on interfaces (use extends)
', typeDef.implementsTypes.$index(0).get$span()); |
| 11568 } | 11631 } |
| 11569 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); | 11632 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); |
| 11570 var res = this._cycleInInterfaceExtends(); | 11633 var res = this._cycleInInterfaceExtends(); |
| 11571 if (res >= 0) { | 11634 if (res >= 0) { |
| 11572 $globals.world.error(('interface "' + this.name + '" has a cycle in its
inheritance chain'), typeDef.extendsTypes.$index(res).get$span()); | 11635 $globals.world.error(('interface "' + this.name + '" has a cycle in its
inheritance chain'), typeDef.extendsTypes.$index(res).get$span()); |
| 11573 } | 11636 } |
| 11574 if (typeDef.factoryType != null) { | 11637 if (typeDef.defaultType != null) { |
| 11575 this.factory_ = this.resolveType(typeDef.factoryType, true); | 11638 this.defaultType = this.resolveType(typeDef.defaultType.baseType, true); |
| 11576 if (this.factory_ == null) { | 11639 if (this.defaultType == null) { |
| 11577 $globals.world.warning('unresolved factory', typeDef.factoryType.span)
; | 11640 $globals.world.warning('unresolved default class', typeDef.defaultType
.span); |
| 11641 } |
| 11642 else { |
| 11643 this.defaultType._resolveTypeParams(typeDef.defaultType.typeParameters
); |
| 11578 } | 11644 } |
| 11579 } | 11645 } |
| 11580 } | 11646 } |
| 11581 } | 11647 } |
| 11582 else if ((this.definition instanceof FunctionTypeDefinition)) { | 11648 else if ((this.definition instanceof FunctionTypeDefinition)) { |
| 11583 this.interfaces = [$globals.world.functionType]; | 11649 this.interfaces = [$globals.world.functionType]; |
| 11584 } | 11650 } |
| 11585 if (this.typeParameters != null) { | 11651 this._resolveTypeParams(this.typeParameters); |
| 11586 var $$list = this.typeParameters; | |
| 11587 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { | |
| 11588 var tp = $$list.$index($$i); | |
| 11589 tp.set$enclosingElement(this); | |
| 11590 tp.resolve$0(); | |
| 11591 } | |
| 11592 } | |
| 11593 if (this.get$isObject()) this._createNotEqualMember(); | 11652 if (this.get$isObject()) this._createNotEqualMember(); |
| 11594 $globals.world._addType(this); | 11653 $globals.world._addType(this); |
| 11595 var $$list = this.constructors.getValues(); | 11654 var $$list = this.constructors.getValues(); |
| 11596 for (var $$i = this.constructors.getValues().iterator$0(); $$i.hasNext$0(); )
{ | 11655 for (var $$i = this.constructors.getValues().iterator$0(); $$i.hasNext$0(); )
{ |
| 11597 var c = $$i.next$0(); | 11656 var c = $$i.next$0(); |
| 11598 c.resolve$0(); | 11657 c.resolve$0(); |
| 11599 } | 11658 } |
| 11600 var $list0 = this.members.getValues(); | 11659 var $list0 = this.members.getValues(); |
| 11601 for (var $$i = this.members.getValues().iterator$0(); $$i.hasNext$0(); ) { | 11660 for (var $$i = this.members.getValues().iterator$0(); $$i.hasNext$0(); ) { |
| 11602 var m = $$i.next$0(); | 11661 var m = $$i.next$0(); |
| 11603 m.resolve$0(); | 11662 m.resolve$0(); |
| 11604 } | 11663 } |
| 11605 this.factories.forEach((function (f) { | 11664 this.factories.forEach((function (f) { |
| 11606 return f.resolve$0(); | 11665 return f.resolve$0(); |
| 11607 }) | 11666 }) |
| 11608 ); | 11667 ); |
| 11609 if (this.get$isJsGlobalObject()) { | 11668 if (this.get$isJsGlobalObject()) { |
| 11610 var $list1 = this.members.getValues(); | 11669 var $list1 = this.members.getValues(); |
| 11611 for (var $$i = this.members.getValues().iterator$0(); $$i.hasNext$0(); ) { | 11670 for (var $$i = this.members.getValues().iterator$0(); $$i.hasNext$0(); ) { |
| 11612 var m0 = $$i.next$0(); | 11671 var m0 = $$i.next$0(); |
| 11613 if (!m0.get$isStatic()) $globals.world._addTopName(m0); | 11672 if (!m0.get$isStatic()) $globals.world._addTopName(m0); |
| 11614 } | 11673 } |
| 11615 } | 11674 } |
| 11616 } | 11675 } |
| 11676 DefinedType.prototype._resolveTypeParams = function(params) { |
| 11677 if (params == null) return; |
| 11678 for (var $$i = 0;$$i < params.get$length(); $$i++) { |
| 11679 var tp = params.$index($$i); |
| 11680 tp.set$enclosingElement(this); |
| 11681 tp.resolve$0(); |
| 11682 } |
| 11683 } |
| 11617 DefinedType.prototype.addMethod = function(methodName, definition) { | 11684 DefinedType.prototype.addMethod = function(methodName, definition) { |
| 11618 if (methodName == null) methodName = definition.name.name; | 11685 if (methodName == null) methodName = definition.name.name; |
| 11619 var method = new MethodMember(methodName, this, definition); | 11686 var method = new MethodMember(methodName, this, definition); |
| 11620 if (method.get$isConstructor()) { | 11687 if (method.get$isConstructor()) { |
| 11621 if (this.constructors.containsKey(method.get$constructorName())) { | 11688 if (this.constructors.containsKey(method.get$constructorName())) { |
| 11622 $globals.world.error(('duplicate constructor definition of ' + method.get$
name()), definition.span); | 11689 $globals.world.error(('duplicate constructor definition of ' + method.get$
name()), definition.span); |
| 11623 return; | 11690 return; |
| 11624 } | 11691 } |
| 11625 this.constructors.$setindex(method.get$constructorName(), method); | 11692 this.constructors.$setindex(method.get$constructorName(), method); |
| 11626 return; | 11693 return; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11688 if (ret != null) return ret; | 11755 if (ret != null) return ret; |
| 11689 ret = this.factories.getFactory(this.name, constructorName); | 11756 ret = this.factories.getFactory(this.name, constructorName); |
| 11690 if (ret != null) return ret; | 11757 if (ret != null) return ret; |
| 11691 ret = this.constructors.$index(constructorName); | 11758 ret = this.constructors.$index(constructorName); |
| 11692 if (ret != null) return ret; | 11759 if (ret != null) return ret; |
| 11693 return this._tryCreateDefaultConstructor(constructorName); | 11760 return this._tryCreateDefaultConstructor(constructorName); |
| 11694 } | 11761 } |
| 11695 DefinedType.prototype.getConstructor = function(constructorName) { | 11762 DefinedType.prototype.getConstructor = function(constructorName) { |
| 11696 var ret = this.constructors.$index(constructorName); | 11763 var ret = this.constructors.$index(constructorName); |
| 11697 if (ret != null) { | 11764 if (ret != null) { |
| 11698 if (this.factory_ != null) { | 11765 if (this.defaultType != null) { |
| 11699 return this.factory_.getFactory(this, constructorName); | 11766 this._checkDefaultTypeParams(); |
| 11767 return this.defaultType.getFactory(this, constructorName); |
| 11700 } | 11768 } |
| 11701 return ret; | 11769 return ret; |
| 11702 } | 11770 } |
| 11703 ret = this.factories.getFactory(this.name, constructorName); | 11771 ret = this.factories.getFactory(this.name, constructorName); |
| 11704 if (ret != null) return ret; | 11772 if (ret != null) return ret; |
| 11705 return this._tryCreateDefaultConstructor(constructorName); | 11773 return this._tryCreateDefaultConstructor(constructorName); |
| 11706 } | 11774 } |
| 11775 DefinedType.prototype._checkDefaultTypeParams = function() { |
| 11776 function toList(list) { |
| 11777 return (list != null ? list : const$128/*const []*/); |
| 11778 } |
| 11779 var typeDef = this.definition; |
| 11780 if (typeDef.defaultType.oldFactory) { |
| 11781 return; |
| 11782 } |
| 11783 var interfaceParams = toList(this.typeParameters); |
| 11784 var defaultParams = toList(typeDef.defaultType.typeParameters); |
| 11785 var classParams = toList(this.defaultType.typeParameters); |
| 11786 if ($ne(interfaceParams.get$length(), defaultParams.get$length()) || $ne(defau
ltParams.get$length(), classParams.get$length())) { |
| 11787 $globals.world.error('"default" must have the same number of type parameters
as the class and interface do'/*'"default" must have the same number of type pa
rameters as ' |
| 11788 + 'the class and interface do'*/, this.get$span(), typeDef.default
Type.span, this.defaultType.get$span()); |
| 11789 return; |
| 11790 } |
| 11791 for (var i = 0; |
| 11792 i < interfaceParams.get$length(); i++) { |
| 11793 var ip = interfaceParams.$index(i); |
| 11794 var dp = defaultParams.$index(i); |
| 11795 var cp = classParams.$index(i); |
| 11796 dp.resolve$0(); |
| 11797 if ($ne(ip.get$name(), dp.get$name()) || $ne(dp.get$name(), cp.get$name()))
{ |
| 11798 $globals.world.error('default class must have the same type parameter name
s as the class and interface'/*'default class must have the same type parameter
names as ' |
| 11799 + 'the class and interface'*/, ip.get$span(), dp.get$span(), c
p.get$span()); |
| 11800 } |
| 11801 else if ($ne(dp.get$extendsType(), cp.get$extendsType())) { |
| 11802 $globals.world.error('default class type parameters must have the same ext
ends as the class does'/*'default class type parameters must have the same exten
ds ' |
| 11803 + 'as the class does'*/, dp.get$span(), cp.get$span()); |
| 11804 } |
| 11805 else if (!dp.get$extendsType().isSubtypeOf$1(ip.get$extendsType())) { |
| 11806 $globals.world.warning('"default" can only have tighter type parameter "ex
tends" than the interface'/*'"default" can only have tighter type parameter "ext
ends"' |
| 11807 + ' than the interface'*/, dp.get$span(), ip.get$span()); |
| 11808 } |
| 11809 } |
| 11810 } |
| 11707 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { | 11811 DefinedType.prototype._tryCreateDefaultConstructor = function(name) { |
| 11708 if (name == '' && this.definition != null && this.isClass && this.constructors
.get$length() == 0) { | 11812 if (name == '' && this.definition != null && this.isClass && this.constructors
.get$length() == 0) { |
| 11709 var span = this.definition.span; | 11813 var span = this.definition.span; |
| 11710 var inits = null, native_ = null, body = null; | 11814 var inits = null, native_ = null, body = null; |
| 11711 if (this.isNative) { | 11815 if (this.isNative) { |
| 11712 native_ = ''; | 11816 native_ = ''; |
| 11713 inits = null; | 11817 inits = null; |
| 11714 } | 11818 } |
| 11715 else { | 11819 else { |
| 11716 body = null; | 11820 body = null; |
| 11717 inits = [new CallExpression(new SuperExpression(span), [], span)]; | 11821 inits = [new CallExpression(new SuperExpression(span), [], span)]; |
| 11718 } | 11822 } |
| 11719 var typeDef = this.definition; | 11823 var typeDef = this.definition; |
| 11720 var c = new FunctionDefinition(null, null, typeDef.name, [], null, inits, na
tive_, body, span); | 11824 var c = new FunctionDefinition(null, null, typeDef.name, [], inits, native_,
body, span); |
| 11721 this.addMethod(null, c); | 11825 this.addMethod(null, c); |
| 11722 this.constructors.$index('').resolve$0(); | 11826 this.constructors.$index('').resolve$0(); |
| 11723 return this.constructors.$index(''); | 11827 return this.constructors.$index(''); |
| 11724 } | 11828 } |
| 11725 return null; | 11829 return null; |
| 11726 } | 11830 } |
| 11727 DefinedType.prototype.getMember = function(memberName) { | 11831 DefinedType.prototype.getMember = function(memberName) { |
| 11728 var member = this.members.$index(memberName); | 11832 var member = this.members.$index(memberName); |
| 11729 if (member != null) { | 11833 if (member != null) { |
| 11730 this._checkOverride(member); | 11834 this._checkOverride(member); |
| (...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13315 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_E, DoubleLinkedQueueEntry_E); | 13419 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_E, DoubleLinkedQueueEntry_E); |
| 13316 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ
ueueEntry_KeyValuePair_K$V); | 13420 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ
ueueEntry_KeyValuePair_K$V); |
| 13317 // ********** Globals ************** | 13421 // ********** Globals ************** |
| 13318 function $static_init(){ | 13422 function $static_init(){ |
| 13319 $globals._GREEN_COLOR = '\u001b[32m'; | 13423 $globals._GREEN_COLOR = '\u001b[32m'; |
| 13320 $globals._MAGENTA_COLOR = '\u001b[35m'; | 13424 $globals._MAGENTA_COLOR = '\u001b[35m'; |
| 13321 $globals._NO_COLOR = '\u001b[0m'; | 13425 $globals._NO_COLOR = '\u001b[0m'; |
| 13322 $globals._RED_COLOR = '\u001b[31m'; | 13426 $globals._RED_COLOR = '\u001b[31m'; |
| 13323 } | 13427 } |
| 13324 var const$0 = new EnvMap()/*const EnvMap()*/; | 13428 var const$0 = new EnvMap()/*const EnvMap()*/; |
| 13429 var const$127 = new IllegalAccessException()/*const IllegalAccessException()*/; |
| 13430 var const$128 = ImmutableList.ImmutableList$from$factory([])/*const []*/; |
| 13325 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; | 13431 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; |
| 13326 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; | 13432 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; |
| 13327 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; | 13433 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; |
| 13328 var $globals = {}; | 13434 var $globals = {}; |
| 13329 $static_init(); | 13435 $static_init(); |
| 13330 main(); | 13436 main(); |
| OLD | NEW |