| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 7 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 8 final Set<HInstruction> boundsChecked; | 8 final Set<HInstruction> boundsChecked; |
| 9 | 9 |
| 10 JavaScriptItemCompilationContext() | 10 JavaScriptItemCompilationContext() |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 void registerNewSymbol(TreeElements elements) { | 1396 void registerNewSymbol(TreeElements elements) { |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 bool retainGetter(Element element) => isTreeShakingDisabled; | 1399 bool retainGetter(Element element) => isTreeShakingDisabled; |
| 1400 | 1400 |
| 1401 bool retainSetter(Element element) => isTreeShakingDisabled; | 1401 bool retainSetter(Element element) => isTreeShakingDisabled; |
| 1402 | 1402 |
| 1403 bool retainName(SourceString name) => mustPreserveNames; | 1403 bool retainName(SourceString name) => mustPreserveNames; |
| 1404 | 1404 |
| 1405 bool retainMetadataOf(Element element) { | 1405 bool retainMetadataOf(Element element) { |
| 1406 if (mustRetainMetadata) { |
| 1407 // TODO(ahe): This is a little hacky, but I'll have to rewrite this when |
| 1408 // implementing @MirrorsUsed anyways. |
| 1409 compiler.constantHandler.compiledConstants.addAll( |
| 1410 compiler.metadataHandler.compiledConstants); |
| 1411 compiler.metadataHandler.compiledConstants.clear(); |
| 1412 } |
| 1406 if (mustRetainMetadata) hasRetainedMetadata = true; | 1413 if (mustRetainMetadata) hasRetainedMetadata = true; |
| 1407 return mustRetainMetadata; | 1414 return mustRetainMetadata; |
| 1408 } | 1415 } |
| 1409 | 1416 |
| 1410 void onLibraryScanned(LibraryElement library, Uri uri) { | 1417 void onLibraryScanned(LibraryElement library, Uri uri) { |
| 1411 if (uri == Uri.parse('dart:_js_mirrors')) { | 1418 if (uri == Uri.parse('dart:_js_mirrors')) { |
| 1412 disableTreeShakingMarker = | 1419 disableTreeShakingMarker = |
| 1413 library.find(const SourceString('disableTreeShaking')); | 1420 library.find(const SourceString('disableTreeShaking')); |
| 1414 preserveMetadataMarker = | 1421 preserveMetadataMarker = |
| 1415 library.find(const SourceString('preserveMetadata')); | 1422 library.find(const SourceString('preserveMetadata')); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1444 } | 1451 } |
| 1445 } | 1452 } |
| 1446 | 1453 |
| 1447 /// Records that [type] is used by [user.element]. | 1454 /// Records that [type] is used by [user.element]. |
| 1448 class Dependency { | 1455 class Dependency { |
| 1449 final DartType type; | 1456 final DartType type; |
| 1450 final TreeElements user; | 1457 final TreeElements user; |
| 1451 | 1458 |
| 1452 const Dependency(this.type, this.user); | 1459 const Dependency(this.type, this.user); |
| 1453 } | 1460 } |
| OLD | NEW |