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

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: merged Created 9 years, 1 month 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') | frog/type.dart » ('J')
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 20859 matching lines...) Expand 10 before | Expand all | Expand 10 after
20870 DeclaredIdentifier.prototype.visit = function(visitor) { 20870 DeclaredIdentifier.prototype.visit = function(visitor) {
20871 return visitor.visitDeclaredIdentifier(this); 20871 return visitor.visitDeclaredIdentifier(this);
20872 } 20872 }
20873 DeclaredIdentifier.prototype.visit$1 = function($0) { 20873 DeclaredIdentifier.prototype.visit$1 = function($0) {
20874 return this.visit(($0 && $0.is$TreeVisitor())); 20874 return this.visit(($0 && $0.is$TreeVisitor()));
20875 }; 20875 };
20876 // ********** Code for lang_Type ************** 20876 // ********** Code for lang_Type **************
20877 function lang_Type(name) { 20877 function lang_Type(name) {
20878 this.name = name; 20878 this.name = name;
20879 this.isTested = false; 20879 this.isTested = false;
20880 this._resolvedMembers = $map([]);
20880 // Initializers done 20881 // Initializers done
20881 } 20882 }
20882 lang_Type.prototype.is$lang_Type = function(){return this;}; 20883 lang_Type.prototype.is$lang_Type = function(){return this;};
20883 lang_Type.prototype.is$Named = function(){return this;}; 20884 lang_Type.prototype.is$Named = function(){return this;};
20884 lang_Type.prototype.get$name = function() { return this.name; }; 20885 lang_Type.prototype.get$name = function() { return this.name; };
20885 lang_Type.prototype.get$isTested = function() { return this.isTested; }; 20886 lang_Type.prototype.get$isTested = function() { return this.isTested; };
20886 lang_Type.prototype.set$isTested = function(value) { return this.isTested = valu e; }; 20887 lang_Type.prototype.set$isTested = function(value) { return this.isTested = valu e; };
20887 lang_Type.prototype.get$typeCheckCode = function() { return this.typeCheckCode; }; 20888 lang_Type.prototype.get$typeCheckCode = function() { return this.typeCheckCode; };
20888 lang_Type.prototype.set$typeCheckCode = function(value) { return this.typeCheckC ode = value; }; 20889 lang_Type.prototype.set$typeCheckCode = function(value) { return this.typeCheckC ode = value; };
20889 lang_Type.prototype.get$varStubs = function() { return this.varStubs; }; 20890 lang_Type.prototype.get$varStubs = function() { return this.varStubs; };
20890 lang_Type.prototype.set$varStubs = function(value) { return this.varStubs = valu e; }; 20891 lang_Type.prototype.set$varStubs = function(value) { return this.varStubs = valu e; };
20891 lang_Type.prototype.markUsed = function() { 20892 lang_Type.prototype.markUsed = function() {
20892 20893
20893 } 20894 }
20894 lang_Type.prototype.get$typeMember = function() { 20895 lang_Type.prototype.get$typeMember = function() {
20895 var $0; 20896 var $0;
20896 if (this._typeMember == null) { 20897 if (this._typeMember == null) {
20897 this._typeMember = new TypeMember((this && this.is$DefinedType())); 20898 this._typeMember = new TypeMember((this && this.is$DefinedType()));
20898 } 20899 }
20899 return (($0 = this._typeMember) && $0.is$TypeMember()); 20900 return (($0 = this._typeMember) && $0.is$TypeMember());
20900 } 20901 }
20901 lang_Type.prototype.getMember = function(name) { 20902 lang_Type.prototype.getMember = function(name) {
20902 return null; 20903 return null;
20903 } 20904 }
20905 lang_Type.prototype.get$subtypes = function() {
20906 return null;
20907 }
20904 lang_Type.prototype.get$isVar = function() { 20908 lang_Type.prototype.get$isVar = function() {
20905 return false; 20909 return false;
20906 } 20910 }
20907 lang_Type.prototype.get$isTop = function() { 20911 lang_Type.prototype.get$isTop = function() {
20908 return false; 20912 return false;
20909 } 20913 }
20910 lang_Type.prototype.get$isObject = function() { 20914 lang_Type.prototype.get$isObject = function() {
20911 return false; 20915 return false;
20912 } 20916 }
20913 lang_Type.prototype.get$isString = function() { 20917 lang_Type.prototype.get$isString = function() {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
21043 return (ret && ret.is$Member()); 21047 return (ret && ret.is$Member());
21044 } 21048 }
21045 } 21049 }
21046 return null; 21050 return null;
21047 } 21051 }
21048 else { 21052 else {
21049 return $globals.world.objectType.getMember(memberName); 21053 return $globals.world.objectType.getMember(memberName);
21050 } 21054 }
21051 } 21055 }
21052 } 21056 }
21057 lang_Type.prototype.resolveMember = function(memberName) {
21058 var $0;
21059 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( ));
21060 if (ret != null) return ret;
21061 var member = this.getMember(memberName);
21062 if (member == null) {
21063 return null;
21064 }
21065 ret = new MemberSet(member, false);
21066 this._resolvedMembers.$setindex(memberName, ret);
21067 if ($notnull_bool(member.get$isStatic())) {
21068 return ret;
21069 }
21070 else {
21071 var $list = this.get$subtypes();
21072 for (var $i = this.get$subtypes().iterator(); $i.hasNext$0(); ) {
21073 var t = $i.next$0();
21074 if (!$notnull_bool(this.get$isClass()) && $notnull_bool(t.get$isClass())) {
21075 var m = t.getMember$1(memberName);
21076 if ($notnull_bool($ne(m, null)) && ret.members.indexOf(m) == -1) {
21077 ret.add((m && m.is$Member()));
21078 }
21079 }
21080 else {
21081 var m = t.get$members().$index(memberName);
21082 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member()));
21083 }
21084 }
21085 return ret;
21086 }
21087 }
21053 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) { 21088 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) {
21054 if (!$notnull_bool(this.isSubtypeOf(other))) { 21089 if (!$notnull_bool(this.isSubtypeOf(other))) {
21055 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name); 21090 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name);
21056 if ($notnull_bool(typeErrors)) { 21091 if ($notnull_bool(typeErrors)) {
21057 $globals.world.error($assert_String(msg), span); 21092 $globals.world.error($assert_String(msg), span);
21058 } 21093 }
21059 else { 21094 else {
21060 $globals.world.warning($assert_String(msg), span); 21095 $globals.world.warning($assert_String(msg), span);
21061 } 21096 }
21062 } 21097 }
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
21396 NonNullableType.prototype.resolveTypeParams$1 = function($0) { 21431 NonNullableType.prototype.resolveTypeParams$1 = function($0) {
21397 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 21432 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
21398 }; 21433 };
21399 // ********** Code for ConcreteType ************** 21434 // ********** Code for ConcreteType **************
21400 function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) { 21435 function ConcreteType(name, genericType, typeArguments, typeArgsInOrder) {
21401 this.genericType = genericType; 21436 this.genericType = genericType;
21402 this.typeArguments = typeArguments; 21437 this.typeArguments = typeArguments;
21403 this.typeArgsInOrder = typeArgsInOrder; 21438 this.typeArgsInOrder = typeArgsInOrder;
21404 this.constructors = $map([]); 21439 this.constructors = $map([]);
21405 this.members = $map([]); 21440 this.members = $map([]);
21406 this._resolvedMembers = $map([]);
21407 this.factories = new FactoryMap(); 21441 this.factories = new FactoryMap();
21408 // Initializers done 21442 // Initializers done
21409 lang_Type.call(this, name); 21443 lang_Type.call(this, name);
21410 } 21444 }
21411 $inherits(ConcreteType, lang_Type); 21445 $inherits(ConcreteType, lang_Type);
21412 ConcreteType.prototype.is$ConcreteType = function(){return this;}; 21446 ConcreteType.prototype.is$ConcreteType = function(){return this;};
21413 ConcreteType.prototype.get$genericType = function() { return this.genericType; } ; 21447 ConcreteType.prototype.get$genericType = function() { return this.genericType; } ;
21414 ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsIn Order; }; 21448 ConcreteType.prototype.get$typeArgsInOrder = function() { return this.typeArgsIn Order; };
21415 ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeA rgsInOrder = value; }; 21449 ConcreteType.prototype.set$typeArgsInOrder = function(value) { return this.typeA rgsInOrder = value; };
21416 ConcreteType.prototype.get$isList = function() { 21450 ConcreteType.prototype.get$isList = function() {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
21463 if (this._interfaces == null && this.genericType.interfaces != null) { 21497 if (this._interfaces == null && this.genericType.interfaces != null) {
21464 this._interfaces = []; 21498 this._interfaces = [];
21465 var $list = this.genericType.interfaces; 21499 var $list = this.genericType.interfaces;
21466 for (var $i = 0;$i < $list.length; $i++) { 21500 for (var $i = 0;$i < $list.length; $i++) {
21467 var i = $list.$index($i); 21501 var i = $list.$index($i);
21468 this._interfaces.add(i.resolveTypeParams$1(this)); 21502 this._interfaces.add(i.resolveTypeParams$1(this));
21469 } 21503 }
21470 } 21504 }
21471 return this._interfaces; 21505 return this._interfaces;
21472 } 21506 }
21507 ConcreteType.prototype.get$subtypes = function() {
21508 if (this._subtypes == null) {
21509 this._subtypes = new HashSetImplementation();
21510 var $list = this.genericType.get$subtypes();
21511 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext$0(); ) {
21512 var s = $i.next$0();
21513 this._subtypes.add(s.resolveTypeParams$1(this));
21514 }
21515 }
21516 return this._subtypes;
21517 }
21473 ConcreteType.prototype.getCallMethod = function() { 21518 ConcreteType.prototype.getCallMethod = function() {
21474 return this.genericType.getCallMethod(); 21519 return this.genericType.getCallMethod();
21475 } 21520 }
21476 ConcreteType.prototype.getAllMembers = function() { 21521 ConcreteType.prototype.getAllMembers = function() {
21477 var result = this.genericType.getAllMembers(); 21522 var result = this.genericType.getAllMembers();
21478 var $list = result.getKeys$0(); 21523 var $list = result.getKeys$0();
21479 for (var $i = result.getKeys$0().iterator$0(); $i.hasNext$0(); ) { 21524 for (var $i = result.getKeys$0().iterator$0(); $i.hasNext$0(); ) {
21480 var memberName = $i.next$0(); 21525 var memberName = $i.next$0();
21481 var myMember = this.members.$index(memberName); 21526 var myMember = this.members.$index(memberName);
21482 if ($notnull_bool($ne(myMember, null))) { 21527 if ($notnull_bool($ne(myMember, null))) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
21526 return member; 21571 return member;
21527 } 21572 }
21528 var genericMember = this.genericType.members.$index(memberName); 21573 var genericMember = this.genericType.members.$index(memberName);
21529 if ($notnull_bool($ne(genericMember, null))) { 21574 if ($notnull_bool($ne(genericMember, null))) {
21530 member = new ConcreteMember($assert_String(genericMember.get$name()), this, genericMember); 21575 member = new ConcreteMember($assert_String(genericMember.get$name()), this, genericMember);
21531 this.members.$setindex(memberName, member); 21576 this.members.$setindex(memberName, member);
21532 return member; 21577 return member;
21533 } 21578 }
21534 return this._getMemberInParents(memberName); 21579 return this._getMemberInParents(memberName);
21535 } 21580 }
21536 ConcreteType.prototype.resolveMember = function(memberName) {
21537 var $0;
21538 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( ));
21539 if (ret != null) return ret;
21540 var member = this.getMember(memberName);
21541 if (member == null) {
21542 return null;
21543 }
21544 ret = new MemberSet(member, false);
21545 this._resolvedMembers.$setindex(memberName, ret);
21546 if ($notnull_bool(member.get$isStatic())) {
21547 return ret;
21548 }
21549 else {
21550 var $list = this.genericType.get$subtypes();
21551 for (var $i = this.genericType.get$subtypes().iterator(); $i.hasNext$0(); ) {
21552 var t = $i.next$0();
21553 if (!$notnull_bool(this.get$isClass()) && $notnull_bool(t.get$isClass())) {
21554 var m = t.getMember$1(memberName);
21555 if ($notnull_bool($ne(m, null)) && ret.members.indexOf(m) == -1) {
21556 ret.add((m && m.is$Member()));
21557 }
21558 }
21559 else {
21560 var m = t.get$members().$index(memberName);
21561 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member()));
21562 }
21563 }
21564 return ret;
21565 }
21566 }
21567 ConcreteType.prototype.resolveType = function(node, isRequired) { 21581 ConcreteType.prototype.resolveType = function(node, isRequired) {
21568 var ret = this.genericType.resolveType(node, isRequired); 21582 var ret = this.genericType.resolveType(node, isRequired);
21569 return (ret && ret.is$lang_Type()); 21583 return (ret && ret.is$lang_Type());
21570 } 21584 }
21571 ConcreteType.prototype.addDirectSubtype = function(type) { 21585 ConcreteType.prototype.addDirectSubtype = function(type) {
21572 this.genericType.addDirectSubtype(type); 21586 this.genericType.addDirectSubtype(type);
21573 } 21587 }
21574 ConcreteType.prototype.addDirectSubtype$1 = function($0) { 21588 ConcreteType.prototype.addDirectSubtype$1 = function($0) {
21575 return this.addDirectSubtype(($0 && $0.is$lang_Type())); 21589 return this.addDirectSubtype(($0 && $0.is$lang_Type()));
21576 }; 21590 };
21577 ConcreteType.prototype.getConstructor$1 = function($0) { 21591 ConcreteType.prototype.getConstructor$1 = function($0) {
21578 return this.getConstructor($assert_String($0)); 21592 return this.getConstructor($assert_String($0));
21579 }; 21593 };
21580 ConcreteType.prototype.getFactory$2 = function($0, $1) { 21594 ConcreteType.prototype.getFactory$2 = function($0, $1) {
21581 return this.getFactory(($0 && $0.is$lang_Type()), $assert_String($1)); 21595 return this.getFactory(($0 && $0.is$lang_Type()), $assert_String($1));
21582 }; 21596 };
21583 ConcreteType.prototype.getMember$1 = function($0) { 21597 ConcreteType.prototype.getMember$1 = function($0) {
21584 return this.getMember($assert_String($0)); 21598 return this.getMember($assert_String($0));
21585 }; 21599 };
21586 ConcreteType.prototype.getOrMakeConcreteType$1 = function($0) { 21600 ConcreteType.prototype.getOrMakeConcreteType$1 = function($0) {
21587 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); 21601 return this.getOrMakeConcreteType(($0 && $0.is$List$Type()));
21588 }; 21602 };
21589 ConcreteType.prototype.markUsed$0 = function() { 21603 ConcreteType.prototype.markUsed$0 = function() {
21590 return this.markUsed(); 21604 return this.markUsed();
21591 }; 21605 };
21592 ConcreteType.prototype.resolveMember$1 = function($0) {
21593 return this.resolveMember($assert_String($0));
21594 };
21595 ConcreteType.prototype.resolveTypeParams$1 = function($0) { 21606 ConcreteType.prototype.resolveTypeParams$1 = function($0) {
21596 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 21607 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
21597 }; 21608 };
21598 // ********** Code for DefinedType ************** 21609 // ********** Code for DefinedType **************
21599 function DefinedType(name, library, definition, isClass) { 21610 function DefinedType(name, library, definition, isClass) {
21600 this.isUsed = false 21611 this.isUsed = false
21601 this.isNativeType = false 21612 this.isNativeType = false
21602 this.library = library; 21613 this.library = library;
21603 this.isClass = isClass; 21614 this.isClass = isClass;
21604 this.directSubtypes = new HashSetImplementation(); 21615 this.directSubtypes = new HashSetImplementation();
21605 this.constructors = $map([]); 21616 this.constructors = $map([]);
21606 this.members = $map([]); 21617 this.members = $map([]);
21607 this.factories = new FactoryMap(); 21618 this.factories = new FactoryMap();
21608 this._resolvedMembers = $map([]);
21609 // Initializers done 21619 // Initializers done
21610 lang_Type.call(this, name); 21620 lang_Type.call(this, name);
21611 this.setDefinition(definition); 21621 this.setDefinition(definition);
21612 } 21622 }
21613 $inherits(DefinedType, lang_Type); 21623 $inherits(DefinedType, lang_Type);
21614 DefinedType.prototype.is$DefinedType = function(){return this;}; 21624 DefinedType.prototype.is$DefinedType = function(){return this;};
21615 DefinedType.prototype.get$definition = function() { return this.definition; }; 21625 DefinedType.prototype.get$definition = function() { return this.definition; };
21616 DefinedType.prototype.set$definition = function(value) { return this.definition = value; }; 21626 DefinedType.prototype.set$definition = function(value) { return this.definition = value; };
21617 DefinedType.prototype.get$library = function() { return this.library; }; 21627 DefinedType.prototype.get$library = function() { return this.library; };
21618 DefinedType.prototype.get$isClass = function() { return this.isClass; }; 21628 DefinedType.prototype.get$isClass = function() { return this.isClass; };
(...skipping 11 matching lines...) Expand all
21630 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; }; 21640 DefinedType.prototype.set$constructors = function(value) { return this.construct ors = value; };
21631 DefinedType.prototype.get$members = function() { return this.members; }; 21641 DefinedType.prototype.get$members = function() { return this.members; };
21632 DefinedType.prototype.set$members = function(value) { return this.members = valu e; }; 21642 DefinedType.prototype.set$members = function(value) { return this.members = valu e; };
21633 DefinedType.prototype.get$factories = function() { return this.factories; }; 21643 DefinedType.prototype.get$factories = function() { return this.factories; };
21634 DefinedType.prototype.set$factories = function(value) { return this.factories = value; }; 21644 DefinedType.prototype.set$factories = function(value) { return this.factories = value; };
21635 DefinedType.prototype.get$isUsed = function() { return this.isUsed; }; 21645 DefinedType.prototype.get$isUsed = function() { return this.isUsed; };
21636 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; }; 21646 DefinedType.prototype.set$isUsed = function(value) { return this.isUsed = value; };
21637 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; }; 21647 DefinedType.prototype.get$isNativeType = function() { return this.isNativeType; };
21638 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; }; 21648 DefinedType.prototype.set$isNativeType = function(value) { return this.isNativeT ype = value; };
21639 DefinedType.prototype.setDefinition = function(def) { 21649 DefinedType.prototype.setDefinition = function(def) {
21640 $assert(this.definition == null, "definition == null", "type.dart", 728, 12); 21650 $assert(this.definition == null, "definition == null", "type.dart", 735, 12);
21641 this.definition = def; 21651 this.definition = def;
21642 if ((this.definition instanceof TypeDefinition) && $notnull_bool($ne(this.defi nition.get$nativeType(), null))) { 21652 if ((this.definition instanceof TypeDefinition) && $notnull_bool($ne(this.defi nition.get$nativeType(), null))) {
21643 this.isNativeType = true; 21653 this.isNativeType = true;
21644 } 21654 }
21645 if (this.definition != null && this.definition.get$typeParameters() != null) { 21655 if (this.definition != null && this.definition.get$typeParameters() != null) {
21646 this._concreteTypes = $map([]); 21656 this._concreteTypes = $map([]);
21647 this.typeParameters = []; 21657 this.typeParameters = [];
21648 var $list = this.definition.get$typeParameters(); 21658 var $list = this.definition.get$typeParameters();
21649 for (var $i = 0;$i < $list.length; $i++) { 21659 for (var $i = 0;$i < $list.length; $i++) {
21650 var tp = $list.$index($i); 21660 var tp = $list.$index($i);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
21743 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); 21753 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true);
21744 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this. library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) { 21754 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this. library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) {
21745 $globals.world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', (($0 = type.get$span()) && $0. is$SourceSpan())); 21755 $globals.world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', (($0 = type.get$span()) && $0. is$SourceSpan()));
21746 } 21756 }
21747 resolvedInterface.addDirectSubtype$1(this); 21757 resolvedInterface.addDirectSubtype$1(this);
21748 interfaces.add$1(resolvedInterface); 21758 interfaces.add$1(resolvedInterface);
21749 } 21759 }
21750 return (interfaces && interfaces.is$List$Type()); 21760 return (interfaces && interfaces.is$List$Type());
21751 } 21761 }
21752 DefinedType.prototype.addDirectSubtype = function(type) { 21762 DefinedType.prototype.addDirectSubtype = function(type) {
21753 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 849, 12); 21763 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 856, 12);
21754 this.directSubtypes.add(type); 21764 this.directSubtypes.add(type);
21755 } 21765 }
21756 DefinedType.prototype.get$subtypes = function() { 21766 DefinedType.prototype.get$subtypes = function() {
21757 var $0; 21767 var $0;
21758 if (this._subtypes == null) { 21768 if (this._subtypes == null) {
21759 this._subtypes = new HashSetImplementation(); 21769 this._subtypes = new HashSetImplementation();
21760 var $list = this.directSubtypes; 21770 var $list = this.directSubtypes;
21761 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) { 21771 for (var $i = this.directSubtypes.iterator(); $i.hasNext$0(); ) {
21762 var st = $i.next$0(); 21772 var st = $i.next$0();
21763 this._subtypes.add(st); 21773 this._subtypes.add(st);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
22005 return member; 22015 return member;
22006 } 22016 }
22007 if ($notnull_bool(this.get$isTop())) { 22017 if ($notnull_bool(this.get$isTop())) {
22008 var libType = this.library.findTypeByName(memberName); 22018 var libType = this.library.findTypeByName(memberName);
22009 if ($notnull_bool($ne(libType, null))) { 22019 if ($notnull_bool($ne(libType, null))) {
22010 return (($0 = libType.get$typeMember()) && $0.is$Member()); 22020 return (($0 = libType.get$typeMember()) && $0.is$Member());
22011 } 22021 }
22012 } 22022 }
22013 return this._getMemberInParents(memberName); 22023 return this._getMemberInParents(memberName);
22014 } 22024 }
22015 DefinedType.prototype.resolveMember = function(memberName) {
22016 var $0;
22017 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( ));
22018 if (ret != null) return ret;
22019 var member = this.getMember(memberName);
22020 if (member == null) {
22021 return null;
22022 }
22023 ret = new MemberSet(member, false);
22024 this._resolvedMembers.$setindex(memberName, ret);
22025 if ($notnull_bool(member.get$isStatic())) {
22026 return ret;
22027 }
22028 else {
22029 var $list = this.get$subtypes();
22030 for (var $i = this.get$subtypes().iterator(); $i.hasNext$0(); ) {
22031 var t = $i.next$0();
22032 if (!$notnull_bool(this.isClass) && $notnull_bool(t.get$isClass())) {
22033 var m = t.getMember$1(memberName);
22034 if ($notnull_bool($ne(m, null)) && ret.members.indexOf(m) == -1) {
22035 ret.add((m && m.is$Member()));
22036 }
22037 }
22038 else {
22039 var m = t.get$members().$index(memberName);
22040 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member()));
22041 }
22042 }
22043 return ret;
22044 }
22045 }
22046 DefinedType._getDottedName = function(type) { 22025 DefinedType._getDottedName = function(type) {
22047 if (type.names != null) { 22026 if (type.names != null) {
22048 var names = map(type.names, (function (n) { 22027 var names = map(type.names, (function (n) {
22049 return n.get$name(); 22028 return n.get$name();
22050 }) 22029 })
22051 ); 22030 );
22052 return type.name.name + '.' + Strings.join((names && names.is$List$String()) , '.'); 22031 return type.name.name + '.' + Strings.join((names && names.is$List$String()) , '.');
22053 } 22032 }
22054 else { 22033 else {
22055 return type.name.name; 22034 return type.name.name;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
22123 } 22102 }
22124 else { 22103 else {
22125 $globals.world.internalError('unknown type reference', node.span); 22104 $globals.world.internalError('unknown type reference', node.span);
22126 } 22105 }
22127 return node.type; 22106 return node.type;
22128 } 22107 }
22129 DefinedType.prototype.resolveTypeParams = function(inType) { 22108 DefinedType.prototype.resolveTypeParams = function(inType) {
22130 return this; 22109 return this;
22131 } 22110 }
22132 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { 22111 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
22133 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1281, 12); 22112 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1253, 12);
22134 var names = [this.name]; 22113 var names = [this.name];
22135 var typeMap = $map([]); 22114 var typeMap = $map([]);
22136 for (var i = 0; 22115 for (var i = 0;
22137 i < typeArgs.length; i++) { 22116 i < typeArgs.length; i++) {
22138 var paramName = this.typeParameters.$index(i).get$name(); 22117 var paramName = this.typeParameters.$index(i).get$name();
22139 typeMap.$setindex(paramName, typeArgs.$index(i)); 22118 typeMap.$setindex(paramName, typeArgs.$index(i));
22140 names.add$1(typeArgs.$index(i).get$name()); 22119 names.add$1(typeArgs.$index(i).get$name());
22141 } 22120 }
22142 var concreteName = Strings.join((names && names.is$List$String()), '\$'); 22121 var concreteName = Strings.join((names && names.is$List$String()), '\$');
22143 var ret = this._concreteTypes.$index(concreteName); 22122 var ret = this._concreteTypes.$index(concreteName);
22144 if ($notnull_bool(ret == null)) { 22123 if ($notnull_bool(ret == null)) {
22145 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs ); 22124 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs );
22146 this._concreteTypes.$setindex(concreteName, ret); 22125 this._concreteTypes.$setindex(concreteName, ret);
22147 } 22126 }
22148 return (ret && ret.is$lang_Type()); 22127 return (ret && ret.is$lang_Type());
22149 } 22128 }
22150 DefinedType.prototype.getCallStub = function(args) { 22129 DefinedType.prototype.getCallStub = function(args) {
22151 $assert(this.get$isFunction(), "isFunction", "type.dart", 1301, 12); 22130 $assert(this.get$isFunction(), "isFunction", "type.dart", 1273, 12);
22152 var name = _getCallStubName('call', args); 22131 var name = _getCallStubName('call', args);
22153 if (this.varStubs == null) this.varStubs = $map([]); 22132 if (this.varStubs == null) this.varStubs = $map([]);
22154 var stub = this.varStubs.$index(name); 22133 var stub = this.varStubs.$index(name);
22155 if ($notnull_bool(stub == null)) { 22134 if ($notnull_bool(stub == null)) {
22156 stub = new VarFunctionStub($assert_String(name), args); 22135 stub = new VarFunctionStub($assert_String(name), args);
22157 this.varStubs.$setindex(name, stub); 22136 this.varStubs.$setindex(name, stub);
22158 } 22137 }
22159 return (stub && stub.is$VarFunctionStub()); 22138 return (stub && stub.is$VarFunctionStub());
22160 } 22139 }
22161 DefinedType.prototype.addDirectSubtype$1 = function($0) { 22140 DefinedType.prototype.addDirectSubtype$1 = function($0) {
(...skipping 13 matching lines...) Expand all
22175 }; 22154 };
22176 DefinedType.prototype.getOrMakeConcreteType$1 = function($0) { 22155 DefinedType.prototype.getOrMakeConcreteType$1 = function($0) {
22177 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); 22156 return this.getOrMakeConcreteType(($0 && $0.is$List$Type()));
22178 }; 22157 };
22179 DefinedType.prototype.markUsed$0 = function() { 22158 DefinedType.prototype.markUsed$0 = function() {
22180 return this.markUsed(); 22159 return this.markUsed();
22181 }; 22160 };
22182 DefinedType.prototype.resolve$0 = function() { 22161 DefinedType.prototype.resolve$0 = function() {
22183 return this.resolve(); 22162 return this.resolve();
22184 }; 22163 };
22185 DefinedType.prototype.resolveMember$1 = function($0) {
22186 return this.resolveMember($assert_String($0));
22187 };
22188 DefinedType.prototype.resolveTypeParams$1 = function($0) { 22164 DefinedType.prototype.resolveTypeParams$1 = function($0) {
22189 return this.resolveTypeParams(($0 && $0.is$ConcreteType())); 22165 return this.resolveTypeParams(($0 && $0.is$ConcreteType()));
22190 }; 22166 };
22191 DefinedType.prototype.setDefinition$1 = function($0) { 22167 DefinedType.prototype.setDefinition$1 = function($0) {
22192 return this.setDefinition(($0 && $0.is$Definition())); 22168 return this.setDefinition(($0 && $0.is$Definition()));
22193 }; 22169 };
22194 // ********** Code for NativeType ************** 22170 // ********** Code for NativeType **************
22195 function NativeType(spec) { 22171 function NativeType(spec) {
22196 // Initializers done 22172 // Initializers done
22197 if (spec.startsWith('*')) { 22173 if (spec.startsWith('*')) {
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
24008 NATIVE, 23984 NATIVE,
24009 NEGATE, 23985 NEGATE,
24010 OPERATOR, 23986 OPERATOR,
24011 SET, 23987 SET,
24012 SOURCE, 23988 SOURCE,
24013 STATIC, 23989 STATIC,
24014 TYPEDEF ]*/; 23990 TYPEDEF ]*/;
24015 var $globals = {}; 23991 var $globals = {};
24016 $static_init(); 23992 $static_init();
24017 main(); 23993 main();
OLDNEW
« no previous file with comments | « no previous file | frog/type.dart » ('j') | frog/type.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698