| OLD | NEW |
| 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 library dev_compiler.src.codegen.js_codegen; | 5 library dev_compiler.src.codegen.js_codegen; |
| 6 | 6 |
| 7 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; | 7 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
| (...skipping 3570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3581 String generateLibrary(LibraryUnit unit) { | 3581 String generateLibrary(LibraryUnit unit) { |
| 3582 // Clone the AST first, so we can mutate it. | 3582 // Clone the AST first, so we can mutate it. |
| 3583 unit = unit.clone(); | 3583 unit = unit.clone(); |
| 3584 var library = unit.library.element.library; | 3584 var library = unit.library.element.library; |
| 3585 var fields = findFieldsNeedingStorage(unit, _extensionTypes); | 3585 var fields = findFieldsNeedingStorage(unit, _extensionTypes); |
| 3586 var rules = new StrongTypeSystemImpl(); | 3586 var rules = new StrongTypeSystemImpl(); |
| 3587 var codegen = | 3587 var codegen = |
| 3588 new JSCodegenVisitor(compiler, rules, library, _extensionTypes, fields); | 3588 new JSCodegenVisitor(compiler, rules, library, _extensionTypes, fields); |
| 3589 var module = codegen.emitLibrary(unit); | 3589 var module = codegen.emitLibrary(unit); |
| 3590 var out = compiler.getOutputPath(library.source.uri); | 3590 var out = compiler.getOutputPath(library.source.uri); |
| 3591 return writeJsLibrary(module, out, | 3591 var flags = compiler.options; |
| 3592 var serverUri = flags.serverMode |
| 3593 ? Uri.parse('http://${flags.host}:${flags.port}/') |
| 3594 : null; |
| 3595 return writeJsLibrary(module, out, compiler.inputBaseDir, serverUri, |
| 3592 emitSourceMaps: options.emitSourceMaps, | 3596 emitSourceMaps: options.emitSourceMaps, |
| 3593 arrowFnBindThisWorkaround: options.arrowFnBindThisWorkaround); | 3597 arrowFnBindThisWorkaround: options.arrowFnBindThisWorkaround); |
| 3594 } | 3598 } |
| 3595 } | 3599 } |
| 3596 | 3600 |
| 3597 /// Choose a canonical name from the library element. | 3601 /// Choose a canonical name from the library element. |
| 3598 /// This never uses the library's name (the identifier in the `library` | 3602 /// This never uses the library's name (the identifier in the `library` |
| 3599 /// declaration) as it doesn't have any meaningful rules enforced. | 3603 /// declaration) as it doesn't have any meaningful rules enforced. |
| 3600 String jsLibraryName(LibraryElement library) => canonicalLibraryName(library); | 3604 String jsLibraryName(LibraryElement library) => canonicalLibraryName(library); |
| 3601 | 3605 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3612 | 3616 |
| 3613 /// A special kind of element created by the compiler, signifying a temporary | 3617 /// A special kind of element created by the compiler, signifying a temporary |
| 3614 /// variable. These objects use instance equality, and should be shared | 3618 /// variable. These objects use instance equality, and should be shared |
| 3615 /// everywhere in the tree where they are treated as the same variable. | 3619 /// everywhere in the tree where they are treated as the same variable. |
| 3616 class TemporaryVariableElement extends LocalVariableElementImpl { | 3620 class TemporaryVariableElement extends LocalVariableElementImpl { |
| 3617 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 3621 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
| 3618 | 3622 |
| 3619 int get hashCode => identityHashCode(this); | 3623 int get hashCode => identityHashCode(this); |
| 3620 bool operator ==(Object other) => identical(this, other); | 3624 bool operator ==(Object other) => identical(this, other); |
| 3621 } | 3625 } |
| OLD | NEW |