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

Side by Side Diff: frog/gen.dart

Issue 10168024: frog: allow optional arguments in implicit method closures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/language.status » ('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 /** 5 /**
6 * Top level generator object for writing code and keeping track of 6 * Top level generator object for writing code and keeping track of
7 * dependencies. 7 * dependencies.
8 * 8 *
9 * Should have two compilation models, but only one implemented so far. 9 * Should have two compilation models, but only one implemented so far.
10 * 10 *
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 } 968 }
969 } 969 }
970 970
971 if (usesBind) world.gen.corejs.ensureBind(); 971 if (usesBind) world.gen.corejs.ensureBind();
972 } 972 }
973 973
974 static bool _maybeGenerateBoundGetter(MethodMember m, CodeWriter defWriter) { 974 static bool _maybeGenerateBoundGetter(MethodMember m, CodeWriter defWriter) {
975 if (m._provideGetter) { 975 if (m._provideGetter) {
976 String suffix = world.gen._writePrototypePatch(m.declaringType, 976 String suffix = world.gen._writePrototypePatch(m.declaringType,
977 'get\$${m.jsname}', 'function() {', defWriter, false); 977 'get\$${m.jsname}', 'function() {', defWriter, false);
978 defWriter.writeln('return this.${m.jsname}.bind(this);'); 978 if (m.parameters.some((p) => p.isOptional)) {
979 defWriter.writeln('var \$bound = this.${m.jsname}.bind(this);');
sra1 2012/04/21 03:33:14 nit. $bound could be any name (e.g. 'f') since the
980 defWriter.writeln('\$bound.\$optional = this.${m.jsname}.\$optional;');
981 defWriter.writeln('return \$bound;');
982 } else {
983 defWriter.writeln('return this.${m.jsname}.bind(this);');
984 }
979 defWriter.exitBlock(suffix); 985 defWriter.exitBlock(suffix);
980 return true; 986 return true;
981 } 987 }
982 return false; 988 return false;
983 } 989 }
984 990
985 /** 991 /**
986 * Generates information about the default/named arguments into the JS code. 992 * Generates information about the default/named arguments into the JS code.
987 * Only methods that are passed as bound methods to "var" need this. It is 993 * Only methods that are passed as bound methods to "var" need this. It is
988 * generated to support run time stub creation. 994 * generated to support run time stub creation.
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2530 return true; 2536 return true;
2531 } 2537 }
2532 2538
2533 } 2539 }
2534 2540
2535 class ReturnKind { 2541 class ReturnKind {
2536 static final int IGNORE = 1; 2542 static final int IGNORE = 1;
2537 static final int POST = 2; 2543 static final int POST = 2;
2538 static final int PRE = 3; 2544 static final int PRE = 3;
2539 } 2545 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698