OLD | NEW |
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 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if (!minify) { | 220 if (!minify) { |
221 statements.add(js.statement('var longNames = #longs.split(",")', | 221 statements.add(js.statement('var longNames = #longs.split(",")', |
222 {'longs': js.string(sortedLongs.join(','))})); | 222 {'longs': js.string(sortedLongs.join(','))})); |
223 } | 223 } |
224 statements.add(js.statement('if (objectClassObject instanceof Array)' | 224 statements.add(js.statement('if (objectClassObject instanceof Array)' |
225 ' objectClassObject = objectClassObject[1];')); | 225 ' objectClassObject = objectClassObject[1];')); |
226 } | 226 } |
227 | 227 |
228 dynamic isIntercepted = // jsAst.Expression or bool. | 228 dynamic isIntercepted = // jsAst.Expression or bool. |
229 interceptedSelectors.isEmpty | 229 interceptedSelectors.isEmpty |
230 ? false | 230 ? false |
231 : ordinarySelectors.isEmpty | 231 : ordinarySelectors.isEmpty |
232 ? true | 232 ? true |
233 : js('j < #', js.number(interceptedSelectors.length)); | 233 : js('j < #', js.number(interceptedSelectors.length)); |
234 | 234 |
235 statements.add(js.statement( | 235 statements.add(js.statement( |
236 ''' | 236 ''' |
237 // If we are loading a deferred library the object class will not be in | 237 // If we are loading a deferred library the object class will not be in |
238 // the collectedClasses so objectClassObject is undefined, and we skip | 238 // the collectedClasses so objectClassObject is undefined, and we skip |
239 // setting up the names. | 239 // setting up the names. |
240 if (objectClassObject) { | 240 if (objectClassObject) { |
241 for (var j = 0; j < shortNames.length; j++) { | 241 for (var j = 0; j < shortNames.length; j++) { |
242 var type = 0; | 242 var type = 0; |
243 var shortName = shortNames[j]; | 243 var shortName = shortNames[j]; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } | 387 } |
388 | 388 |
389 String get value { | 389 String get value { |
390 if (_cachedValue == null) { | 390 if (_cachedValue == null) { |
391 _cachedValue = _computeDiffEncoding(); | 391 _cachedValue = _computeDiffEncoding(); |
392 } | 392 } |
393 | 393 |
394 return _cachedValue; | 394 return _cachedValue; |
395 } | 395 } |
396 } | 396 } |
OLD | NEW |