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

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

Issue 1643523008: fix #43, remove => workaround (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « lib/runtime/dart/isolate.js ('k') | lib/src/codegen/js_printer.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) 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 'dart:collection' show HashSet, HashMap, SplayTreeSet; 5 import 'dart:collection' show HashSet, HashMap, SplayTreeSet;
6 6
7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
8 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; 8 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator;
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after
3556 var rules = new StrongTypeSystemImpl(); 3556 var rules = new StrongTypeSystemImpl();
3557 var codegen = 3557 var codegen =
3558 new JSCodegenVisitor(compiler, rules, library, _extensionTypes, fields); 3558 new JSCodegenVisitor(compiler, rules, library, _extensionTypes, fields);
3559 var module = codegen.emitLibrary(unit); 3559 var module = codegen.emitLibrary(unit);
3560 var out = compiler.getOutputPath(library.source.uri); 3560 var out = compiler.getOutputPath(library.source.uri);
3561 var flags = compiler.options; 3561 var flags = compiler.options;
3562 var serverUri = flags.serverMode 3562 var serverUri = flags.serverMode
3563 ? Uri.parse('http://${flags.host}:${flags.port}/') 3563 ? Uri.parse('http://${flags.host}:${flags.port}/')
3564 : null; 3564 : null;
3565 return writeJsLibrary(module, out, compiler.inputBaseDir, serverUri, 3565 return writeJsLibrary(module, out, compiler.inputBaseDir, serverUri,
3566 emitSourceMaps: options.emitSourceMaps, 3566 emitSourceMaps: options.emitSourceMaps);
3567 arrowFnBindThisWorkaround: options.arrowFnBindThisWorkaround);
3568 } 3567 }
3569 } 3568 }
3570 3569
3571 /// Choose a canonical name from the library element. 3570 /// Choose a canonical name from the library element.
3572 /// This never uses the library's name (the identifier in the `library` 3571 /// This never uses the library's name (the identifier in the `library`
3573 /// declaration) as it doesn't have any meaningful rules enforced. 3572 /// declaration) as it doesn't have any meaningful rules enforced.
3574 String jsLibraryName(LibraryElement library) => canonicalLibraryName(library); 3573 String jsLibraryName(LibraryElement library) => canonicalLibraryName(library);
3575 3574
3576 /// Shorthand for identifier-like property names. 3575 /// Shorthand for identifier-like property names.
3577 /// For now, we emit them as strings and the printer restores them to 3576 /// For now, we emit them as strings and the printer restores them to
3578 /// identifiers if it can. 3577 /// identifiers if it can.
3579 // TODO(jmesserly): avoid the round tripping through quoted form. 3578 // TODO(jmesserly): avoid the round tripping through quoted form.
3580 JS.LiteralString _propertyName(String name) => js.string(name, "'"); 3579 JS.LiteralString _propertyName(String name) => js.string(name, "'");
3581 3580
3582 // TODO(jacobr): we would like to do something like the following 3581 // TODO(jacobr): we would like to do something like the following
3583 // but we don't have summary support yet. 3582 // but we don't have summary support yet.
3584 // bool _supportJsExtensionMethod(AnnotatedNode node) => 3583 // bool _supportJsExtensionMethod(AnnotatedNode node) =>
3585 // _getAnnotation(node, "SupportJsExtensionMethod") != null; 3584 // _getAnnotation(node, "SupportJsExtensionMethod") != null;
3586 3585
3587 /// A special kind of element created by the compiler, signifying a temporary 3586 /// A special kind of element created by the compiler, signifying a temporary
3588 /// variable. These objects use instance equality, and should be shared 3587 /// variable. These objects use instance equality, and should be shared
3589 /// everywhere in the tree where they are treated as the same variable. 3588 /// everywhere in the tree where they are treated as the same variable.
3590 class TemporaryVariableElement extends LocalVariableElementImpl { 3589 class TemporaryVariableElement extends LocalVariableElementImpl {
3591 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); 3590 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name);
3592 3591
3593 int get hashCode => identityHashCode(this); 3592 int get hashCode => identityHashCode(this);
3594 bool operator ==(Object other) => identical(this, other); 3593 bool operator ==(Object other) => identical(this, other);
3595 } 3594 }
OLDNEW
« no previous file with comments | « lib/runtime/dart/isolate.js ('k') | lib/src/codegen/js_printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698