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

Side by Side Diff: lib/src/codegen.dart

Issue 11412285: New pub release - changes to comply with new SDK. (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years 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
« no previous file with comments | « build/gen_html_setters.dart ('k') | lib/src/emitters.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) 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 /** Collects common snippets of generated code. */ 5 /** Collects common snippets of generated code. */
6 library codegen; 6 library codegen;
7 7
8 import 'file_system/path.dart'; 8 import 'file_system/path.dart';
9 import 'info.dart'; 9 import 'info.dart';
10 import 'utils.dart'; 10 import 'utils.dart';
11 11
12 /** 12 /**
13 * Header with common imports, used in every generated .dart file. If path is 13 * Header with common imports, used in every generated .dart file. If path is
14 * null then there is no file associated with the template (used by testing 14 * null then there is no file associated with the template (used by testing
15 * so we'll display <MEMORY> for file name. 15 * so we'll display <MEMORY> for file name.
16 */ 16 */
17 String header(Path path, String libraryName) => """ 17 String header(Path path, String libraryName) => """
18 // Auto-generated from ${path != null ? path.filename : "<MEMORY>"}. 18 // Auto-generated from ${path != null ? path.filename : "<MEMORY>"}.
19 // DO NOT EDIT. 19 // DO NOT EDIT.
20 20
21 library $libraryName; 21 library $libraryName;
22 22
23 $imports 23 $imports
24 """; 24 """;
25 25
26 // TODO(sigmund): include only those imports that are used by the code.
26 String get imports => """ 27 String get imports => """
27 import 'dart:html' as autogenerated; 28 import 'dart:html' as autogenerated_html;
29 import 'dart:web_audio' as autogenerated_audio;
30 import 'dart:svg' as autogenerated_svg;
28 import 'package:web_components/web_components.dart' as autogenerated; 31 import 'package:web_components/web_components.dart' as autogenerated;
29 """; 32 """;
30 33
31 /** The code in .dart files generated for a web component. */ 34 /** The code in .dart files generated for a web component. */
32 // TODO(sigmund): omit [_root] if the user already defined it. 35 // TODO(sigmund): omit [_root] if the user already defined it.
33 String componentCode( 36 String componentCode(
34 String className, 37 String className,
35 String extraFields, 38 String extraFields,
36 String createdBody, 39 String createdBody,
37 String insertedBody, 40 String insertedBody,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 String topLevelFields, 76 String topLevelFields,
74 String fieldInitializers, 77 String fieldInitializers,
75 String modelBinding) => """ 78 String modelBinding) => """
76 79
77 // Original code 80 // Original code
78 $originalCode 81 $originalCode
79 82
80 // Additional generated code 83 // Additional generated code
81 /** Create the views and bind them to models. */ 84 /** Create the views and bind them to models. */
82 void init_autogenerated() { 85 void init_autogenerated() {
83 var _root = autogenerated.document.body; 86 var _root = autogenerated_html.document.body;
84 $topLevelFields 87 $topLevelFields
85 88
86 // Initialize fields. 89 // Initialize fields.
87 $fieldInitializers 90 $fieldInitializers
88 // Attach model to views. 91 // Attach model to views.
89 $modelBinding 92 $modelBinding
90 } 93 }
91 """; 94 """;
92 95
93 /** 96 /**
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 buff.add(' show ') 149 buff.add(' show ')
147 .add(Strings.join(directive.show, ',')); 150 .add(Strings.join(directive.show, ','));
148 } 151 }
149 if (directive.hide != null) { 152 if (directive.hide != null) {
150 buff.add(' hide ') 153 buff.add(' hide ')
151 .add(Strings.join(directive.hide, ',')); 154 .add(Strings.join(directive.hide, ','));
152 } 155 }
153 buff.add(';'); 156 buff.add(';');
154 return buff.toString(); 157 return buff.toString();
155 } 158 }
OLDNEW
« no previous file with comments | « build/gen_html_setters.dart ('k') | lib/src/emitters.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698