| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 final String prefix; | 6 final String prefix; |
| 7 final Library library; | 7 final Library library; |
| 8 final SourceSpan span; | 8 final SourceSpan span; |
| 9 LibraryImport(this.library, [this.prefix, this.span]); | 9 LibraryImport(this.library, [this.prefix, this.span]); |
| 10 } | 10 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 bool get isCore() => this == world.corelib; | 52 bool get isCore() => this == world.corelib; |
| 53 bool get isCoreImpl() => this == world.coreimpl; | 53 bool get isCoreImpl() => this == world.coreimpl; |
| 54 | 54 |
| 55 // TODO(jmesserly): we shouldn't be special casing DOM anywhere. | 55 // TODO(jmesserly): we shouldn't be special casing DOM anywhere. |
| 56 bool get isDom() => this == world.dom; | 56 bool get isDom() => this == world.dom; |
| 57 | 57 |
| 58 SourceSpan get span() => new SourceSpan(baseSource, 0, 0); | 58 SourceSpan get span() => new SourceSpan(baseSource, 0, 0); |
| 59 | 59 |
| 60 String makeFullPath(String filename) { | 60 String makeFullPath(String filename) { |
| 61 if (filename.startsWith('dart:')) return filename; | 61 if (filename.startsWith('dart:')) return filename; |
| 62 if (filename.startsWith('package:')) return filename; |
| 62 // TODO(jmesserly): replace with node.js path.resolve | 63 // TODO(jmesserly): replace with node.js path.resolve |
| 63 if (filename.startsWith('/')) return filename; | 64 if (filename.startsWith('/')) return filename; |
| 64 if (filename.startsWith('file:///')) return filename; | 65 if (filename.startsWith('file:///')) return filename; |
| 65 if (filename.startsWith('http://')) return filename; | 66 if (filename.startsWith('http://')) return filename; |
| 66 if (const RegExp('^[a-zA-Z]:/').hasMatch(filename)) return filename; | 67 if (const RegExp('^[a-zA-Z]:/').hasMatch(filename)) return filename; |
| 67 return joinPaths(sourceDir, filename); | 68 return joinPaths(sourceDir, filename); |
| 68 } | 69 } |
| 69 | 70 |
| 70 /** Adds an import to the library. */ | 71 /** Adds an import to the library. */ |
| 71 addImport(String fullname, String prefix, SourceSpan span) { | 72 addImport(String fullname, String prefix, SourceSpan span) { |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 504 |
| 504 void visitFunctionDefinition(FunctionDefinition node) { | 505 void visitFunctionDefinition(FunctionDefinition node) { |
| 505 currentType.addMethod(node.name.name, node); | 506 currentType.addMethod(node.name.name, node); |
| 506 } | 507 } |
| 507 | 508 |
| 508 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { | 509 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { |
| 509 var type = library.addType(node.func.name.name, node, false); | 510 var type = library.addType(node.func.name.name, node, false); |
| 510 type.addMethod(':call', node.func); | 511 type.addMethod(':call', node.func); |
| 511 } | 512 } |
| 512 } | 513 } |
| OLD | NEW |