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

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

Issue 12082045: Add optional and named parameters to FunctionType. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 if (classElement.constructors.isEmpty) continue NextClassElement; 381 if (classElement.constructors.isEmpty) continue NextClassElement;
382 382
383 // TODO(antonm): check with AAR team if there is better approach. 383 // TODO(antonm): check with AAR team if there is better approach.
384 // As an idea: provide template as a Dart code---class C { C.name(); }--- 384 // As an idea: provide template as a Dart code---class C { C.name(); }---
385 // and then overwrite necessary parts. 385 // and then overwrite necessary parts.
386 ClassNode classNode = classElement.parseNode(compiler); 386 ClassNode classNode = classElement.parseNode(compiler);
387 SynthesizedConstructorElementX constructor = 387 SynthesizedConstructorElementX constructor =
388 new SynthesizedConstructorElementX(classElement); 388 new SynthesizedConstructorElementX(classElement);
389 constructor.type = new FunctionType( 389 constructor.type = new FunctionType(
390 constructor,
390 compiler.types.voidType, const Link<DartType>(), 391 compiler.types.voidType, const Link<DartType>(),
karlklose 2013/01/29 13:13:29 Could you either put each argument on its own line
Johnni Winther 2013/01/29 13:53:59 Done.
391 constructor); 392 const Link<DartType>(),
393 const Link<SourceString>(), const Link<DartType>()
394 );
392 constructor.cachedNode = new FunctionExpression( 395 constructor.cachedNode = new FunctionExpression(
393 new Send(classNode.name, synthesizedIdentifier), 396 new Send(classNode.name, synthesizedIdentifier),
394 new NodeList(new StringToken(OPEN_PAREN_INFO, '(', -1), 397 new NodeList(new StringToken(OPEN_PAREN_INFO, '(', -1),
395 const Link<Node>(), 398 const Link<Node>(),
396 new StringToken(CLOSE_PAREN_INFO, ')', -1)), 399 new StringToken(CLOSE_PAREN_INFO, ')', -1)),
397 new EmptyStatement(new StringToken(SEMICOLON_INFO, ';', -1)), 400 new EmptyStatement(new StringToken(SEMICOLON_INFO, ';', -1)),
398 null, Modifiers.EMPTY, null, null); 401 null, Modifiers.EMPTY, null, null);
399 402
400 classMembers[classElement].add(constructor); 403 classMembers[classElement].add(constructor);
401 elementAsts[constructor] = 404 elementAsts[constructor] =
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 582 }
580 583
581 compareElements(e0, e1) { 584 compareElements(e0, e1) {
582 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); 585 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1);
583 if (result != 0) return result; 586 if (result != 0) return result;
584 return compareBy((e) => e.position().charOffset)(e0, e1); 587 return compareBy((e) => e.position().charOffset)(e0, e1);
585 } 588 }
586 589
587 List<Element> sortElements(Iterable<Element> elements) => 590 List<Element> sortElements(Iterable<Element> elements) =>
588 sorted(elements, compareElements); 591 sorted(elements, compareElements);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698