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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/full_emitter/container_builder.dart

Issue 2958753002: Conditionally add default argument to metadata (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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) 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 library dart2js.js_emitter.full_emitter.container_builder; 5 library dart2js.js_emitter.full_emitter.container_builder;
6 6
7 import '../../constants/values.dart'; 7 import '../../constants/values.dart';
8 import '../../elements/elements.dart' 8 import '../../elements/elements.dart'
9 show Element, MetadataAnnotation, MethodElement; 9 show Element, MetadataAnnotation, MethodElement;
10 import '../../elements/entities.dart'; 10 import '../../elements/entities.dart';
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 tearOffInfo.add(callSelectorString); 136 tearOffInfo.add(callSelectorString);
137 } 137 }
138 138
139 expressions 139 expressions
140 ..addAll(tearOffInfo) 140 ..addAll(tearOffInfo)
141 ..add((tearOffName == null || member.isGetter || member.isSetter) 141 ..add((tearOffName == null || member.isGetter || member.isSetter)
142 ? js("null") 142 ? js("null")
143 : js.quoteName(tearOffName)) 143 : js.quoteName(tearOffName))
144 ..add(js.number(requiredParameterCount)) 144 ..add(js.number(requiredParameterCount))
145 ..add(js.number(optionalParameterCount)) 145 ..add(js.number(optionalParameterCount))
146 ..add(memberTypeExpression == null ? js("null") : memberTypeExpression) 146 ..add(memberTypeExpression == null ? js("null") : memberTypeExpression);
147 ..addAll(task.metadataCollector.reifyDefaultArguments(member));
148 147
149 if (canBeReflected || canBeApplied) { 148 if (canBeReflected || canBeApplied) {
149 expressions.addAll(task.metadataCollector.reifyDefaultArguments(member));
150
150 // TODO(redemption): Support entities. 151 // TODO(redemption): Support entities.
151 MethodElement method = member; 152 MethodElement method = member;
152 method.functionSignature.forEachParameter((Element parameter) { 153 method.functionSignature.forEachParameter((Element parameter) {
153 expressions.add(task.metadataCollector.reifyName(parameter.name)); 154 expressions.add(task.metadataCollector.reifyName(parameter.name));
154 if (backend.mirrorsData.mustRetainMetadata) { 155 if (backend.mirrorsData.mustRetainMetadata) {
155 Iterable<jsAst.Expression> metadataIndices = 156 Iterable<jsAst.Expression> metadataIndices =
156 parameter.metadata.map((MetadataAnnotation annotation) { 157 parameter.metadata.map((MetadataAnnotation annotation) {
157 ConstantValue constant = 158 ConstantValue constant =
158 backend.constants.getConstantValueForMetadata(annotation); 159 backend.constants.getConstantValueForMetadata(annotation);
159 codegenWorldBuilder.addCompileTimeConstantForEmission(constant); 160 codegenWorldBuilder.addCompileTimeConstantForEmission(constant);
(...skipping 25 matching lines...) Expand all
185 jsAst.ArrayInitializer arrayInit = 186 jsAst.ArrayInitializer arrayInit =
186 new jsAst.ArrayInitializer(expressions.toList()); 187 new jsAst.ArrayInitializer(expressions.toList());
187 compiler.dumpInfoTask 188 compiler.dumpInfoTask
188 .registerElementAst(member, builder.addProperty(name, arrayInit)); 189 .registerElementAst(member, builder.addProperty(name, arrayInit));
189 } 190 }
190 191
191 void addMemberField(Field field, ClassBuilder builder) { 192 void addMemberField(Field field, ClassBuilder builder) {
192 // For now, do nothing. 193 // For now, do nothing.
193 } 194 }
194 } 195 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698