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

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: Updated cf. comments. 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/modelx.dart » ('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) 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 compiler.types.voidType, const Link<DartType>(), 390 constructor,
391 constructor); 391 compiler.types.voidType,
392 const Link<DartType>(),
393 const Link<DartType>(),
394 const Link<SourceString>(),
395 const Link<DartType>()
396 );
392 constructor.cachedNode = new FunctionExpression( 397 constructor.cachedNode = new FunctionExpression(
393 new Send(classNode.name, synthesizedIdentifier), 398 new Send(classNode.name, synthesizedIdentifier),
394 new NodeList(new StringToken(OPEN_PAREN_INFO, '(', -1), 399 new NodeList(new StringToken(OPEN_PAREN_INFO, '(', -1),
395 const Link<Node>(), 400 const Link<Node>(),
396 new StringToken(CLOSE_PAREN_INFO, ')', -1)), 401 new StringToken(CLOSE_PAREN_INFO, ')', -1)),
397 new EmptyStatement(new StringToken(SEMICOLON_INFO, ';', -1)), 402 new EmptyStatement(new StringToken(SEMICOLON_INFO, ';', -1)),
398 null, Modifiers.EMPTY, null, null); 403 null, Modifiers.EMPTY, null, null);
399 404
400 classMembers[classElement].add(constructor); 405 classMembers[classElement].add(constructor);
401 elementAsts[constructor] = 406 elementAsts[constructor] =
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 584 }
580 585
581 compareElements(e0, e1) { 586 compareElements(e0, e1) {
582 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); 587 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1);
583 if (result != 0) return result; 588 if (result != 0) return result;
584 return compareBy((e) => e.position().charOffset)(e0, e1); 589 return compareBy((e) => e.position().charOffset)(e0, e1);
585 } 590 }
586 591
587 List<Element> sortElements(Iterable<Element> elements) => 592 List<Element> sortElements(Iterable<Element> elements) =>
588 sorted(elements, compareElements); 593 sorted(elements, compareElements);
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698