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

Side by Side Diff: utils/template/uitest.dart

Issue 10887023: Use new try-catch syntax in runtime/, tools/, and utils/. (Closed) Base URL: https://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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/template/parser.dart ('k') | utils/tests/css/selector_literal_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import('dart:html'); 5 #import('dart:html');
6 #import('template.dart'); 6 #import('template.dart');
7 #import('../lib/file_system_memory.dart'); 7 #import('../lib/file_system_memory.dart');
8 8
9 String currSampleTemplate; 9 String currSampleTemplate;
10 10
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (debug) { 384 if (debug) {
385 try { 385 try {
386 List<Template> templates = templateParseAndValidate(htmlTemplate); 386 List<Template> templates = templateParseAndValidate(htmlTemplate);
387 for (var tmpl in templates) { 387 for (var tmpl in templates) {
388 dumpTree.add(tmpl.toDebugString()); 388 dumpTree.add(tmpl.toDebugString());
389 } 389 }
390 390
391 // Generate the Dart class(es) for all template(s). 391 // Generate the Dart class(es) for all template(s).
392 // Pass in filename of 'foo' for testing in UITest. 392 // Pass in filename of 'foo' for testing in UITest.
393 code.add(Codegen.generate(templates, 'foo')); 393 code.add(Codegen.generate(templates, 'foo'));
394 } catch (final htmlException) { 394 } catch (htmlException) {
395 // TODO(terry): TBD 395 // TODO(terry): TBD
396 print("ERROR unhandled EXCEPTION"); 396 print("ERROR unhandled EXCEPTION");
397 } 397 }
398 } 398 }
399 399
400 /* 400 /*
401 if (!debug) { 401 if (!debug) {
402 try { 402 try {
403 cssParseAndValidate(cssExpr, cssWorld); 403 cssParseAndValidate(cssExpr, cssWorld);
404 } catch (final cssException) { 404 } catch (cssException) {
405 templateValid = false; 405 templateValid = false;
406 dumpTree = cssException.toString(); 406 dumpTree = cssException.toString();
407 } 407 }
408 } else if (parseOnly) { 408 } else if (parseOnly) {
409 try { 409 try {
410 Parser parser = new Parser(new lang.SourceFile( 410 Parser parser = new Parser(new lang.SourceFile(
411 lang.SourceFile.IN_MEMORY_FILE, cssExpr)); 411 lang.SourceFile.IN_MEMORY_FILE, cssExpr));
412 Stylesheet stylesheet = parser.parse(); 412 Stylesheet stylesheet = parser.parse();
413 StringBuffer stylesheetTree = new StringBuffer(); 413 StringBuffer stylesheetTree = new StringBuffer();
414 String prettyStylesheet = stylesheet.toString(); 414 String prettyStylesheet = stylesheet.toString();
415 stylesheetTree.add("${prettyStylesheet}\n"); 415 stylesheetTree.add("${prettyStylesheet}\n");
416 stylesheetTree.add("\n============>Tree Dump<============\n"); 416 stylesheetTree.add("\n============>Tree Dump<============\n");
417 stylesheetTree.add(stylesheet.toDebugString()); 417 stylesheetTree.add(stylesheet.toDebugString());
418 dumpTree = stylesheetTree.toString(); 418 dumpTree = stylesheetTree.toString();
419 } catch (final cssParseException) { 419 } catch (cssParseException) {
420 templateValid = false; 420 templateValid = false;
421 dumpTree = cssParseException.toString(); 421 dumpTree = cssParseException.toString();
422 } 422 }
423 } else { 423 } else {
424 try { 424 try {
425 dumpTree = cssParseAndValidateDebug(cssExpr, cssWorld); 425 dumpTree = cssParseAndValidateDebug(cssExpr, cssWorld);
426 } catch (final cssException) { 426 } catch (cssException) {
427 templateValid = false; 427 templateValid = false;
428 dumpTree = cssException.toString(); 428 dumpTree = cssException.toString();
429 } 429 }
430 } 430 }
431 */ 431 */
432 432
433 final bgcolor = templateValid ? "white" : "red"; 433 final bgcolor = templateValid ? "white" : "red";
434 final color = templateValid ? "black" : "white"; 434 final color = templateValid ? "black" : "white";
435 final valid = templateValid ? "VALID" : "NOT VALID"; 435 final valid = templateValid ? "VALID" : "NOT VALID";
436 String resultStyle = "resize: none; margin: 0; height: 100%; width: 100%;" 436 String resultStyle = "resize: none; margin: 0; height: 100%; width: 100%;"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 initHtmlWorld(false); 564 initHtmlWorld(false);
565 565
566 // Don't display any colors in the UI. 566 // Don't display any colors in the UI.
567 options.useColors = false; 567 options.useColors = false;
568 568
569 // Replace error handler bring up alert for any problems. 569 // Replace error handler bring up alert for any problems.
570 world.printHandler = (String msg) { 570 world.printHandler = (String msg) {
571 window.alert(msg); 571 window.alert(msg);
572 }; 572 };
573 } 573 }
OLDNEW
« no previous file with comments | « utils/template/parser.dart ('k') | utils/tests/css/selector_literal_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698