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

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

Issue 1530563003: Generate all runtime files from dart. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: simplify diff in js_codegen.dart Created 4 years, 11 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) 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
(...skipping 30 matching lines...) Expand all
41 /// instead of `@JS` from `package:js`). 41 /// instead of `@JS` from `package:js`).
42 bool isJSExportNameAnnotation(DartObjectImpl value) { 42 bool isJSExportNameAnnotation(DartObjectImpl value) {
43 var e = value?.type?.element; 43 var e = value?.type?.element;
44 if (e?.name != 'JSExportName') return false; 44 if (e?.name != 'JSExportName') return false;
45 var uri = e.source.uri; 45 var uri = e.source.uri;
46 return uri.scheme == 'dart' && uri.path == '_foreign_helper'; 46 return uri.scheme == 'dart' && uri.path == '_foreign_helper';
47 } 47 }
48 48
49 bool isJsPeerInterface(DartObjectImpl value) => 49 bool isJsPeerInterface(DartObjectImpl value) =>
50 value.type.name == 'JsPeerInterface'; 50 value.type.name == 'JsPeerInterface';
51
52 /// Whether this invocation represents a `genericTypeConstructor` intrinsic
53 /// call, meant to be used only inside `JS` templates.
54 ///
55 /// That intrinsic function is only to be used in JS expressions inside the SDK.
56 /// For instance `JS('', '#(type)', genericTypeConstructor(List))` will
57 /// generate `core.List$(type)`.
58 bool isGenericTypeConstructorIntrinsic(MethodInvocation i) =>
59 _isJsLibType('genericTypeConstructor', i.methodName?.bestElement) &&
60 i.argumentList.arguments.length == 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698