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

Side by Side Diff: frog/frogsh

Issue 8679014: Remove duplicate resolveMember, fix type substitution for subtype of generic class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | frog/type.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 /** 4 /**
5 * Generates a dynamic call stub for a function. 5 * Generates a dynamic call stub for a function.
6 * Our goal is to create a stub method like this on-the-fly: 6 * Our goal is to create a stub method like this on-the-fly:
7 * function($0, $1, capture) { this($0, $1, true, capture); } 7 * function($0, $1, capture) { this($0, $1, true, capture); }
8 * 8 *
9 * This stub then replaces the dynamic one on Function, with one that is 9 * This stub then replaces the dynamic one on Function, with one that is
10 * specialized for that particular function, taking into account its default 10 * specialized for that particular function, taking into account its default
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 } 2194 }
2195 return this; 2195 return this;
2196 } 2196 }
2197 StringBufferImpl.prototype.clear = function() { 2197 StringBufferImpl.prototype.clear = function() {
2198 this._buffer = new ListFactory(); 2198 this._buffer = new ListFactory();
2199 this._length = 0; 2199 this._length = 0;
2200 return this; 2200 return this;
2201 } 2201 }
2202 StringBufferImpl.prototype.toString = function() { 2202 StringBufferImpl.prototype.toString = function() {
2203 if (this._buffer.length == 0) return ""; 2203 if (this._buffer.length == 0) return "";
2204 if ($notnull_bool($eq(this._buffer.length, 1))) return $assert_String(this._bu ffer.$index(0)); 2204 if (this._buffer.length == 1) return $assert_String(this._buffer.$index(0));
2205 var result = StringBase.concatAll(this._buffer); 2205 var result = StringBase.concatAll(this._buffer);
2206 this._buffer.clear(); 2206 this._buffer.clear();
2207 this._buffer.add(result); 2207 this._buffer.add(result);
2208 return result; 2208 return result;
2209 } 2209 }
2210 StringBufferImpl.prototype.add$1 = StringBufferImpl.prototype.add; 2210 StringBufferImpl.prototype.add$1 = StringBufferImpl.prototype.add;
2211 StringBufferImpl.prototype.addAll$1 = function($0) { 2211 StringBufferImpl.prototype.addAll$1 = function($0) {
2212 return this.addAll(($0 && $0.is$Collection$Object())); 2212 return this.addAll(($0 && $0.is$Collection$Object()));
2213 }; 2213 };
2214 StringBufferImpl.prototype.isEmpty$0 = function() { 2214 StringBufferImpl.prototype.isEmpty$0 = function() {
2215 return this.isEmpty(); 2215 return this.isEmpty();
2216 }; 2216 };
2217 StringBufferImpl.prototype.toString$0 = function() { 2217 StringBufferImpl.prototype.toString$0 = function() {
2218 return this.toString(); 2218 return this.toString();
2219 }; 2219 };
2220 // ********** Code for StringBase ************** 2220 // ********** Code for StringBase **************
2221 function StringBase() {} 2221 function StringBase() {}
2222 StringBase.createFromCharCodes = function(charCodes) { 2222 StringBase.createFromCharCodes = function(charCodes) {
2223 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { 2223 if (Object.getPrototypeOf(charCodes) !== Array.prototype) {
2224 var length = charCodes.length; 2224 var length = charCodes.length;
2225 var tmp = new Array(length); 2225 var tmp = new Array(length);
2226 for (var i = 0; i < length; i++) { 2226 for (var i = 0; i < length; i++) {
2227 tmp[i] = charCodes.$index(i); 2227 tmp[i] = charCodes.$index(i);
2228 } 2228 }
2229 charCodes = tmp; 2229 charCodes = tmp;
2230 } 2230 }
2231 return String.fromCharCode.apply(null, charCodes); 2231 return String.fromCharCode.apply(null, charCodes);
2232 } 2232 }
2233 StringBase.join = function(strings, separator) { 2233 StringBase.join = function(strings, separator) {
2234 if ($notnull_bool($eq(strings.length, 0))) return ''; 2234 if (strings.length == 0) return '';
2235 var s = $assert_String(strings.$index(0)); 2235 var s = $assert_String(strings.$index(0));
2236 for (var i = 1; 2236 for (var i = 1;
2237 i < $assert_num(strings.length); i++) { 2237 i < strings.length; i++) {
2238 s = s + separator + strings.$index(i); 2238 s = s + separator + strings.$index(i);
2239 } 2239 }
2240 return s; 2240 return s;
2241 } 2241 }
2242 StringBase.concatAll = function(strings) { 2242 StringBase.concatAll = function(strings) {
2243 return StringBase.join(strings, ""); 2243 return StringBase.join(strings, "");
2244 } 2244 }
2245 // ********** Code for StringImplementation ************** 2245 // ********** Code for StringImplementation **************
2246 StringImplementation = String; 2246 StringImplementation = String;
2247 StringImplementation.prototype.is$Pattern = function(){return this;}; 2247 StringImplementation.prototype.is$Pattern = function(){return this;};
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 // ********** Code for AbstractLink$T ************** 2608 // ********** Code for AbstractLink$T **************
2609 function AbstractLink$T() { 2609 function AbstractLink$T() {
2610 // Initializers done 2610 // Initializers done
2611 } 2611 }
2612 $inherits(AbstractLink$T, AbstractLink); 2612 $inherits(AbstractLink$T, AbstractLink);
2613 AbstractLink$T.prototype.is$Link$Element = function(){return this;}; 2613 AbstractLink$T.prototype.is$Link$Element = function(){return this;};
2614 AbstractLink$T.prototype.is$Link$Node = function(){return this;}; 2614 AbstractLink$T.prototype.is$Link$Node = function(){return this;};
2615 AbstractLink$T.prototype.is$Link$Token = function(){return this;}; 2615 AbstractLink$T.prototype.is$Link$Token = function(){return this;};
2616 AbstractLink$T.prototype.is$Link$Type = function(){return this;}; 2616 AbstractLink$T.prototype.is$Link$Type = function(){return this;};
2617 AbstractLink$T.prototype.is$Iterable = function(){return this;}; 2617 AbstractLink$T.prototype.is$Iterable = function(){return this;};
2618 AbstractLink$T.prototype.prepend = function(element) {
2619 return new LinkEntry$T(element, this);
2620 }
2618 AbstractLink$T.prototype.iterator = function() { 2621 AbstractLink$T.prototype.iterator = function() {
2619 var $0; 2622 var $0;
2620 return (($0 = this.toList().iterator$0()) && $0.is$Iterator$T()); 2623 return (($0 = this.toList().iterator$0()) && $0.is$Iterator$T());
2621 } 2624 }
2625 AbstractLink$T.prototype.printOn = function(buffer, separatedBy) {
2626 if ($notnull_bool(this.isEmpty())) return;
2627 buffer.add(this.get$head() == null ? 'null' : this.get$head());
2628 if (separatedBy == null) separatedBy = '';
2629 for (var link = this.get$tail();
2630 !$notnull_bool(link.isEmpty()); link = link.get$tail()) {
2631 buffer.add(separatedBy);
2632 buffer.add(link.get$head() == null ? 'null' : link.get$head());
2633 }
2634 }
2635 AbstractLink$T.prototype.toString = function() {
2636 var buffer = new StringBufferImpl("");
2637 buffer.add('[ ');
2638 this.printOn(buffer, ', ');
2639 buffer.add(' ]');
2640 return buffer.toString();
2641 }
2622 // ********** Code for LinkTail ************** 2642 // ********** Code for LinkTail **************
2623 function LinkTail() { 2643 function LinkTail() {
2624 // Initializers done 2644 // Initializers done
2625 AbstractLink$T.call(this); 2645 AbstractLink$T.call(this);
2626 } 2646 }
2627 $inherits(LinkTail, AbstractLink$T); 2647 $inherits(LinkTail, AbstractLink$T);
2628 LinkTail.prototype.is$Link$Element = function(){return this;}; 2648 LinkTail.prototype.is$Link$Element = function(){return this;};
2629 LinkTail.prototype.is$Link$Node = function(){return this;}; 2649 LinkTail.prototype.is$Link$Node = function(){return this;};
2630 LinkTail.prototype.is$Link$Token = function(){return this;}; 2650 LinkTail.prototype.is$Link$Token = function(){return this;};
2631 LinkTail.prototype.is$Link$Type = function(){return this;}; 2651 LinkTail.prototype.is$Link$Type = function(){return this;};
(...skipping 17315 matching lines...) Expand 10 before | Expand all | Expand 10 after
19947 DeclaredIdentifier.prototype.visit = function(visitor) { 19967 DeclaredIdentifier.prototype.visit = function(visitor) {
19948 return visitor.visitDeclaredIdentifier(this); 19968 return visitor.visitDeclaredIdentifier(this);
19949 } 19969 }
19950 DeclaredIdentifier.prototype.visit$1 = function($0) { 19970 DeclaredIdentifier.prototype.visit$1 = function($0) {
19951 return this.visit(($0 && $0.is$TreeVisitor())); 19971 return this.visit(($0 && $0.is$TreeVisitor()));
19952 }; 19972 };
19953 // ********** Code for lang_Type ************** 19973 // ********** Code for lang_Type **************
19954 function lang_Type(name) { 19974 function lang_Type(name) {
19955 this.name = name; 19975 this.name = name;
19956 this.isTested = false; 19976 this.isTested = false;
19977 this._resolvedMembers = $map([]);
19957 // Initializers done 19978 // Initializers done
19958 } 19979 }
19959 lang_Type.prototype.is$lang_Type = function(){return this;}; 19980 lang_Type.prototype.is$lang_Type = function(){return this;};
19960 lang_Type.prototype.is$Named = function(){return this;}; 19981 lang_Type.prototype.is$Named = function(){return this;};
19961 lang_Type.prototype.get$name = function() { return this.name; }; 19982 lang_Type.prototype.get$name = function() { return this.name; };
19962 lang_Type.prototype.get$isTested = function() { return this.isTested; }; 19983 lang_Type.prototype.get$isTested = function() { return this.isTested; };
19963 lang_Type.prototype.set$isTested = function(value) { return this.isTested = valu e; }; 19984 lang_Type.prototype.set$isTested = function(value) { return this.isTested = valu e; };
19964 lang_Type.prototype.get$typeCheckCode = function() { return this.typeCheckCode; }; 19985 lang_Type.prototype.get$typeCheckCode = function() { return this.typeCheckCode; };
19965 lang_Type.prototype.set$typeCheckCode = function(value) { return this.typeCheckC ode = value; }; 19986 lang_Type.prototype.set$typeCheckCode = function(value) { return this.typeCheckC ode = value; };
19966 lang_Type.prototype.get$varStubs = function() { return this.varStubs; }; 19987 lang_Type.prototype.get$varStubs = function() { return this.varStubs; };
19967 lang_Type.prototype.set$varStubs = function(value) { return this.varStubs = valu e; }; 19988 lang_Type.prototype.set$varStubs = function(value) { return this.varStubs = valu e; };
19968 lang_Type.prototype.markUsed = function() { 19989 lang_Type.prototype.markUsed = function() {
19969 19990
19970 } 19991 }
19971 lang_Type.prototype.get$typeMember = function() { 19992 lang_Type.prototype.get$typeMember = function() {
19972 var $0; 19993 var $0;
19973 if (this._typeMember == null) { 19994 if (this._typeMember == null) {
19974 this._typeMember = new TypeMember((this && this.is$DefinedType())); 19995 this._typeMember = new TypeMember((this && this.is$DefinedType()));
19975 } 19996 }
19976 return (($0 = this._typeMember) && $0.is$TypeMember()); 19997 return (($0 = this._typeMember) && $0.is$TypeMember());
19977 } 19998 }
19978 lang_Type.prototype.getMember = function(name) { 19999 lang_Type.prototype.getMember = function(name) {
19979 return null; 20000 return null;
19980 } 20001 }
20002 lang_Type.prototype.get$subtypes = function() {
20003 return null;
20004 }
19981 lang_Type.prototype.get$isVar = function() { 20005 lang_Type.prototype.get$isVar = function() {
19982 return false; 20006 return false;
19983 } 20007 }
19984 lang_Type.prototype.get$isTop = function() { 20008 lang_Type.prototype.get$isTop = function() {
19985 return false; 20009 return false;
19986 } 20010 }
19987 lang_Type.prototype.get$isObject = function() { 20011 lang_Type.prototype.get$isObject = function() {
19988 return false; 20012 return false;
19989 } 20013 }
19990 lang_Type.prototype.get$isString = function() { 20014 lang_Type.prototype.get$isString = function() {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
20117 return (ret && ret.is$Member()); 20141 return (ret && ret.is$Member());
20118 } 20142 }
20119 } 20143 }
20120 return null; 20144 return null;
20121 } 20145 }
20122 else { 20146 else {
20123 return $globals.world.objectType.getMember(memberName); 20147 return $globals.world.objectType.getMember(memberName);
20124 } 20148 }
20125 } 20149 }
20126 } 20150 }
20151 lang_Type.prototype.resolveMember = function(memberName) {
20152 var $0;
20153 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( ));
20154 if (ret != null) return ret;
20155 var member = this.getMember(memberName);
20156 if (member == null) {
20157 return null;
20158 }
20159 ret = new MemberSet(member, false);
20160 this._resolvedMembers.$setindex(memberName, ret);
20161 if ($notnull_bool(member.get$isStatic())) {
20162 return ret;
20163 }
20164 else {
20165 var $list = this.get$subtypes();
20166 for (var $i = this.get$subtypes().iterator(); $i.hasNext$0(); ) {
20167 var t = $i.next$0();
20168 if (!$notnull_bool(this.get$isClass()) && $notnull_bool(t.get$isClass())) {
20169 var m = t.getMember$1(memberName);
20170 if ($notnull_bool($ne(m, null)) && ret.members.indexOf(m) == -1) {
20171 ret.add((m && m.is$Member()));
20172 }
20173 }
20174 else {
20175 var m = t.get$members().$index(memberName);
20176 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member()));
20177 }
20178 }
20179 return ret;
20180 }
20181 }
20127 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) { 20182 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) {
20128 if (!$notnull_bool(this.isSubtypeOf(other))) { 20183 if (!$notnull_bool(this.isSubtypeOf(other))) {
20129 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name); 20184 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name);
20130 if ($notnull_bool(typeErrors)) { 20185 if ($notnull_bool(typeErrors)) {
20131 $globals.world.error($assert_String(msg), span); 20186 $globals.world.error($assert_String(msg), span);
20132 } 20187 }
20133 else { 20188 else {
20134 $globals.world.warning($assert_String(msg), span); 20189 $globals.world.warning($assert_String(msg), span);
20135 } 20190 }
20136 } 20191 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
20536 if (this._interfaces == null && this.genericType.interfaces != null) { 20591 if (this._interfaces == null && this.genericType.interfaces != null) {
20537 this._interfaces = []; 20592 this._interfaces = [];
20538 var $list = this.genericType.interfaces; 20593 var $list = this.genericType.interfaces;
20539 for (var $i = 0;$i < $list.length; $i++) { 20594 for (var $i = 0;$i < $list.length; $i++) {
20540 var i = $list.$index($i); 20595 var i = $list.$index($i);
20541 this._interfaces.add(i.resolveTypeParams$1(this)); 20596 this._interfaces.add(i.resolveTypeParams$1(this));
20542 } 20597 }
20543 } 20598 }
20544 return this._interfaces; 20599 return this._interfaces;
20545 } 20600 }
20601 ConcreteType.prototype.get$subtypes = function() {
20602 if (this._subtypes == null) {
20603 this._subtypes = new HashSetImplementation();
20604 var $list = this.genericType.get$subtypes();
20605 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext$0(); ) {
20606 var s = $i.next$0();
20607 this._subtypes.add(s.resolveTypeParams$1(this));
20608 }
20609 }
20610 return this._subtypes;
20611 }
20546 ConcreteType.prototype.getCallMethod = function() { 20612 ConcreteType.prototype.getCallMethod = function() {
20547 return this.genericType.getCallMethod(); 20613 return this.genericType.getCallMethod();
20548 } 20614 }
20549 ConcreteType.prototype.getAllMembers = function() { 20615 ConcreteType.prototype.getAllMembers = function() {
20550 var result = this.genericType.getAllMembers(); 20616 var result = this.genericType.getAllMembers();
20551 var $list = result.getKeys$0(); 20617 var $list = result.getKeys$0();
20552 for (var $i = result.getKeys$0().iterator$0(); $i.hasNext$0(); ) { 20618 for (var $i = result.getKeys$0().iterator$0(); $i.hasNext$0(); ) {
20553 var memberName = $i.next$0(); 20619 var memberName = $i.next$0();
20554 var myMember = this.members.$index(memberName); 20620 var myMember = this.members.$index(memberName);
20555 if ($notnull_bool($ne(myMember, null))) { 20621 if ($notnull_bool($ne(myMember, null))) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
20599 return member; 20665 return member;
20600 } 20666 }
20601 var genericMember = this.genericType.members.$index(memberName); 20667 var genericMember = this.genericType.members.$index(memberName);
20602 if ($notnull_bool($ne(genericMember, null))) { 20668 if ($notnull_bool($ne(genericMember, null))) {
20603 member = new ConcreteMember($assert_String(genericMember.get$name()), this, genericMember); 20669 member = new ConcreteMember($assert_String(genericMember.get$name()), this, genericMember);
20604 this.members.$setindex(memberName, member); 20670 this.members.$setindex(memberName, member);
20605 return member; 20671 return member;
20606 } 20672 }
20607 return this._getMemberInParents(memberName); 20673 return this._getMemberInParents(memberName);
20608 } 20674 }
20609 ConcreteType.prototype.resolveMember = function(memberName) {
20610 var mem = this.getMember(memberName);
20611 if ($notnull_bool(mem == null)) return null;
20612 var ret = new MemberSet((mem && mem.is$Member()), false);
20613 if ($notnull_bool(mem.get$isStatic())) return (ret && ret.is$MemberSet());
20614 var $list = this.genericType.get$subtypes();
20615 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext$0(); ) {
20616 var t = $i.next$0();
20617 var m = t.get$members().$index(memberName);
20618 if ($notnull_bool($ne(m, null))) ret.add$1(m);
20619 }
20620 return (ret && ret.is$MemberSet());
20621 }
20622 ConcreteType.prototype.resolveType = function(node, isRequired) { 20675 ConcreteType.prototype.resolveType = function(node, isRequired) {
20623 var ret = this.genericType.resolveType(node, isRequired); 20676 var ret = this.genericType.resolveType(node, isRequired);
20624 return (ret && ret.is$lang_Type()); 20677 return (ret && ret.is$lang_Type());
20625 } 20678 }
20626 ConcreteType.prototype.addDirectSubtype = function(type) { 20679 ConcreteType.prototype.addDirectSubtype = function(type) {
20627 this.genericType.addDirectSubtype(type); 20680 this.genericType.addDirectSubtype(type);
20628 } 20681 }
20629 ConcreteType.prototype.addDirectSubtype$1 = function($0) { 20682 ConcreteType.prototype.addDirectSubtype$1 = function($0) {
20630 return this.addDirectSubtype(($0 && $0.is$lang_Type())); 20683 return this.addDirectSubtype(($0 && $0.is$lang_Type()));
20631 }; 20684 };
20632 ConcreteType.prototype.getConstructor$1 = function($0) { 20685 ConcreteType.prototype.getConstructor$1 = function($0) {
20633 return this.getConstructor($assert_String($0)); 20686 return this.getConstructor($assert_String($0));
20634 }; 20687 };
20635 ConcreteType.prototype.getFactory$2 = function($0, $1) { 20688 ConcreteType.prototype.getFactory$2 = function($0, $1) {
20636 return this.getFactory(($0 && $0.is$lang_Type()), $assert_String($1)); 20689 return this.getFactory(($0 && $0.is$lang_Type()), $assert_String($1));
20637 }; 20690 };
20638 ConcreteType.prototype.getMember$1 = function($0) { 20691 ConcreteType.prototype.getMember$1 = function($0) {
20639 return this.getMember($assert_String($0)); 20692 return this.getMember($assert_String($0));
20640 }; 20693 };
20641 ConcreteType.prototype.getOrMakeConcreteType$1 = function($0) { 20694 ConcreteType.prototype.getOrMakeConcreteType$1 = function($0) {
20642 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); 20695 return this.getOrMakeConcreteType(($0 && $0.is$List$Type()));
20643 }; 20696 };
20644 ConcreteType.prototype.markUsed$0 = function() { 20697 ConcreteType.prototype.markUsed$0 = function() {
20645 return this.markUsed(); 20698 return this.markUsed();
20646 }; 20699 };
20647 ConcreteType.prototype.resolveMember$1 = function($0) {
20648 return this.resolveMember($assert_String($0));
20649 };
20650 ConcreteType.prototype.resolveTypeParams$1 = function($0) { 20700 ConcreteType.prototype.resolveTypeParams$1 = function($0) {
20651 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 20701 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
20652 }; 20702 };
20653 // ********** Code for DefinedType ************** 20703 // ********** Code for DefinedType **************
20654 function DefinedType(name, library, definition, isClass) { 20704 function DefinedType(name, library, definition, isClass) {
20655 this.isUsed = false 20705 this.isUsed = false
20656 this.isNativeType = false 20706 this.isNativeType = false
20657 this.library = library; 20707 this.library = library;
20658 this.isClass = isClass; 20708 this.isClass = isClass;
20659 this.directSubtypes = new HashSetImplementation(); 20709 this.directSubtypes = new HashSetImplementation();
20660 this.constructors = $map([]); 20710 this.constructors = $map([]);
20661 this.members = $map([]); 20711 this.members = $map([]);
20662 this.factories = new FactoryMap(); 20712 this.factories = new FactoryMap();
20663 this._resolvedMembers = $map([]);
20664 // Initializers done 20713 // Initializers done
20665 lang_Type.call(this, name); 20714 lang_Type.call(this, name);
20666 this.setDefinition(definition); 20715 this.setDefinition(definition);
20667 } 20716 }
20668 $inherits(DefinedType, lang_Type); 20717 $inherits(DefinedType, lang_Type);
20669 DefinedType.prototype.is$DefinedType = function(){return this;}; 20718 DefinedType.prototype.is$DefinedType = function(){return this;};
20670 DefinedType.prototype.get$definition = function() { return this.definition; }; 20719 DefinedType.prototype.get$definition = function() { return this.definition; };
20671 DefinedType.prototype.set$definition = function(value) { return this.definition = value; }; 20720 DefinedType.prototype.set$definition = function(value) { return this.definition = value; };
20672 DefinedType.prototype.get$library = function() { return this.library; }; 20721 DefinedType.prototype.get$library = function() { return this.library; };
20673 DefinedType.prototype.get$isClass = function() { return this.isClass; }; 20722 DefinedType.prototype.get$isClass = function() { return this.isClass; };
(...skipping 11 matching lines...) Expand all
20685 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; }; 20734 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; };
20686 DefinedType.prototype.get$members = function() { return this.members; }; 20735 DefinedType.prototype.get$members = function() { return this.members; };
20687 DefinedType.prototype.set$members = function(value) { return this.members = valu e; }; 20736 DefinedType.prototype.set$members = function(value) { return this.members = valu e; };
20688 DefinedType.prototype.get$factories = function() { return this.factories; }; 20737 DefinedType.prototype.get$factories = function() { return this.factories; };
20689 DefinedType.prototype.set$factories = function(value) { return this.factories = value; }; 20738 DefinedType.prototype.set$factories = function(value) { return this.factories = value; };
20690 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; 20739 DefinedType.prototype.get$isUsed = function() { return this.isUsed; };
20691 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; }; 20740 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; };
20692 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; }; 20741 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; };
20693 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; }; 20742 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; };
20694 DefinedType.prototype.setDefinition = function(def) { 20743 DefinedType.prototype.setDefinition = function(def) {
20695 $assert(this.definition == null, "definition == null", "type.dart", 703, 12); 20744 $assert(this.definition == null, "definition == null", "type.dart", 733, 12);
20696 this.definition = def; 20745 this.definition = def;
20697 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT ype() != null) { 20746 if ((this.definition instanceof TypeDefinition) && this.definition.get$nativeT ype() != null) {
20698 this.isNativeType = true; 20747 this.isNativeType = true;
20699 } 20748 }
20700 if (this.definition != null && this.definition.get$typeParameters() != null) { 20749 if (this.definition != null && this.definition.get$typeParameters() != null) {
20701 this._concreteTypes = $map([]); 20750 this._concreteTypes = $map([]);
20702 this.typeParameters = []; 20751 this.typeParameters = [];
20703 var $list = this.definition.get$typeParameters(); 20752 var $list = this.definition.get$typeParameters();
20704 for (var $i = 0;$i < $list.length; $i++) { 20753 for (var $i = 0;$i < $list.length; $i++) {
20705 var tp = $list.$index($i); 20754 var tp = $list.$index($i);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
20795 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); 20844 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true);
20796 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this. library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) { 20845 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this. library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) {
20797 $globals.world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', (($0 = type.get$span()) && $0. is$SourceSpan())); 20846 $globals.world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', (($0 = type.get$span()) && $0. is$SourceSpan()));
20798 } 20847 }
20799 resolvedInterface.addDirectSubtype$1(this); 20848 resolvedInterface.addDirectSubtype$1(this);
20800 interfaces.add$1(resolvedInterface); 20849 interfaces.add$1(resolvedInterface);
20801 } 20850 }
20802 return (interfaces && interfaces.is$List$Type()); 20851 return (interfaces && interfaces.is$List$Type());
20803 } 20852 }
20804 DefinedType.prototype.addDirectSubtype = function(type) { 20853 DefinedType.prototype.addDirectSubtype = function(type) {
20805 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 819, 12); 20854 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 849, 12);
20806 this.directSubtypes.add(type); 20855 this.directSubtypes.add(type);
20807 } 20856 }
20808 DefinedType.prototype.get$subtypes = function() { 20857 DefinedType.prototype.get$subtypes = function() {
20809 var $0; 20858 var $0;
20810 if (this._subtypes == null) { 20859 if (this._subtypes == null) {
20811 this._subtypes = new HashSetImplementation(); 20860 this._subtypes = new HashSetImplementation();
20812 var $list = this.directSubtypes; 20861 var $list = this.directSubtypes;
20813 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) { 20862 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) {
20814 var st = $i.next$0(); 20863 var st = $i.next$0();
20815 this._subtypes.add(st); 20864 this._subtypes.add(st);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
21057 return member; 21106 return member;
21058 } 21107 }
21059 if ($notnull_bool(this.get$isTop())) { 21108 if ($notnull_bool(this.get$isTop())) {
21060 var libType = this.library.findTypeByName(memberName); 21109 var libType = this.library.findTypeByName(memberName);
21061 if ($notnull_bool($ne(libType, null))) { 21110 if ($notnull_bool($ne(libType, null))) {
21062 return (($0 = libType.get$typeMember()) && $0.is$Member()); 21111 return (($0 = libType.get$typeMember()) && $0.is$Member());
21063 } 21112 }
21064 } 21113 }
21065 return this._getMemberInParents(memberName); 21114 return this._getMemberInParents(memberName);
21066 } 21115 }
21067 DefinedType.prototype.resolveMember = function(memberName) {
21068 var $0;
21069 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( ));
21070 if (ret != null) return ret;
21071 var member = this.getMember(memberName);
21072 if (member == null) {
21073 return null;
21074 }
21075 ret = new MemberSet(member, false);
21076 this._resolvedMembers.$setindex(memberName, ret);
21077 if ($notnull_bool(member.get$isStatic())) {
21078 return ret;
21079 }
21080 else {
21081 var $list = this.get$subtypes();
21082 for (var $i = this.get$subtypes().iterator(); $i.hasNext$0(); ) {
21083 var t = $i.next$0();
21084 if (!$notnull_bool(this.isClass) && $notnull_bool(t.get$isClass())) {
21085 var m = t.getMember$1(memberName);
21086 if ($notnull_bool($ne(m, null)) && ret.members.indexOf(m) == -1) {
21087 ret.add((m && m.is$Member()));
21088 }
21089 }
21090 else {
21091 var m = t.get$members().$index(memberName);
21092 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member()));
21093 }
21094 }
21095 return ret;
21096 }
21097 }
21098 DefinedType._getDottedName = function(type) { 21116 DefinedType._getDottedName = function(type) {
21099 if (type.names != null) { 21117 if (type.names != null) {
21100 var names = map(type.names, (function (n) { 21118 var names = map(type.names, (function (n) {
21101 return n.get$name(); 21119 return n.get$name();
21102 }) 21120 })
21103 ); 21121 );
21104 return type.name.name + '.' + Strings.join((names && names.is$List$String()) , '.'); 21122 return type.name.name + '.' + Strings.join((names && names.is$List$String()) , '.');
21105 } 21123 }
21106 else { 21124 else {
21107 return type.name.name; 21125 return type.name.name;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
21175 } 21193 }
21176 else { 21194 else {
21177 $globals.world.internalError('unknown type reference', node.span); 21195 $globals.world.internalError('unknown type reference', node.span);
21178 } 21196 }
21179 return node.type; 21197 return node.type;
21180 } 21198 }
21181 DefinedType.prototype.resolveTypeParams = function(inType) { 21199 DefinedType.prototype.resolveTypeParams = function(inType) {
21182 return this; 21200 return this;
21183 } 21201 }
21184 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { 21202 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
21185 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1251, 12); 21203 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1246, 12);
21186 var names = [this.name]; 21204 var names = [this.name];
21187 var typeMap = $map([]); 21205 var typeMap = $map([]);
21188 for (var i = 0; 21206 for (var i = 0;
21189 i < typeArgs.length; i++) { 21207 i < typeArgs.length; i++) {
21190 var paramName = this.typeParameters.$index(i).get$name(); 21208 var paramName = this.typeParameters.$index(i).get$name();
21191 typeMap.$setindex(paramName, typeArgs.$index(i)); 21209 typeMap.$setindex(paramName, typeArgs.$index(i));
21192 names.add$1(typeArgs.$index(i).get$name()); 21210 names.add$1(typeArgs.$index(i).get$name());
21193 } 21211 }
21194 var concreteName = Strings.join((names && names.is$List$String()), '\$'); 21212 var concreteName = Strings.join((names && names.is$List$String()), '\$');
21195 var ret = this._concreteTypes.$index(concreteName); 21213 var ret = this._concreteTypes.$index(concreteName);
21196 if ($notnull_bool(ret == null)) { 21214 if ($notnull_bool(ret == null)) {
21197 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs ); 21215 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs );
21198 this._concreteTypes.$setindex(concreteName, ret); 21216 this._concreteTypes.$setindex(concreteName, ret);
21199 } 21217 }
21200 return (ret && ret.is$lang_Type()); 21218 return (ret && ret.is$lang_Type());
21201 } 21219 }
21202 DefinedType.prototype.getCallStub = function(args) { 21220 DefinedType.prototype.getCallStub = function(args) {
21203 $assert(this.get$isFunction(), "isFunction", "type.dart", 1271, 12); 21221 $assert(this.get$isFunction(), "isFunction", "type.dart", 1266, 12);
21204 var name = _getCallStubName('call', args); 21222 var name = _getCallStubName('call', args);
21205 if (this.varStubs == null) this.varStubs = $map([]); 21223 if (this.varStubs == null) this.varStubs = $map([]);
21206 var stub = this.varStubs.$index(name); 21224 var stub = this.varStubs.$index(name);
21207 if ($notnull_bool(stub == null)) { 21225 if ($notnull_bool(stub == null)) {
21208 stub = new VarFunctionStub($assert_String(name), args); 21226 stub = new VarFunctionStub($assert_String(name), args);
21209 this.varStubs.$setindex(name, stub); 21227 this.varStubs.$setindex(name, stub);
21210 } 21228 }
21211 return (stub && stub.is$VarFunctionStub()); 21229 return (stub && stub.is$VarFunctionStub());
21212 } 21230 }
21213 DefinedType.prototype.addDirectSubtype$1 = function($0) { 21231 DefinedType.prototype.addDirectSubtype$1 = function($0) {
(...skipping 13 matching lines...) Expand all
21227 }; 21245 };
21228 DefinedType.prototype.getOrMakeConcreteType$1 = function($0) { 21246 DefinedType.prototype.getOrMakeConcreteType$1 = function($0) {
21229 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); 21247 return this.getOrMakeConcreteType(($0 && $0.is$List$Type()));
21230 }; 21248 };
21231 DefinedType.prototype.markUsed$0 = function() { 21249 DefinedType.prototype.markUsed$0 = function() {
21232 return this.markUsed(); 21250 return this.markUsed();
21233 }; 21251 };
21234 DefinedType.prototype.resolve$0 = function() { 21252 DefinedType.prototype.resolve$0 = function() {
21235 return this.resolve(); 21253 return this.resolve();
21236 }; 21254 };
21237 DefinedType.prototype.resolveMember$1 = function($0) {
21238 return this.resolveMember($assert_String($0));
21239 };
21240 DefinedType.prototype.resolveTypeParams$1 = function($0) { 21255 DefinedType.prototype.resolveTypeParams$1 = function($0) {
21241 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 21256 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
21242 }; 21257 };
21243 DefinedType.prototype.setDefinition$1 = function($0) { 21258 DefinedType.prototype.setDefinition$1 = function($0) {
21244 return this.setDefinition(($0 && $0.is$Definition())); 21259 return this.setDefinition(($0 && $0.is$Definition()));
21245 }; 21260 };
21246 // ********** Code for FixedCollection ************** 21261 // ********** Code for FixedCollection **************
21247 function FixedCollection(value, length) { 21262 function FixedCollection(value, length) {
21248 this.value = value; 21263 this.value = value;
21249 this.length = length; 21264 this.length = length;
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
23006 NATIVE, 23021 NATIVE,
23007 NEGATE, 23022 NEGATE,
23008 OPERATOR, 23023 OPERATOR,
23009 SET, 23024 SET,
23010 SOURCE, 23025 SOURCE,
23011 STATIC, 23026 STATIC,
23012 TYPEDEF ]*/; 23027 TYPEDEF ]*/;
23013 var $globals = {}; 23028 var $globals = {};
23014 $static_init(); 23029 $static_init();
23015 main(); 23030 main();
OLDNEW
« no previous file with comments | « no previous file | frog/type.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698