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

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/module_builder.dart

Issue 2621543004: Cleanup references to the old DDC repo (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 'package:args/args.dart' show ArgParser, ArgResults; 5 import 'package:args/args.dart' show ArgParser, ArgResults;
6 import 'package:path/path.dart' as path; 6 import 'package:path/path.dart' as path;
7 7
8 import '../js_ast/js_ast.dart'; 8 import '../js_ast/js_ast.dart';
9 import 'js_names.dart'; 9 import 'js_names.dart';
10 10
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 var names = export.exportedNames; 231 var names = export.exportedNames;
232 // export * is not emitted by the compiler, so we don't handle it here. 232 // export * is not emitted by the compiler, so we don't handle it here.
233 assert(names != null); 233 assert(names != null);
234 for (var name in names) { 234 for (var name in names) {
235 statements 235 statements
236 .add(js.statement('#.# = #;', [exportsVar, name.name, name])); 236 .add(js.statement('#.# = #;', [exportsVar, name.name, name]));
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 // TODO(vsm): See https://github.com/dart-lang/dev_compiler/issues/512 241 // TODO(vsm): See #27309
242 // This extra level of indirection should be unnecessary. 242 // This extra level of indirection should be unnecessary.
243 var block = 243 var block =
244 js.statement("(function() { 'use strict'; #; })()", [statements]); 244 js.statement("(function() { 'use strict'; #; })()", [statements]);
245 245
246 return new Program([block]); 246 return new Program([block]);
247 } 247 }
248 } 248 }
249 249
250 /// Generates AMD modules (used in browsers with RequireJS). 250 /// Generates AMD modules (used in browsers with RequireJS).
251 class AmdModuleBuilder extends _ModuleBuilder { 251 class AmdModuleBuilder extends _ModuleBuilder {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // Ensure the identifier first character is not numeric and that the whole 334 // Ensure the identifier first character is not numeric and that the whole
335 // identifier is not a keyword. 335 // identifier is not a keyword.
336 if (result.startsWith(new RegExp('[0-9]')) || invalidVariableName(result)) { 336 if (result.startsWith(new RegExp('[0-9]')) || invalidVariableName(result)) {
337 return '\$$result'; 337 return '\$$result';
338 } 338 }
339 return result; 339 return result;
340 } 340 }
341 341
342 // Invalid characters for identifiers, which would need to be escaped. 342 // Invalid characters for identifiers, which would need to be escaped.
343 final _invalidCharInIdentifier = new RegExp(r'[^A-Za-z_$0-9]'); 343 final _invalidCharInIdentifier = new RegExp(r'[^A-Za-z_$0-9]');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698