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

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

Issue 1879373004: Implement modular compilation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 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 | « lib/src/compiler/js_field_storage.dart ('k') | lib/src/compiler/js_metalet.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 import 'package:analyzer/dart/ast/ast.dart'; 5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/src/generated/constant.dart'; 6 import 'package:analyzer/src/generated/constant.dart';
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
9 8
10 import '../utils.dart'; 9 import 'element_helpers.dart';
11 10
12 bool _isJsLibType(String expectedName, Element e) => 11 bool _isJsLibType(String expectedName, Element e) =>
13 e?.name == expectedName && _isJsLib(e.library); 12 e?.name == expectedName && _isJsLib(e.library);
14 13
15 /// Returns true if [e] represents any library from `package:js` or is the 14 /// Returns true if [e] represents any library from `package:js` or is the
16 /// internal `dart:_js_helper` library. 15 /// internal `dart:_js_helper` library.
17 bool _isJsLib(LibraryElement e) { 16 bool _isJsLib(LibraryElement e) {
18 if (e == null) return false; 17 if (e == null) return false;
19 var uri = e.source.uri; 18 var uri = e.source.uri;
20 if (uri.scheme == 'package' && uri.path.startsWith('js/')) return true; 19 if (uri.scheme == 'package' && uri.path.startsWith('js/')) return true;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 56
58 bool isJsPeerInterface(DartObjectImpl value) => 57 bool isJsPeerInterface(DartObjectImpl value) =>
59 _isBuiltinAnnotation(value, '_js_helper', 'JsPeerInterface'); 58 _isBuiltinAnnotation(value, '_js_helper', 'JsPeerInterface');
60 59
61 bool isNativeAnnotation(DartObjectImpl value) => 60 bool isNativeAnnotation(DartObjectImpl value) =>
62 _isBuiltinAnnotation(value, '_js_helper', 'Native'); 61 _isBuiltinAnnotation(value, '_js_helper', 'Native');
63 62
64 /// Returns the name value of the `JSExportName` annotation (when compiling 63 /// Returns the name value of the `JSExportName` annotation (when compiling
65 /// the SDK), or `null` if there's none. This is used to control the name 64 /// the SDK), or `null` if there's none. This is used to control the name
66 /// under which functions are compiled and exported. 65 /// under which functions are compiled and exported.
67 String getJSExportName(Element e, TypeProvider types) { 66 String getJSExportName(Element e) {
68 if (!e.source.isInSystemLibrary) { 67 if (e.source.isInSystemLibrary) {
69 return null; 68 return getAnnotationName(e, isJSExportNameAnnotation) ?? e.name;
70 } 69 }
71 var jsName = findAnnotation(e, isJSExportNameAnnotation); 70 return e.name;
72 return getConstantField(jsName, 'name', types.stringType)?.toStringValue();
73 } 71 }
OLDNEW
« no previous file with comments | « lib/src/compiler/js_field_storage.dart ('k') | lib/src/compiler/js_metalet.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698