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

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

Issue 1047203002: compute interfaces lazily (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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/typed_data.js ('k') | test/codegen/expect/server_mode/html_input.html » ('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 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
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
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 }
OLDNEW
« no previous file with comments | « lib/runtime/dart/typed_data.js ('k') | test/codegen/expect/server_mode/html_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698