Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: pkg/compiler/lib/src/compiler.dart

Issue 2681123004: Handle Native("...") annotations in KernelBehaviorBuilder. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/core_types.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 dart2js.compiler_base; 5 library dart2js.compiler_base;
6 6
7 import 'dart:async' show EventSink, Future; 7 import 'dart:async' show EventSink, Future;
8 8
9 import '../compiler_new.dart' as api; 9 import '../compiler_new.dart' as api;
10 import 'closure.dart' as closureMapping show ClosureTask; 10 import 'closure.dart' as closureMapping show ClosureTask;
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 final Resolution resolution; 1104 final Resolution resolution;
1105 final DiagnosticReporter reporter; 1105 final DiagnosticReporter reporter;
1106 1106
1107 final ElementEnvironment environment; 1107 final ElementEnvironment environment;
1108 1108
1109 LibraryElement coreLibrary; 1109 LibraryElement coreLibrary;
1110 LibraryElement asyncLibrary; 1110 LibraryElement asyncLibrary;
1111 LibraryElement mirrorsLibrary; 1111 LibraryElement mirrorsLibrary;
1112 LibraryElement typedDataLibrary; 1112 LibraryElement typedDataLibrary;
1113 1113
1114 // TODO(sigmund): possibly move this to target-specific collection of
1115 // elements, or refactor the library so that the helpers we need are in a
1116 // target-agnostic place. Currently we are using @patch and @Native from
1117 // here. We hope we can make those independent of the backend and generic
1118 // enough so the patching algorithm can work without being configured for a
1119 // specific backend.
1120 LibraryElement jsHelperLibrary;
1121
1122 _CompilerCommonElements(this.environment, this.resolution, this.reporter); 1114 _CompilerCommonElements(this.environment, this.resolution, this.reporter);
1123 1115
1124 // From dart:_js_helper
1125 // TODO(sigmund,johnniwinther): refactor needed: either these move to a
1126 // backend-specific collection of helpers, or the helper code moves to a
1127 // backend agnostic library (see commend above on [jsHelperLibrary].
1128
1129 ClassElement _patchAnnotationClass;
1130 ClassElement get patchAnnotationClass =>
1131 _patchAnnotationClass ??= _findLibraryMember(jsHelperLibrary, '_Patch');
1132
1133 ClassElement _nativeAnnotationClass;
1134 ClassElement get nativeAnnotationClass =>
1135 _nativeAnnotationClass ??= _findLibraryMember(jsHelperLibrary, 'Native');
1136
1137 @override 1116 @override
1138 ResolutionDynamicType get dynamicType => const ResolutionDynamicType(); 1117 ResolutionDynamicType get dynamicType => const ResolutionDynamicType();
1139 1118
1140 void onLibraryCreated(LibraryElement library) { 1119 void onLibraryCreated(LibraryElement library) {
1141 Uri uri = library.canonicalUri; 1120 Uri uri = library.canonicalUri;
1142 if (uri == Uris.dart_core) { 1121 if (uri == Uris.dart_core) {
1143 coreLibrary = library; 1122 coreLibrary = library;
1144 } else if (uri == Uris.dart_async) { 1123 } else if (uri == Uris.dart_async) {
1145 asyncLibrary = library; 1124 asyncLibrary = library;
1146 } else if (uri == Uris.dart__native_typed_data) { 1125 } else if (uri == Uris.dart__native_typed_data) {
1147 typedDataLibrary = library; 1126 typedDataLibrary = library;
1148 } else if (uri == Uris.dart_mirrors) { 1127 } else if (uri == Uris.dart_mirrors) {
1149 mirrorsLibrary = library; 1128 mirrorsLibrary = library;
1150 } else if (uri == js_backend.BackendHelpers.DART_JS_HELPER) {
1151 jsHelperLibrary = library;
1152 } 1129 }
1153 } 1130 }
1154 1131
1155 @override 1132 @override
1156 MemberElement findLibraryMember(LibraryElement library, String name, 1133 MemberElement findLibraryMember(LibraryElement library, String name,
1157 {bool setter: false, bool required: true}) { 1134 {bool setter: false, bool required: true}) {
1158 Element member = _findLibraryMember(library, name, required: required); 1135 Element member = _findLibraryMember(library, name, required: required);
1159 if (member != null && member.isAbstractField) { 1136 if (member != null && member.isAbstractField) {
1160 AbstractFieldElement abstractField = member; 1137 AbstractFieldElement abstractField = member;
1161 if (setter) { 1138 if (setter) {
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 if (library != null && library.isSynthesized) { 2067 if (library != null && library.isSynthesized) {
2091 return null; 2068 return null;
2092 } 2069 }
2093 if (library == null && required) { 2070 if (library == null && required) {
2094 throw new SpannableAssertionFailure( 2071 throw new SpannableAssertionFailure(
2095 library, "The library '${uri}' was not found."); 2072 library, "The library '${uri}' was not found.");
2096 } 2073 }
2097 return library; 2074 return library;
2098 } 2075 }
2099 } 2076 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/core_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698