| OLD | NEW |
| 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 library dart2js.js_backend.helpers; | 5 library dart2js.js_backend.helpers; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart' show Identifiers, Uris; | 8 import '../common/names.dart' show Identifiers, Uris; |
| 9 import '../common/resolution.dart' show Resolution; | 9 import '../common/resolution.dart' show Resolution; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| 11 import '../core_types.dart' show CoreClasses; | 11 import '../core_types.dart' show CoreClasses; |
| 12 import '../elements/elements.dart' | 12 import '../elements/elements.dart' |
| 13 show | 13 show |
| 14 AbstractFieldElement, | 14 AbstractFieldElement, |
| 15 ClassElement, | 15 ClassElement, |
| 16 ConstructorElement, | 16 ConstructorElement, |
| 17 Element, | 17 Element, |
| 18 EnumClassElement, | 18 EnumClassElement, |
| 19 FieldElement, |
| 19 FunctionElement, | 20 FunctionElement, |
| 20 LibraryElement, | 21 LibraryElement, |
| 22 MemberElement, |
| 21 MethodElement, | 23 MethodElement, |
| 22 PublicName; | 24 PublicName; |
| 23 import '../library_loader.dart' show LoadedLibraries; | 25 import '../library_loader.dart' show LoadedLibraries; |
| 24 import '../universe/call_structure.dart' show CallStructure; | 26 import '../universe/call_structure.dart' show CallStructure; |
| 25 import '../universe/selector.dart' show Selector; | 27 import '../universe/selector.dart' show Selector; |
| 26 import 'js_backend.dart'; | 28 import 'js_backend.dart'; |
| 27 | 29 |
| 28 /// Helper classes and functions for the JavaScript backend. | 30 /// Helper classes and functions for the JavaScript backend. |
| 29 class BackendHelpers { | 31 class BackendHelpers { |
| 30 static final Uri DART_JS_HELPER = new Uri(scheme: 'dart', path: '_js_helper'); | 32 static final Uri DART_JS_HELPER = new Uri(scheme: 'dart', path: '_js_helper'); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 ClassElement jsMutableIndexableClass; | 100 ClassElement jsMutableIndexableClass; |
| 99 | 101 |
| 100 ClassElement jsMutableArrayClass; | 102 ClassElement jsMutableArrayClass; |
| 101 ClassElement jsFixedArrayClass; | 103 ClassElement jsFixedArrayClass; |
| 102 ClassElement jsExtendableArrayClass; | 104 ClassElement jsExtendableArrayClass; |
| 103 ClassElement jsUnmodifiableArrayClass; | 105 ClassElement jsUnmodifiableArrayClass; |
| 104 ClassElement jsPositiveIntClass; | 106 ClassElement jsPositiveIntClass; |
| 105 ClassElement jsUInt32Class; | 107 ClassElement jsUInt32Class; |
| 106 ClassElement jsUInt31Class; | 108 ClassElement jsUInt31Class; |
| 107 | 109 |
| 108 Element jsIndexableLength; | 110 MemberElement jsIndexableLength; |
| 109 Element jsArrayTypedConstructor; | 111 Element jsArrayTypedConstructor; |
| 110 Element jsArrayRemoveLast; | 112 MethodElement jsArrayRemoveLast; |
| 111 Element jsArrayAdd; | 113 MethodElement jsArrayAdd; |
| 112 Element jsStringSplit; | 114 MethodElement jsStringSplit; |
| 113 Element jsStringToString; | 115 Element jsStringToString; |
| 114 Element jsStringOperatorAdd; | 116 Element jsStringOperatorAdd; |
| 115 Element objectEquals; | 117 Element objectEquals; |
| 116 | 118 |
| 117 ClassElement typeLiteralClass; | 119 ClassElement typeLiteralClass; |
| 118 ClassElement mapLiteralClass; | 120 ClassElement mapLiteralClass; |
| 119 ClassElement constMapLiteralClass; | 121 ClassElement constMapLiteralClass; |
| 120 ClassElement typeVariableClass; | 122 ClassElement typeVariableClass; |
| 121 ConstructorElement mapLiteralConstructor; | 123 ConstructorElement mapLiteralConstructor; |
| 122 ConstructorElement mapLiteralConstructorEmpty; | 124 ConstructorElement mapLiteralConstructorEmpty; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 jsFixedArrayClass.ensureResolved(resolution); | 366 jsFixedArrayClass.ensureResolved(resolution); |
| 365 } | 367 } |
| 366 if (jsExtendableArrayClass != null) { | 368 if (jsExtendableArrayClass != null) { |
| 367 jsExtendableArrayClass.ensureResolved(resolution); | 369 jsExtendableArrayClass.ensureResolved(resolution); |
| 368 } | 370 } |
| 369 if (jsUnmodifiableArrayClass != null) { | 371 if (jsUnmodifiableArrayClass != null) { |
| 370 jsUnmodifiableArrayClass.ensureResolved(resolution); | 372 jsUnmodifiableArrayClass.ensureResolved(resolution); |
| 371 } | 373 } |
| 372 | 374 |
| 373 jsIndexableClass.ensureResolved(resolution); | 375 jsIndexableClass.ensureResolved(resolution); |
| 374 jsIndexableLength = compiler.lookupElementIn(jsIndexableClass, 'length'); | 376 Element jsIndexableLengthElement = |
| 375 if (jsIndexableLength != null && jsIndexableLength.isAbstractField) { | 377 compiler.lookupElementIn(jsIndexableClass, 'length'); |
| 376 AbstractFieldElement element = jsIndexableLength; | 378 if (jsIndexableLengthElement != null && |
| 379 jsIndexableLengthElement.isAbstractField) { |
| 380 AbstractFieldElement element = jsIndexableLengthElement; |
| 377 jsIndexableLength = element.getter; | 381 jsIndexableLength = element.getter; |
| 382 } else { |
| 383 jsIndexableLength = jsIndexableLengthElement; |
| 378 } | 384 } |
| 379 | 385 |
| 380 jsArrayClass.ensureResolved(resolution); | 386 jsArrayClass.ensureResolved(resolution); |
| 381 jsArrayTypedConstructor = compiler.lookupElementIn(jsArrayClass, 'typed'); | 387 jsArrayTypedConstructor = compiler.lookupElementIn(jsArrayClass, 'typed'); |
| 382 jsArrayRemoveLast = compiler.lookupElementIn(jsArrayClass, 'removeLast'); | 388 jsArrayRemoveLast = compiler.lookupElementIn(jsArrayClass, 'removeLast'); |
| 383 jsArrayAdd = compiler.lookupElementIn(jsArrayClass, 'add'); | 389 jsArrayAdd = compiler.lookupElementIn(jsArrayClass, 'add'); |
| 384 | 390 |
| 385 jsStringClass.ensureResolved(resolution); | 391 jsStringClass.ensureResolved(resolution); |
| 386 jsStringSplit = compiler.lookupElementIn(jsStringClass, 'split'); | 392 jsStringSplit = compiler.lookupElementIn(jsStringClass, 'split'); |
| 387 jsStringOperatorAdd = compiler.lookupElementIn(jsStringClass, '+'); | 393 jsStringOperatorAdd = compiler.lookupElementIn(jsStringClass, '+'); |
| 388 jsStringToString = compiler.lookupElementIn(jsStringClass, 'toString'); | 394 jsStringToString = compiler.lookupElementIn(jsStringClass, 'toString'); |
| 389 | 395 |
| 390 objectEquals = compiler.lookupElementIn(coreClasses.objectClass, '=='); | 396 objectEquals = compiler.lookupElementIn(coreClasses.objectClass, '=='); |
| 391 } | 397 } |
| 392 | 398 |
| 393 Element get badMain { | 399 Element get badMain { |
| 394 return findHelper('badMain'); | 400 return findHelper('badMain'); |
| 395 } | 401 } |
| 396 | 402 |
| 397 Element get missingMain { | 403 Element get missingMain { |
| 398 return findHelper('missingMain'); | 404 return findHelper('missingMain'); |
| 399 } | 405 } |
| 400 | 406 |
| 401 Element get mainHasTooManyParameters { | 407 Element get mainHasTooManyParameters { |
| 402 return findHelper('mainHasTooManyParameters'); | 408 return findHelper('mainHasTooManyParameters'); |
| 403 } | 409 } |
| 404 | 410 |
| 405 Element get loadLibraryWrapper { | 411 MethodElement get loadLibraryWrapper { |
| 406 return findHelper("_loadLibraryWrapper"); | 412 return findHelper("_loadLibraryWrapper"); |
| 407 } | 413 } |
| 408 | 414 |
| 409 Element get boolConversionCheck { | 415 Element get boolConversionCheck { |
| 410 return findHelper('boolConversionCheck'); | 416 return findHelper('boolConversionCheck'); |
| 411 } | 417 } |
| 412 | 418 |
| 413 Element get consoleTraceHelper { | 419 Element get consoleTraceHelper { |
| 414 return findHelper('consoleTraceHelper'); | 420 return findHelper('consoleTraceHelper'); |
| 415 } | 421 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 MethodElement _objectNoSuchMethod; | 723 MethodElement _objectNoSuchMethod; |
| 718 | 724 |
| 719 MethodElement get objectNoSuchMethod { | 725 MethodElement get objectNoSuchMethod { |
| 720 if (_objectNoSuchMethod == null) { | 726 if (_objectNoSuchMethod == null) { |
| 721 _objectNoSuchMethod = | 727 _objectNoSuchMethod = |
| 722 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_); | 728 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_); |
| 723 } | 729 } |
| 724 return _objectNoSuchMethod; | 730 return _objectNoSuchMethod; |
| 725 } | 731 } |
| 726 } | 732 } |
| OLD | NEW |