Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.annotations; | 5 library js_backend.backend.annotations; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common_elements.dart' show ElementEnvironment; | 8 import '../common_elements.dart' show ElementEnvironment; |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| 11 import '../elements/elements.dart'; | 11 import '../elements/elements.dart'; |
| 12 import '../elements/entities.dart'; | 12 import '../elements/entities.dart'; |
| 13 import 'backend.dart'; | 13 import 'backend.dart'; |
| 14 | 14 |
| 15 /// Handling of special annotations for tests. | 15 /// Handling of special annotations for tests. |
| 16 class Annotations { | 16 class Annotations { |
|
Siggi Cherem (dart-lang)
2017/04/26 17:24:07
another fun rename: OptimizerHintsForTests?
Johnni Winther
2017/04/27 07:25:39
Done.
| |
| 17 static final Uri PACKAGE_EXPECT = | 17 static final Uri PACKAGE_EXPECT = |
| 18 new Uri(scheme: 'package', path: 'expect/expect.dart'); | 18 new Uri(scheme: 'package', path: 'expect/expect.dart'); |
| 19 | 19 |
| 20 final Compiler compiler; | 20 final Compiler compiler; |
| 21 | 21 |
| 22 ClassElement expectNoInlineClass; | 22 ClassEntity expectNoInlineClass; |
| 23 ClassElement expectTrustTypeAnnotationsClass; | 23 ClassEntity expectTrustTypeAnnotationsClass; |
| 24 ClassElement expectAssumeDynamicClass; | 24 ClassEntity expectAssumeDynamicClass; |
| 25 | 25 |
| 26 JavaScriptBackend get backend => compiler.backend; | 26 JavaScriptBackend get backend => compiler.backend; |
| 27 | 27 |
| 28 DiagnosticReporter get reporter => compiler.reporter; | 28 DiagnosticReporter get reporter => compiler.reporter; |
| 29 | 29 |
| 30 ElementEnvironment get _elementEnvironment => compiler.elementEnvironment; | 30 ElementEnvironment get _elementEnvironment => compiler.elementEnvironment; |
| 31 | 31 |
| 32 Annotations(this.compiler); | 32 Annotations(this.compiler); |
| 33 | 33 |
| 34 void onLibraryLoaded(LibraryEntity library) { | 34 void onLibraryLoaded(LibraryEntity library) { |
|
Siggi Cherem (dart-lang)
2017/04/26 17:24:07
btw - it might be nice to move all these lookups t
Johnni Winther
2017/04/27 07:25:39
Done.
| |
| 35 if (library.canonicalUri == PACKAGE_EXPECT) { | 35 if (library.canonicalUri == PACKAGE_EXPECT) { |
| 36 expectNoInlineClass = | 36 expectNoInlineClass = |
| 37 _elementEnvironment.lookupClass(library, 'NoInline'); | 37 _elementEnvironment.lookupClass(library, 'NoInline'); |
| 38 expectTrustTypeAnnotationsClass = | 38 expectTrustTypeAnnotationsClass = |
| 39 _elementEnvironment.lookupClass(library, 'TrustTypeAnnotations'); | 39 _elementEnvironment.lookupClass(library, 'TrustTypeAnnotations'); |
| 40 expectAssumeDynamicClass = | 40 expectAssumeDynamicClass = |
| 41 _elementEnvironment.lookupClass(library, 'AssumeDynamic'); | 41 _elementEnvironment.lookupClass(library, 'AssumeDynamic'); |
| 42 if (expectNoInlineClass == null || | 42 if (expectNoInlineClass == null || |
| 43 expectTrustTypeAnnotationsClass == null || | 43 expectTrustTypeAnnotationsClass == null || |
| 44 expectAssumeDynamicClass == null) { | 44 expectAssumeDynamicClass == null) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 ConstructedConstantValue constructedConstant = value; | 83 ConstructedConstantValue constructedConstant = value; |
| 84 if (constructedConstant.type.element == annotationClass) { | 84 if (constructedConstant.type.element == annotationClass) { |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 return false; | 89 return false; |
| 90 }); | 90 }); |
| 91 } | 91 } |
| 92 } | 92 } |
| OLD | NEW |