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 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 378 |
379 bool templateValid = true; | 379 bool templateValid = true; |
380 StringBuffer dumpTree = new StringBuffer(); | 380 StringBuffer dumpTree = new StringBuffer(); |
381 StringBuffer code = new StringBuffer(); | 381 StringBuffer code = new StringBuffer(); |
382 String htmlTemplate = template.value; | 382 String htmlTemplate = template.value; |
383 | 383 |
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.write(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.write(Codegen.generate(templates, 'foo')); |
394 } catch (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); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |