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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/metadata_emitter.dart

Issue 179583002: Revert "Emit named parameter information in declaration order." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class MetadataEmitter extends CodeEmitterHelper { 7 class MetadataEmitter extends CodeEmitterHelper {
8 /// A list of JS expressions that represent metadata, parameter names and 8 /// A list of JS expressions that represent metadata, parameter names and
9 /// type, and return types. 9 /// type, and return types.
10 final List<String> globalMetadata = []; 10 final List<String> globalMetadata = [];
(...skipping 28 matching lines...) Expand all
39 if (metadata.isEmpty) return null; 39 if (metadata.isEmpty) return null;
40 return js.fun( 40 return js.fun(
41 [], [js.return_(new jsAst.ArrayInitializer.from(metadata))]); 41 [], [js.return_(new jsAst.ArrayInitializer.from(metadata))]);
42 }); 42 });
43 } 43 }
44 44
45 List<int> reifyDefaultArguments(FunctionElement function) { 45 List<int> reifyDefaultArguments(FunctionElement function) {
46 FunctionSignature signature = function.computeSignature(compiler); 46 FunctionSignature signature = function.computeSignature(compiler);
47 if (signature.optionalParameterCount == 0) return const []; 47 if (signature.optionalParameterCount == 0) return const [];
48 List<int> defaultValues = <int>[]; 48 List<int> defaultValues = <int>[];
49 for (Element element in signature.optionalParameters) { 49 for (Element element in signature.orderedOptionalParameters) {
50 Constant value = 50 Constant value =
51 compiler.constantHandler.initialVariableValues[element]; 51 compiler.constantHandler.initialVariableValues[element];
52 String stringRepresentation = (value == null) 52 String stringRepresentation = (value == null)
53 ? "null" 53 ? "null"
54 : jsAst.prettyPrint(task.constantReference(value), compiler) 54 : jsAst.prettyPrint(task.constantReference(value), compiler)
55 .getText(); 55 .getText();
56 defaultValues.add(addGlobalMetadata(stringRepresentation)); 56 defaultValues.add(addGlobalMetadata(stringRepresentation));
57 } 57 }
58 return defaultValues; 58 return defaultValues;
59 } 59 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // TODO(ahe): Why is metadata sometimes null? 126 // TODO(ahe): Why is metadata sometimes null?
127 if (link != null) { 127 if (link != null) {
128 for (; !link.isEmpty; link = link.tail) { 128 for (; !link.isEmpty; link = link.tail) {
129 metadata.add(reifyMetadata(link.head)); 129 metadata.add(reifyMetadata(link.head));
130 } 130 }
131 } 131 }
132 return metadata; 132 return metadata;
133 }); 133 });
134 } 134 }
135 } 135 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart ('k') | sdk/lib/_internal/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698