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

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

Issue 1173403002: dart2js: Fix hints in code base. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Updated to latest revision Created 5 years, 6 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) 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 NsmEmitter extends CodeEmitterHelper { 7 class NsmEmitter extends CodeEmitterHelper {
8 final List<Selector> trivialNsmHandlers = <Selector>[]; 8 final List<Selector> trivialNsmHandlers = <Selector>[];
9 9
10 /// If this is true then we can generate the noSuchMethod handlers at startup 10 /// If this is true then we can generate the noSuchMethod handlers at startup
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 for (int i = 0; i < trivialNsmHandlers.length; i++) { 144 for (int i = 0; i < trivialNsmHandlers.length; i++) {
145 if (!backend.isInterceptedName(trivialNsmHandlers[i].name)) { 145 if (!backend.isInterceptedName(trivialNsmHandlers[i].name)) {
146 firstNormalSelector = i; 146 firstNormalSelector = i;
147 break; 147 break;
148 } 148 }
149 } 149 }
150 150
151 // Get the short names (JS names, perhaps minified). 151 // Get the short names (JS names, perhaps minified).
152 Iterable<String> shorts = trivialNsmHandlers.map((selector) => 152 Iterable<String> shorts = trivialNsmHandlers.map((selector) =>
153 namer.invocationMirrorInternalName(selector)); 153 namer.invocationMirrorInternalName(selector));
154 final diffShorts = <String>[];
155 var diffEncoding = new StringBuffer(); 154 var diffEncoding = new StringBuffer();
156 155
157 // Treat string as a number in base 88 with digits in ASCII order from # to 156 // Treat string as a number in base 88 with digits in ASCII order from # to
158 // z. The short name sorting is based on length, and uses ASCII order for 157 // z. The short name sorting is based on length, and uses ASCII order for
159 // equal length strings so this means that names are ascending. The hash 158 // equal length strings so this means that names are ascending. The hash
160 // character, #, is never given as input, but we need it because it's the 159 // character, #, is never given as input, but we need it because it's the
161 // implicit leading zero (otherwise we could not code names with leading 160 // implicit leading zero (otherwise we could not code names with leading
162 // dollar signs). 161 // dollar signs).
163 int fromBase88(String x) { 162 int fromBase88(String x) {
164 int answer = 0; 163 int answer = 0;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 diffEncoding.write(short); 211 diffEncoding.write(short);
213 } 212 }
214 nameCounter++; 213 nameCounter++;
215 } 214 }
216 215
217 // Startup code that loops over the method names and puts handlers on the 216 // Startup code that loops over the method names and puts handlers on the
218 // Object class to catch noSuchMethod invocations. 217 // Object class to catch noSuchMethod invocations.
219 ClassElement objectClass = compiler.objectClass; 218 ClassElement objectClass = compiler.objectClass;
220 jsAst.Expression createInvocationMirror = backend.emitter 219 jsAst.Expression createInvocationMirror = backend.emitter
221 .staticFunctionAccess(backend.getCreateInvocationMirror()); 220 .staticFunctionAccess(backend.getCreateInvocationMirror());
222 var type = 0;
223 if (useDiffEncoding) { 221 if (useDiffEncoding) {
224 statements.add(js.statement('''{ 222 statements.add(js.statement('''{
225 var objectClassObject = processedClasses.collected[#objectClass], 223 var objectClassObject = processedClasses.collected[#objectClass],
226 shortNames = #diffEncoding.split(","), 224 shortNames = #diffEncoding.split(","),
227 nameNumber = 0, 225 nameNumber = 0,
228 diffEncodedString = shortNames[0], 226 diffEncodedString = shortNames[0],
229 calculatedShortNames = [0, 1]; // 0, 1 are args for splice. 227 calculatedShortNames = [0, 1]; // 0, 1 are args for splice.
230 // If we are loading a deferred library the object class will not be i n 228 // If we are loading a deferred library the object class will not be i n
231 // the collectedClasses so objectClassObject is undefined, and we skip 229 // the collectedClasses so objectClassObject is undefined, and we skip
232 // setting up the names. 230 // setting up the names.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 }''', { 316 }''', {
319 'sliceOffsetParams': sliceOffsetParams, 317 'sliceOffsetParams': sliceOffsetParams,
320 'noSuchMethodName': namer.noSuchMethodName, 318 'noSuchMethodName': namer.noSuchMethodName,
321 'createInvocationMirror': createInvocationMirror, 319 'createInvocationMirror': createInvocationMirror,
322 'names': minify ? 'shortNames' : 'longNames', 320 'names': minify ? 'shortNames' : 'longNames',
323 'sliceOffsetArguments': sliceOffsetArguments})); 321 'sliceOffsetArguments': sliceOffsetArguments}));
324 322
325 return statements; 323 return statements;
326 } 324 }
327 } 325 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698