| 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; | 7 import 'dart:collection' show HashSet, HashMap; |
| 8 import 'dart:io' show Directory, File; | 8 import 'dart:io' show Directory, File; |
| 9 | 9 |
| 10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 JS.Statement _finishClassMembers(ClassElement classElem, | 547 JS.Statement _finishClassMembers(ClassElement classElem, |
| 548 JS.ClassExpression cls, List<ConstructorDeclaration> ctors, | 548 JS.ClassExpression cls, List<ConstructorDeclaration> ctors, |
| 549 List<FieldDeclaration> staticFields) { | 549 List<FieldDeclaration> staticFields) { |
| 550 var name = classElem.name; | 550 var name = classElem.name; |
| 551 | 551 |
| 552 var body = <JS.Statement>[]; | 552 var body = <JS.Statement>[]; |
| 553 body.add(new JS.ClassDeclaration(cls)); | 553 body.add(new JS.ClassDeclaration(cls)); |
| 554 | 554 |
| 555 // Interfaces | 555 // Interfaces |
| 556 if (classElem.interfaces.isNotEmpty) { | 556 if (classElem.interfaces.isNotEmpty) { |
| 557 body.add(js.statement('#[dart.implements] = #;', [ | 557 body.add(js.statement('#[dart.implements] = () => #;', [ |
| 558 name, | 558 name, |
| 559 new JS.ArrayInitializer( | 559 new JS.ArrayInitializer( |
| 560 classElem.interfaces.map(_emitTypeName).toList()) | 560 classElem.interfaces.map(_emitTypeName).toList()) |
| 561 ])); | 561 ])); |
| 562 } | 562 } |
| 563 | 563 |
| 564 // Named constructors | 564 // Named constructors |
| 565 for (ConstructorDeclaration member in ctors) { | 565 for (ConstructorDeclaration member in ctors) { |
| 566 if (member.name != null) { | 566 if (member.name != null) { |
| 567 body.add(js.statement('dart.defineNamedConstructor(#, #);', [ | 567 body.add(js.statement('dart.defineNamedConstructor(#, #);', [ |
| (...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 | 2378 |
| 2379 // TODO(jmesserly): in many cases marking the end will be unncessary. | 2379 // TODO(jmesserly): in many cases marking the end will be unncessary. |
| 2380 printer.mark(_location(node.end)); | 2380 printer.mark(_location(node.end)); |
| 2381 } | 2381 } |
| 2382 | 2382 |
| 2383 String _getIdentifier(AstNode node) { | 2383 String _getIdentifier(AstNode node) { |
| 2384 if (node is SimpleIdentifier) return node.name; | 2384 if (node is SimpleIdentifier) return node.name; |
| 2385 return null; | 2385 return null; |
| 2386 } | 2386 } |
| 2387 } | 2387 } |
| OLD | NEW |