Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(928)

Unified Diff: tools/testing/frogpad/frogpad.dart

Issue 10919138: Remove frogpad, as it's unused. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/testing/frogpad/frogpad.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/frogpad/frogpad.dart
===================================================================
--- tools/testing/frogpad/frogpad.dart (revision 11985)
+++ tools/testing/frogpad/frogpad.dart (working copy)
@@ -1,141 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * This is the entrypoint for a version of the frog compiler that
- * can run in the browser.
- * Because this is running in the browser, frog cannot access
- * the file system. Instead, we assume the all necessary files
- * have been placed in inert <script> elements somewhere on the page.
- * (See frogpad.py for more details on how the html page is constructed.)
- */
-
-#import("dart:html", prefix:"html");
-#import("../../../frog/lang.dart");
-#import("../../../frog/file_system.dart");
-
-// id of script element containing name of the main dart file
-// to compile.
-final String MAIN_ID = "main_id";
-
-// id of script element containing name of the frog directory
-final String FROGDIR_ID = "frogdir_id";
-
-void main() {
- StringBuffer warnings = new StringBuffer();
- HtmlFileSystem fs = new HtmlFileSystem();
- String frogDir = getText(FROGDIR_ID);
- String mainFile = getText(MAIN_ID);
- setText("input", fs.readAll(mainFile));
-
- int time1 = new Date.now().value;
- List<String> args = [
- "dummy_arg1",
- "dummy_arg2",
- "--enable_type_checks",
- "--enable_asserts",
- mainFile];
- parseOptions(frogDir, args, fs);
-
- options.useColors = false;
-
- initializeWorld(fs);
- world.messageHandler = void _(
- String prefix, String message, SourceSpan span) {
- String location = "";
- if (span !== null) {
- location = span.locationText;
- }
- warnings.add('$prefix$message$location\n');
- };
- bool success = world.compile();
- int time2 = new Date.now().value;
- String output = "throw 'frogpad compilation error';\n";
- if (success) {
- output = world.getGeneratedCode();
- }
- setText("output", output);
- setText("warnings", warnings.toString());
-
- String timing = "generated ${output.length} characters in "
- "${((time2 - time1) / 1000).toStringAsPrecision(3)} seconds";
- setText("timing", timing);
-}
-
-void setText(String id, String text) {
- html.Element element = html.document.query("#$id");
- if (element === null) {
- throw new Exception("Can't find element $id");
- }
- element.innerHTML = htmlEscape(text);
-}
-
-String getText(String id) {
- html.Element element = html.document.query("#$id");
- if (element === null) {
- throw new Exception("Can't find element $id");
- }
- return element.text.trim();
-}
-
-// TODO(rnystrom): should exist in standard lib somewhere
-String htmlEscape(String text) {
- return text.replaceAll('&', '&amp;')
- .replaceAll('>', '&gt;')
- .replaceAll('<', '&lt;');
-}
-
-class HtmlFileSystem implements FileSystem {
-
- HtmlFileSystem() {}
-
- String readAll(String filename) {
- String text = getText(idOfFilename(filename));
- print("read $filename (${text.length} bytes)");
- return text;
- }
-
- /**
- * Returns the id of the <script> element that contains
- * the contents of this file.
- * The id is constructed by taking the filename and replacing
- * all slashes and dots with underscores. For example, the file name:
- *
- * "/usr/local/src/dart/frog/lang.dart"
- *
- * becomes:
- *
- * "_usr_local_src_dart_frog_lang_dart"
- *
- * And, so this file's contents will be found in a <script>
- * element that looks like this:
- *
- * <script type=application/inert id="_usr_local_src_dart_frog_lang_dart">
- * ... contents of file lang.dart placed here ...
- * etc.
- */
- String idOfFilename(String filename) {
- return filename.replaceAll("/", "_").replaceAll(".", "_");
- }
-
- void writeString(String outfile, String text) {
- throw new UnsupportedOperationException("");
- }
-
- bool fileExists(String filename) {
- // frog calls this to check if files exist before reading them. We return
- // true here for all files, and let it fail later if frog attempts to read
- // the contents of a non-existent file.
- return true;
- }
-
- void createDirectory(String path, [bool recursive]) {
- throw new UnsupportedOperationException("");
- }
-
- void removeDirectory(String path, [bool recursive]) {
- throw new UnsupportedOperationException("");
- }
-}
« no previous file with comments | « no previous file | tools/testing/frogpad/frogpad.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698