| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // TODO(jmesserly): replace with node.js path.resolve | 62 // TODO(jmesserly): replace with node.js path.resolve |
| 63 if (filename.startsWith('/')) return filename; | 63 if (filename.startsWith('/')) return filename; |
| 64 if (filename.startsWith('file:///')) return filename; | 64 if (filename.startsWith('file:///')) return filename; |
| 65 if (filename.startsWith('http://')) return filename; | 65 if (filename.startsWith('http://')) return filename; |
| 66 if (const RegExp('^[a-zA-Z]:/').hasMatch(filename)) return filename; |
| 66 return joinPaths(sourceDir, filename); | 67 return joinPaths(sourceDir, filename); |
| 67 } | 68 } |
| 68 | 69 |
| 69 /** Adds an import to the library. */ | 70 /** Adds an import to the library. */ |
| 70 addImport(String fullname, String prefix, SourceSpan span) { | 71 addImport(String fullname, String prefix, SourceSpan span) { |
| 71 var newLib = world.getOrAddLibrary(fullname); | 72 var newLib = world.getOrAddLibrary(fullname); |
| 72 // Special exemption in spec to ensure core is only imported once | 73 // Special exemption in spec to ensure core is only imported once |
| 73 if (newLib.isCore) return; | 74 if (newLib.isCore) return; |
| 74 imports.add(new LibraryImport(newLib, prefix, span)); | 75 imports.add(new LibraryImport(newLib, prefix, span)); |
| 75 return newLib; | 76 return newLib; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 512 |
| 512 void visitFunctionDefinition(FunctionDefinition node) { | 513 void visitFunctionDefinition(FunctionDefinition node) { |
| 513 currentType.addMethod(node.name.name, node); | 514 currentType.addMethod(node.name.name, node); |
| 514 } | 515 } |
| 515 | 516 |
| 516 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { | 517 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { |
| 517 var type = library.addType(node.func.name.name, node, false); | 518 var type = library.addType(node.func.name.name, node, false); |
| 518 type.addMethod(':call', node.func); | 519 type.addMethod(':call', node.func); |
| 519 } | 520 } |
| 520 } | 521 } |
| OLD | NEW |