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

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

Issue 891673003: dart2js: Refactoring, documentation, and a few bugfixes in Namer class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments & some fixes Created 5 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 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 for (var remaining = nameNumber; 317 for (var remaining = nameNumber;
318 remaining > 0; 318 remaining > 0;
319 remaining = (remaining / 88) | 0) { 319 remaining = (remaining / 88) | 0) {
320 codes.unshift(${$HASH} + remaining % 88); 320 codes.unshift(${$HASH} + remaining % 88);
321 } 321 }
322 calculatedShortNames.push( 322 calculatedShortNames.push(
323 String.fromCharCode.apply(String, codes)); 323 String.fromCharCode.apply(String, codes));
324 } 324 }
325 shortNames.splice.apply(shortNames, calculatedShortNames); 325 shortNames.splice.apply(shortNames, calculatedShortNames);
326 } 326 }
327 }''', {'objectClass': js.string(namer.getNameOfClass(objectClass)), 327 }''', {'objectClass': js.string(namer.className(objectClass)),
328 'diffEncoding': js.string('$diffEncoding')})); 328 'diffEncoding': js.string('$diffEncoding')}));
329 } else { 329 } else {
330 // No useDiffEncoding version. 330 // No useDiffEncoding version.
331 Iterable<String> longs = trivialNsmHandlers.map((selector) => 331 Iterable<String> longs = trivialNsmHandlers.map((selector) =>
332 selector.invocationMirrorMemberName); 332 selector.invocationMirrorMemberName);
333 statements.add(js.statement( 333 statements.add(js.statement(
334 'var objectClassObject = processedClasses.collected[#objectClass],' 334 'var objectClassObject = processedClasses.collected[#objectClass],'
335 ' shortNames = #diffEncoding.split(",")', 335 ' shortNames = #diffEncoding.split(",")',
336 {'objectClass': js.string(namer.getNameOfClass(objectClass)), 336 {'objectClass': js.string(namer.className(objectClass)),
337 'diffEncoding': js.string('$diffEncoding')})); 337 'diffEncoding': js.string('$diffEncoding')}));
338 if (!minify) { 338 if (!minify) {
339 statements.add(js.statement('var longNames = #longs.split(",")', 339 statements.add(js.statement('var longNames = #longs.split(",")',
340 {'longs': js.string(longs.join(','))})); 340 {'longs': js.string(longs.join(','))}));
341 } 341 }
342 statements.add(js.statement( 342 statements.add(js.statement(
343 'if (objectClassObject instanceof Array)' 343 'if (objectClassObject instanceof Array)'
344 ' objectClassObject = objectClassObject[1];')); 344 ' objectClassObject = objectClassObject[1];'));
345 } 345 }
346 346
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 }''', { 387 }''', {
388 'sliceOffsetParams': sliceOffsetParams, 388 'sliceOffsetParams': sliceOffsetParams,
389 'noSuchMethodName': noSuchMethodName, 389 'noSuchMethodName': noSuchMethodName,
390 'createInvocationMirror': createInvocationMirror, 390 'createInvocationMirror': createInvocationMirror,
391 'names': minify ? 'shortNames' : 'longNames', 391 'names': minify ? 'shortNames' : 'longNames',
392 'sliceOffsetArguments': sliceOffsetArguments})); 392 'sliceOffsetArguments': sliceOffsetArguments}));
393 393
394 return statements; 394 return statements;
395 } 395 }
396 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698