| 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 package com.google.dart.runner; | 5 package com.google.dart.runner; |
| 6 | 6 |
| 7 import com.google.dart.compiler.DartSource; | 7 import com.google.dart.compiler.DartSource; |
| 8 import com.google.dart.compiler.LibrarySource; | 8 import com.google.dart.compiler.LibrarySource; |
| 9 import com.google.dart.compiler.UrlDartSource; | 9 import com.google.dart.compiler.UrlDartSource; |
| 10 import com.google.dart.compiler.UrlSource; | 10 import com.google.dart.compiler.UrlSource; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 public BundleLibrarySource(ClassLoader loader, String basePath, String filenam
e) | 32 public BundleLibrarySource(ClassLoader loader, String basePath, String filenam
e) |
| 33 throws URISyntaxException { | 33 throws URISyntaxException { |
| 34 super(loader.getResource(basePath + filename).toURI()); | 34 super(loader.getResource(basePath + filename).toURI()); |
| 35 this.loader = loader; | 35 this.loader = loader; |
| 36 this.basePath = basePath; | 36 this.basePath = basePath; |
| 37 this.filename = filename; | 37 this.filename = filename; |
| 38 } | 38 } |
| 39 | 39 |
| 40 @Override | 40 @Override |
| 41 public LibrarySource getImportFor(String filename) { | 41 public LibrarySource getImportFor(String relPath) { |
| 42 try { | 42 try { |
| 43 return new BundleLibrarySource(loader, basePath, filename); | 43 return new BundleLibrarySource(loader, basePath, relPath); |
| 44 } catch (URISyntaxException e) { | 44 } catch (URISyntaxException e) { |
| 45 throw new AssertionError(); | 45 return null; |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 @Override | 49 @Override |
| 50 public DartSource getSourceFor(final String relPath) { | 50 public DartSource getSourceFor(String relPath) { |
| 51 try { | 51 try { |
| 52 return new BundleDartSource(loader, basePath, relPath); | 52 return new BundleDartSource(loader, basePath, relPath); |
| 53 } catch (URISyntaxException e) { | 53 } catch (URISyntaxException e) { |
| 54 throw new AssertionError(e); | 54 return null; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 @Override | 58 @Override |
| 59 public String getName() { | 59 public String getName() { |
| 60 return basePath + filename; | 60 return basePath + filename; |
| 61 } | 61 } |
| 62 } | 62 } |
| OLD | NEW |