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

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

Issue 1919143002: Store constant variable initializers in elements. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 ParameterStubGenerator { 7 class ParameterStubGenerator {
8 static final Set<Selector> emptySelectorSet = new Set<Selector>(); 8 static final Set<Selector> emptySelectorSet = new Set<Selector>();
9 9
10 final Namer namer; 10 final Namer namer;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } else { 91 } else {
92 int index = names.indexOf(element.name); 92 int index = names.indexOf(element.name);
93 if (index != -1) { 93 if (index != -1) {
94 indexOfLastOptionalArgumentInParameters = count; 94 indexOfLastOptionalArgumentInParameters = count;
95 // The order of the named arguments is not the same as the 95 // The order of the named arguments is not the same as the
96 // one in the real method (which is in Dart source order). 96 // one in the real method (which is in Dart source order).
97 argumentsBuffer[count] = js('#', jsName); 97 argumentsBuffer[count] = js('#', jsName);
98 parametersBuffer[optionalParameterStart + index] = 98 parametersBuffer[optionalParameterStart + index] =
99 new jsAst.Parameter(jsName); 99 new jsAst.Parameter(jsName);
100 } else { 100 } else {
101 ConstantValue value = handler.getConstantValueForVariable(element); 101 ConstantValue value = handler.getConstantValue(element.constant);
102 if (value == null) { 102 if (value == null) {
103 argumentsBuffer[count] = 103 argumentsBuffer[count] =
104 emitter.constantReference(new NullConstantValue()); 104 emitter.constantReference(new NullConstantValue());
105 } else { 105 } else {
106 if (!value.isNull) { 106 if (!value.isNull) {
107 // If the value is the null constant, we should not pass it 107 // If the value is the null constant, we should not pass it
108 // down to the native method. 108 // down to the native method.
109 indexOfLastOptionalArgumentInParameters = count; 109 indexOfLastOptionalArgumentInParameters = count;
110 } 110 }
111 argumentsBuffer[count] = emitter.constantReference(value); 111 argumentsBuffer[count] = emitter.constantReference(value);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 generateParameterStub(member, selector, null); 274 generateParameterStub(member, selector, null);
275 if (stub != null) { 275 if (stub != null) {
276 stubs.add(stub); 276 stubs.add(stub);
277 } 277 }
278 } 278 }
279 } 279 }
280 280
281 return stubs; 281 return stubs;
282 } 282 }
283 } 283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698