| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library fasta.class_builder; | 5 library fasta.class_builder; |
| 6 | 6 |
| 7 import 'builder.dart' show | 7 import 'builder.dart' show |
| 8 Builder, | 8 Builder, |
| 9 ConstructorReferenceBuilder, | 9 ConstructorReferenceBuilder, |
| 10 LibraryBuilder, | 10 LibraryBuilder, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 T supertype; | 24 T supertype; |
| 25 | 25 |
| 26 List<T> interfaces; | 26 List<T> interfaces; |
| 27 | 27 |
| 28 final Map<String, Builder> members; | 28 final Map<String, Builder> members; |
| 29 | 29 |
| 30 ClassBuilder( | 30 ClassBuilder( |
| 31 List<MetadataBuilder> metadata, int modifiers, | 31 List<MetadataBuilder> metadata, int modifiers, |
| 32 String name, this.typeVariables, this.supertype, this.interfaces, | 32 String name, this.typeVariables, this.supertype, this.interfaces, |
| 33 this.members, List<T> types, LibraryBuilder parent) | 33 this.members, List<T> types, LibraryBuilder parent, int charOffset) |
| 34 : super(metadata, modifiers, name, types, parent); | 34 : super(metadata, modifiers, name, types, parent, charOffset); |
| 35 | 35 |
| 36 List<ConstructorReferenceBuilder> get constructorReferences => null; | 36 List<ConstructorReferenceBuilder> get constructorReferences => null; |
| 37 | 37 |
| 38 Map<String, Builder> get constructors; | 38 Map<String, Builder> get constructors; |
| 39 | 39 |
| 40 Map<String, Builder> get membersInScope => members; | 40 Map<String, Builder> get membersInScope => members; |
| 41 | 41 |
| 42 int resolveTypes(LibraryBuilder library) { | 42 int resolveTypes(LibraryBuilder library) { |
| 43 Scope scope; | 43 Scope scope; |
| 44 int count = 0; | 44 int count = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 66 Map<String, Builder> local = <String, Builder>{}; | 66 Map<String, Builder> local = <String, Builder>{}; |
| 67 for (TypeVariableBuilder t in typeVariables) { | 67 for (TypeVariableBuilder t in typeVariables) { |
| 68 local[t.name] = t; | 68 local[t.name] = t; |
| 69 } | 69 } |
| 70 parent = new Scope(local, parent, isModifiable: false); | 70 parent = new Scope(local, parent, isModifiable: false); |
| 71 } | 71 } |
| 72 return new Scope(membersInScope, parent, isModifiable: false); | 72 return new Scope(membersInScope, parent, isModifiable: false); |
| 73 } | 73 } |
| 74 | 74 |
| 75 /// Used to lookup a static member of this class. | 75 /// Used to lookup a static member of this class. |
| 76 Builder findStaticBuilder(String name, {bool isSetter: false}) { | 76 Builder findStaticBuilder(String name, int charOffset, Uri fileUri, |
| 77 {bool isSetter: false}) { |
| 77 Builder builder = members[name]; | 78 Builder builder = members[name]; |
| 78 if (builder?.next != null) { | 79 if (builder?.next != null) { |
| 79 Builder getterBuilder; | 80 Builder getterBuilder; |
| 80 Builder setterBuilder; | 81 Builder setterBuilder; |
| 81 Builder current = builder; | 82 Builder current = builder; |
| 82 while (current != null) { | 83 while (current != null) { |
| 83 if (current.isGetter && getterBuilder == null) { | 84 if (current.isGetter && getterBuilder == null) { |
| 84 getterBuilder = current; | 85 getterBuilder = current; |
| 85 } else if (current.isSetter && setterBuilder == null) { | 86 } else if (current.isSetter && setterBuilder == null) { |
| 86 setterBuilder = current; | 87 setterBuilder = current; |
| 87 } else { | 88 } else { |
| 88 return new AmbiguousBuilder(builder); | 89 return new AmbiguousBuilder(builder, charOffset, fileUri); |
| 89 } | 90 } |
| 90 current = current.next; | 91 current = current.next; |
| 91 } | 92 } |
| 92 builder = isSetter ? setterBuilder : getterBuilder; | 93 builder = isSetter ? setterBuilder : getterBuilder; |
| 93 } | 94 } |
| 94 if (builder == null) { | 95 if (builder == null) { |
| 95 return null; | 96 return null; |
| 96 } else if (isSetter && builder.isGetter) { | 97 } else if (isSetter && builder.isGetter) { |
| 97 return null; | 98 return null; |
| 98 } else { | 99 } else { |
| 99 return builder.isInstanceMember ? null : builder; | 100 return builder.isInstanceMember ? null : builder; |
| 100 } | 101 } |
| 101 } | 102 } |
| 102 | 103 |
| 103 Builder findConstructorOrFactory(String name); | 104 Builder findConstructorOrFactory(String name); |
| 104 } | 105 } |
| OLD | NEW |