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

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

Issue 2466393002: Change to <- for types.
Patch Set: Fixes. Created 4 years, 1 month 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.full_emitter; 5 part of dart2js.js_emitter.full_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
11 /// time, instead of them being emitted as part of the Object class. 11 /// time, instead of them being emitted as part of the Object class.
12 bool get generateTrivialNsmHandlers => true; 12 bool get generateTrivialNsmHandlers => true;
13 13
14 // If we need fewer than this many noSuchMethod handlers we can save space by 14 // If we need fewer than this many noSuchMethod handlers we can save space by
15 // just emitting them in JS, rather than emitting the JS needed to generate 15 // just emitting them in JS, rather than emitting the JS needed to generate
16 // them at run time. 16 // them at run time.
17 static const VERY_FEW_NO_SUCH_METHOD_HANDLERS = 10; 17 static const VERY_FEW_NO_SUCH_METHOD_HANDLERS = 10;
18 18
19 static const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4; 19 static const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4;
20 20
21 void emitNoSuchMethodHandlers(AddPropertyFunction addProperty) { 21 void emitNoSuchMethodHandlers(
22 jsAst.Property <- (jsAst.Name, jsAst.Expression) addProperty) {
22 ClassStubGenerator generator = 23 ClassStubGenerator generator =
23 new ClassStubGenerator(compiler, namer, backend); 24 new ClassStubGenerator(compiler, namer, backend);
24 25
25 // Keep track of the JavaScript names we've already added so we 26 // Keep track of the JavaScript names we've already added so we
26 // do not introduce duplicates (bad for code size). 27 // do not introduce duplicates (bad for code size).
27 Map<jsAst.Name, Selector> addedJsNames = 28 Map<jsAst.Name, Selector> addedJsNames =
28 generator.computeSelectorsForNsmHandlers(); 29 generator.computeSelectorsForNsmHandlers();
29 30
30 // Set flag used by generateMethod helper below. If we have very few 31 // Set flag used by generateMethod helper below. If we have very few
31 // handlers we use addProperty for them all, rather than try to generate 32 // handlers we use addProperty for them all, rather than try to generate
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 388 }
388 389
389 String get value { 390 String get value {
390 if (_cachedValue == null) { 391 if (_cachedValue == null) {
391 _cachedValue = _computeDiffEncoding(); 392 _cachedValue = _computeDiffEncoding();
392 } 393 }
393 394
394 return _cachedValue; 395 return _cachedValue;
395 } 396 }
396 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698