Chromium Code Reviews| 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 /** | 5 /** |
| 6 * This is the entrypoint for a version of the frog compiler that | 6 * This is the entrypoint for a version of the frog compiler that |
| 7 * can run in the browser. | 7 * can run in the browser. |
| 8 * Because this is running in the browser, frog cannot access | 8 * Because this is running in the browser, frog cannot access |
| 9 * the file system. Instead, we assume the all necessary files | 9 * the file system. Instead, we assume the all necessary files |
| 10 * have been placed in inert <script> elements somewhere on the page. | 10 * have been placed in inert <script> elements somewhere on the page. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 * | 97 * |
| 98 * becomes: | 98 * becomes: |
| 99 * | 99 * |
| 100 * "frog_lang_dart" | 100 * "frog_lang_dart" |
| 101 * | 101 * |
| 102 * And, so this file's contents will be found in a <script> | 102 * And, so this file's contents will be found in a <script> |
| 103 * element that looks like this: | 103 * element that looks like this: |
| 104 * | 104 * |
| 105 * <script type=application/inert id="frog_lang_dart"> | 105 * <script type=application/inert id="frog_lang_dart"> |
| 106 * ... contents of file lang.dart placed here ... | 106 * ... contents of file lang.dart placed here ... |
| 107 * </script> | 107 * etc. |
|
Siggi Cherem (dart-lang)
2012/02/22 21:54:10
Please add a TODO somewhere about handling this mo
mattsh
2012/02/22 21:57:29
Yes, good point.
| |
| 108 */ | 108 */ |
| 109 String idOfFilename(String filename) { | 109 String idOfFilename(String filename) { |
| 110 List<String> components = filename.split("/"); | 110 List<String> components = filename.split("/"); |
| 111 if (components.isEmpty()) { | 111 if (components.isEmpty()) { |
| 112 throw new Exception("bad filename"); | 112 throw new Exception("bad filename"); |
| 113 } | 113 } |
| 114 // Grab the last two components (the directory name and file name). | 114 // Grab the last two components (the directory name and file name). |
| 115 int startIndex = Math.max(0, components.length - 2); | 115 int startIndex = Math.max(0, components.length - 2); |
| 116 int length = components.length - startIndex;; | 116 int length = components.length - startIndex;; |
| 117 components = components.getRange(startIndex, length); | 117 components = components.getRange(startIndex, length); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 132 } | 132 } |
| 133 | 133 |
| 134 void createDirectory(String path, [bool recursive]) { | 134 void createDirectory(String path, [bool recursive]) { |
| 135 throw new UnsupportedOperationException(""); | 135 throw new UnsupportedOperationException(""); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void removeDirectory(String path, [bool recursive]) { | 138 void removeDirectory(String path, [bool recursive]) { |
| 139 throw new UnsupportedOperationException(""); | 139 throw new UnsupportedOperationException(""); |
| 140 } | 140 } |
| 141 } | 141 } |
| OLD | NEW |