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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart

Issue 15906010: Expose default constructors through ClassElement.localMembers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with HEAD Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart_backend; 5 part of dart_backend;
6 6
7 // TODO(ahe): This class is simply wrong. This backend should use 7 // TODO(ahe): This class is simply wrong. This backend should use
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, 8 // elements when it can, not AST nodes. Perhaps a [Map<Element,
9 // TreeElements>] is what is needed. 9 // TreeElements>] is what is needed.
10 class ElementAst { 10 class ElementAst {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 const Link<DartType>() 411 const Link<DartType>()
412 ); 412 );
413 constructor.cachedNode = new FunctionExpression( 413 constructor.cachedNode = new FunctionExpression(
414 new Send(classNode.name, synthesizedIdentifier), 414 new Send(classNode.name, synthesizedIdentifier),
415 new NodeList(new StringToken(OPEN_PAREN_INFO, '(', -1), 415 new NodeList(new StringToken(OPEN_PAREN_INFO, '(', -1),
416 const Link<Node>(), 416 const Link<Node>(),
417 new StringToken(CLOSE_PAREN_INFO, ')', -1)), 417 new StringToken(CLOSE_PAREN_INFO, ')', -1)),
418 new EmptyStatement(new StringToken(SEMICOLON_INFO, ';', -1)), 418 new EmptyStatement(new StringToken(SEMICOLON_INFO, ';', -1)),
419 null, Modifiers.EMPTY, null, null); 419 null, Modifiers.EMPTY, null, null);
420 420
421 classMembers[classElement].add(constructor); 421 if (!constructor.isSynthesized) {
422 classMembers[classElement].add(constructor);
423 }
422 elementAsts[constructor] = 424 elementAsts[constructor] =
423 new ElementAst(constructor.cachedNode, new TreeElementMapping(null)); 425 new ElementAst(constructor.cachedNode, new TreeElementMapping(null));
424 } 426 }
425 427
426 // Create all necessary placeholders. 428 // Create all necessary placeholders.
427 PlaceholderCollector collector = 429 PlaceholderCollector collector =
428 new PlaceholderCollector(compiler, fixedMemberNames, elementAsts); 430 new PlaceholderCollector(compiler, fixedMemberNames, elementAsts);
429 // Add synthesizedIdentifier to set of unresolved names to rename it to 431 // Add synthesizedIdentifier to set of unresolved names to rename it to
430 // some unused identifier. 432 // some unused identifier.
431 collector.unresolvedNodes.add(synthesizedIdentifier); 433 collector.unresolvedNodes.add(synthesizedIdentifier);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 } 590 }
589 591
590 compareElements(e0, e1) { 592 compareElements(e0, e1) {
591 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); 593 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1);
592 if (result != 0) return result; 594 if (result != 0) return result;
593 return compareBy((e) => e.position().charOffset)(e0, e1); 595 return compareBy((e) => e.position().charOffset)(e0, e1);
594 } 596 }
595 597
596 List<Element> sortElements(Iterable<Element> elements) => 598 List<Element> sortElements(Iterable<Element> elements) =>
597 sorted(elements, compareElements); 599 sorted(elements, compareElements);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698