OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class LibraryImport { | 5 class LibraryImport { |
6 String prefix; | 6 String prefix; |
7 Library library; | 7 Library library; |
8 LibraryImport(this.library, [this.prefix = null]); | 8 LibraryImport(this.library, [this.prefix = null]); |
9 } | 9 } |
10 | 10 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 type.resolve(); | 276 type.resolve(); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 visitSources() { | 280 visitSources() { |
281 var visitor = new _LibraryVisitor(this); | 281 var visitor = new _LibraryVisitor(this); |
282 visitor.addSource(baseSource); | 282 visitor.addSource(baseSource); |
283 } | 283 } |
284 | 284 |
285 toString() => baseSource.filename; | 285 toString() => baseSource.filename; |
| 286 |
| 287 int hashCode() => baseSource.filename.hashCode(); |
| 288 |
| 289 bool operator ==(other) => other is Library && |
| 290 other.baseSource.filename == baseSource.filename; |
286 } | 291 } |
287 | 292 |
288 | 293 |
289 class _LibraryVisitor implements TreeVisitor { | 294 class _LibraryVisitor implements TreeVisitor { |
290 final Library library; | 295 final Library library; |
291 DefinedType currentType; | 296 DefinedType currentType; |
292 List<SourceFile> sources; | 297 List<SourceFile> sources; |
293 | 298 |
294 bool seenImport = false; | 299 bool seenImport = false; |
295 bool seenSource = false; | 300 bool seenSource = false; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 485 |
481 void visitFunctionDefinition(FunctionDefinition node) { | 486 void visitFunctionDefinition(FunctionDefinition node) { |
482 currentType.addMethod(node.name.name, node); | 487 currentType.addMethod(node.name.name, node); |
483 } | 488 } |
484 | 489 |
485 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { | 490 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { |
486 var type = library.addType(node.func.name.name, node, false); | 491 var type = library.addType(node.func.name.name, node, false); |
487 type.addMethod(':call', node.func); | 492 type.addMethod(':call', node.func); |
488 } | 493 } |
489 } | 494 } |
OLD | NEW |