| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_backend.backend; | 5 library js_backend.backend; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/backend_api.dart' | 10 import '../common/backend_api.dart' |
| (...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 } | 1467 } |
| 1468 } | 1468 } |
| 1469 | 1469 |
| 1470 class JavaScriptBackendClasses implements BackendClasses { | 1470 class JavaScriptBackendClasses implements BackendClasses { |
| 1471 final ElementEnvironment _env; | 1471 final ElementEnvironment _env; |
| 1472 final BackendHelpers helpers; | 1472 final BackendHelpers helpers; |
| 1473 final NativeBasicData _nativeData; | 1473 final NativeBasicData _nativeData; |
| 1474 | 1474 |
| 1475 JavaScriptBackendClasses(this._env, this.helpers, this._nativeData); | 1475 JavaScriptBackendClasses(this._env, this.helpers, this._nativeData); |
| 1476 | 1476 |
| 1477 ClassElement get intClass => helpers.jsIntClass; | 1477 ClassEntity get intClass => helpers.jsIntClass; |
| 1478 ClassElement get uint32Class => helpers.jsUInt32Class; | 1478 ClassEntity get uint32Class => helpers.jsUInt32Class; |
| 1479 ClassElement get uint31Class => helpers.jsUInt31Class; | 1479 ClassEntity get uint31Class => helpers.jsUInt31Class; |
| 1480 ClassElement get positiveIntClass => helpers.jsPositiveIntClass; | 1480 ClassEntity get positiveIntClass => helpers.jsPositiveIntClass; |
| 1481 ClassElement get doubleClass => helpers.jsDoubleClass; | 1481 ClassEntity get doubleClass => helpers.jsDoubleClass; |
| 1482 ClassElement get numClass => helpers.jsNumberClass; | 1482 ClassEntity get numClass => helpers.jsNumberClass; |
| 1483 ClassElement get stringClass => helpers.jsStringClass; | 1483 ClassEntity get stringClass => helpers.jsStringClass; |
| 1484 ClassElement get listClass => helpers.jsArrayClass; | 1484 ClassEntity get listClass => helpers.jsArrayClass; |
| 1485 ClassElement get mutableListClass => helpers.jsMutableArrayClass; | 1485 ClassEntity get mutableListClass => helpers.jsMutableArrayClass; |
| 1486 ClassElement get constListClass => helpers.jsUnmodifiableArrayClass; | 1486 ClassEntity get constListClass => helpers.jsUnmodifiableArrayClass; |
| 1487 ClassElement get fixedListClass => helpers.jsFixedArrayClass; | 1487 ClassEntity get fixedListClass => helpers.jsFixedArrayClass; |
| 1488 ClassElement get growableListClass => helpers.jsExtendableArrayClass; | 1488 ClassEntity get growableListClass => helpers.jsExtendableArrayClass; |
| 1489 ClassElement get mapClass => helpers.mapLiteralClass; | 1489 ClassEntity get mapClass => helpers.mapLiteralClass; |
| 1490 ClassElement get constMapClass => helpers.constMapLiteralClass; | 1490 ClassEntity get constMapClass => helpers.constMapLiteralClass; |
| 1491 ClassElement get typeClass => helpers.typeLiteralClass; | 1491 ClassEntity get typeClass => helpers.typeLiteralClass; |
| 1492 InterfaceType get typeType => _env.getRawType(typeClass); | 1492 InterfaceType get typeType => _env.getRawType(typeClass); |
| 1493 | 1493 |
| 1494 ClassElement get boolClass => helpers.jsBoolClass; | 1494 ClassEntity get boolClass => helpers.jsBoolClass; |
| 1495 ClassElement get nullClass => helpers.jsNullClass; | 1495 ClassEntity get nullClass => helpers.jsNullClass; |
| 1496 ClassElement get syncStarIterableClass => helpers.syncStarIterable; | 1496 ClassEntity get syncStarIterableClass => helpers.syncStarIterable; |
| 1497 ClassElement get asyncFutureClass => helpers.futureImplementation; | 1497 ClassEntity get asyncFutureClass => helpers.futureImplementation; |
| 1498 ClassElement get asyncStarStreamClass => helpers.controllerStream; | 1498 ClassEntity get asyncStarStreamClass => helpers.controllerStream; |
| 1499 ClassElement get functionClass => helpers.commonElements.functionClass; | 1499 ClassEntity get functionClass => helpers.commonElements.functionClass; |
| 1500 ClassElement get indexableClass => helpers.jsIndexableClass; | 1500 ClassEntity get indexableClass => helpers.jsIndexableClass; |
| 1501 ClassElement get mutableIndexableClass => helpers.jsMutableIndexableClass; | 1501 ClassEntity get mutableIndexableClass => helpers.jsMutableIndexableClass; |
| 1502 ClassElement get indexingBehaviorClass => helpers.jsIndexingBehaviorInterface; | 1502 ClassEntity get indexingBehaviorClass => helpers.jsIndexingBehaviorInterface; |
| 1503 ClassElement get interceptorClass => helpers.jsInterceptorClass; | 1503 ClassEntity get interceptorClass => helpers.jsInterceptorClass; |
| 1504 | 1504 |
| 1505 bool isDefaultEqualityImplementation(MemberElement element) { | 1505 bool isDefaultEqualityImplementation(MemberEntity element) { |
| 1506 assert(element.name == '=='); | 1506 assert(element.name == '=='); |
| 1507 ClassElement classElement = element.enclosingClass; | 1507 ClassEntity classElement = element.enclosingClass; |
| 1508 return classElement == helpers.commonElements.objectClass || | 1508 return classElement == helpers.commonElements.objectClass || |
| 1509 classElement == helpers.jsInterceptorClass || | 1509 classElement == helpers.jsInterceptorClass || |
| 1510 classElement == helpers.jsNullClass; | 1510 classElement == helpers.jsNullClass; |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 @override | 1513 @override |
| 1514 bool isNativeClass(ClassEntity element) { | 1514 bool isNativeClass(ClassEntity element) { |
| 1515 return _nativeData.isNativeClass(element); | 1515 return _nativeData.isNativeClass(element); |
| 1516 } | 1516 } |
| 1517 | 1517 |
| 1518 InterfaceType getConstantMapTypeFor(InterfaceType sourceType, | 1518 InterfaceType getConstantMapTypeFor(InterfaceType sourceType, |
| 1519 {bool hasProtoKey: false, bool onlyStringKeys: false}) { | 1519 {bool hasProtoKey: false, bool onlyStringKeys: false}) { |
| 1520 ClassElement classElement = onlyStringKeys | 1520 ClassEntity classElement = onlyStringKeys |
| 1521 ? (hasProtoKey | 1521 ? (hasProtoKey |
| 1522 ? helpers.constantProtoMapClass | 1522 ? helpers.constantProtoMapClass |
| 1523 : helpers.constantStringMapClass) | 1523 : helpers.constantStringMapClass) |
| 1524 : helpers.generalConstantMapClass; | 1524 : helpers.generalConstantMapClass; |
| 1525 List<DartType> typeArgument = sourceType.typeArguments; | 1525 List<DartType> typeArgument = sourceType.typeArguments; |
| 1526 if (sourceType.treatAsRaw) { | 1526 if (sourceType.treatAsRaw) { |
| 1527 return _env.getRawType(classElement); | 1527 return _env.getRawType(classElement); |
| 1528 } else { | 1528 } else { |
| 1529 return _env.createInterfaceType(classElement, typeArgument); | 1529 return _env.createInterfaceType(classElement, typeArgument); |
| 1530 } | 1530 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 | 1600 |
| 1601 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1601 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
| 1602 return !selector.isGetter; | 1602 return !selector.isGetter; |
| 1603 } | 1603 } |
| 1604 | 1604 |
| 1605 /// Returns `true` if [member] is called from a subclass via `super`. | 1605 /// Returns `true` if [member] is called from a subclass via `super`. |
| 1606 bool isAliasedSuperMember(MemberEntity member) { | 1606 bool isAliasedSuperMember(MemberEntity member) { |
| 1607 return _aliasedSuperMembers.contains(member); | 1607 return _aliasedSuperMembers.contains(member); |
| 1608 } | 1608 } |
| 1609 } | 1609 } |
| OLD | NEW |