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

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

Issue 2738513007: Split NativeDataImpl (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import 'package:front_end/src/fasta/scanner.dart' show StringToken, Token; 5 import 'package:front_end/src/fasta/scanner.dart' show StringToken, Token;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/backend_api.dart'; 8 import '../common/backend_api.dart';
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 /// that identifier to the @Native name of the enclosing class 150 /// that identifier to the @Native name of the enclosing class
151 /// 2. If [element] has a @JSName annotation that is not an identifier, 151 /// 2. If [element] has a @JSName annotation that is not an identifier,
152 /// use the declared @JSName as the expression 152 /// use the declared @JSName as the expression
153 /// 3. If [element] does not have a @JSName annotation, qualify the name of 153 /// 3. If [element] does not have a @JSName annotation, qualify the name of
154 /// the method with the @Native name of the enclosing class. 154 /// the method with the @Native name of the enclosing class.
155 void _setNativeNameForStaticMethod(MethodElement element) { 155 void _setNativeNameForStaticMethod(MethodElement element) {
156 String name = _findJsNameFromAnnotation(element); 156 String name = _findJsNameFromAnnotation(element);
157 if (name == null) name = element.name; 157 if (name == null) name = element.name;
158 if (_isIdentifier(name)) { 158 if (_isIdentifier(name)) {
159 List<String> nativeNames = 159 List<String> nativeNames =
160 _nativeDataBuilder.getNativeTagsOfClassRaw(element.enclosingClass); 160 _nativeClassData.getNativeTagsOfClass(element.enclosingClass);
161 if (nativeNames.length != 1) { 161 if (nativeNames.length != 1) {
162 _reporter.internalError( 162 _reporter.internalError(
163 element, 163 element,
164 'Unable to determine a native name for the enclosing class, ' 164 'Unable to determine a native name for the enclosing class, '
165 'options: $nativeNames'); 165 'options: $nativeNames');
166 } 166 }
167 _nativeDataBuilder.setNativeMemberName( 167 _nativeDataBuilder.setNativeMemberName(
168 element, '${nativeNames[0]}.$name'); 168 element, '${nativeNames[0]}.$name');
169 } else { 169 } else {
170 _nativeDataBuilder.setNativeMemberName(element, name); 170 _nativeDataBuilder.setNativeMemberName(element, name);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 JavaScriptBackend backend = compiler.backend; 320 JavaScriptBackend backend = compiler.backend;
321 ResolutionDartType type = constant.getType(compiler.commonElements); 321 ResolutionDartType type = constant.getType(compiler.commonElements);
322 if (type.element != backend.helpers.jsAnnotationClass) { 322 if (type.element != backend.helpers.jsAnnotationClass) {
323 compiler.reporter 323 compiler.reporter
324 .internalError(annotation, 'Invalid @JS(...) annotation.'); 324 .internalError(annotation, 'Invalid @JS(...) annotation.');
325 } 325 }
326 } 326 }
327 327
328 bool get defaultResult => false; 328 bool get defaultResult => false;
329 } 329 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/enqueue.dart ('k') | tests/compiler/dart2js/serialization/native_data_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698