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

Side by Side Diff: lib/src/codegen/js_interop.dart

Issue 1448993002: Switch ddc to use @JS instead of @JSName (Closed) Base URL: git://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 1 month 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 | « lib/src/codegen/js_codegen.dart ('k') | lib/src/utils.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dev_compiler.src.js_interop; 5 library dev_compiler.src.js_interop;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 10
11 bool _isJsLibType(String expectedName, Element e) => 11 bool _isJsLibType(String expectedName, Element e) =>
12 e?.name == expectedName && _isJsLib(e.library); 12 e?.name == expectedName && _isJsLib(e.library);
13 13
14 bool _isJsLib(LibraryElement e) { 14 bool _isJsLib(LibraryElement e) {
15 var libName = e?.name; 15 var libName = e?.name;
16 return libName == 'js' || 16 return libName == 'js' ||
17 libName == 'js.varargs' || 17 libName == 'js.varargs' ||
18 libName == 'dart._js_helper'; 18 libName == 'dart._js_helper';
19 } 19 }
20 20
21 bool isJsRestAnnotation(DartObjectImpl value) => 21 bool isJsRestAnnotation(DartObjectImpl value) =>
22 _isJsLibType('_Rest', value.type.element); 22 _isJsLibType('_Rest', value.type.element);
23 23
24 bool isJsSpreadInvocation(MethodInvocation i) => 24 bool isJsSpreadInvocation(MethodInvocation i) =>
25 _isJsLibType('spread', i.methodName?.bestElement); 25 _isJsLibType('spread', i.methodName?.bestElement);
26 26
27 // TODO(jmesserly): Move JsName, JsPeerInterface to package:js (see issue #135). 27 // TODO(jmesserly): Move JsPeerInterface to package:js (see issue #135).
28 bool isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName'; 28 bool isJSAnnotation(DartObjectImpl value) => value.type.name == 'JS';
29 29
30 bool isJsPeerInterface(DartObjectImpl value) => 30 bool isJsPeerInterface(DartObjectImpl value) =>
31 value.type.name == 'JsPeerInterface'; 31 value.type.name == 'JsPeerInterface';
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698