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

Side by Side Diff: lib/src/utils.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_interop.dart ('k') | test/codegen/expect/dom/dom.js » ('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 /// Holds a couple utility functions used at various places in the system. 5 /// Holds a couple utility functions used at various places in the system.
6 library dev_compiler.src.utils; 6 library dev_compiler.src.utils;
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 323 }
324 324
325 return path.relative(resourceUri.path, from: entryDir); 325 return path.relative(resourceUri.path, from: entryDir);
326 } 326 }
327 327
328 /// Given an annotated [node] and a [test] function, returns the first matching 328 /// Given an annotated [node] and a [test] function, returns the first matching
329 /// constant valued annotation. 329 /// constant valued annotation.
330 /// 330 ///
331 /// For example if we had the ClassDeclaration node for `FontElement`: 331 /// For example if we had the ClassDeclaration node for `FontElement`:
332 /// 332 ///
333 /// @JsName('HTMLFontElement') 333 /// @js.JS('HTMLFontElement')
334 /// @deprecated 334 /// @deprecated
335 /// class FontElement { ... } 335 /// class FontElement { ... }
336 /// 336 ///
337 /// We could match `@deprecated` with a test function like: 337 /// We could match `@deprecated` with a test function like:
338 /// 338 ///
339 /// (v) => v.type.name == 'Deprecated' && v.type.element.library.isDartCore 339 /// (v) => v.type.name == 'Deprecated' && v.type.element.library.isDartCore
340 /// 340 ///
341 DartObject findAnnotation(Element element, bool test(DartObject value)) { 341 DartObject findAnnotation(Element element, bool test(DartObject value)) {
342 for (var metadata in element.metadata) { 342 for (var metadata in element.metadata) {
343 var value = metadata.constantValue; 343 var value = metadata.constantValue;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 420 }
421 } 421 }
422 422
423 bool isInlineJS(Element e) => e is FunctionElement && 423 bool isInlineJS(Element e) => e is FunctionElement &&
424 e.library.source.uri.toString() == 'dart:_foreign_helper' && 424 e.library.source.uri.toString() == 'dart:_foreign_helper' &&
425 e.name == 'JS'; 425 e.name == 'JS';
426 426
427 bool isDartMathMinMax(Element e) => e is FunctionElement && 427 bool isDartMathMinMax(Element e) => e is FunctionElement &&
428 e.library.source.uri.toString() == 'dart:math' && 428 e.library.source.uri.toString() == 'dart:math' &&
429 (e.name == 'min' || e.name == 'max'); 429 (e.name == 'min' || e.name == 'max');
OLDNEW
« no previous file with comments | « lib/src/codegen/js_interop.dart ('k') | test/codegen/expect/dom/dom.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698