OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of html; | 5 part of html; |
6 | 6 |
7 class _ConsoleVariables { | 7 class _ConsoleVariables { |
8 Map<String, Object> _data = new Map<String, Object>(); | 8 Map<String, Object> _data = new Map<String, Object>(); |
9 | 9 |
10 /** | 10 /** |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 | 81 |
82 static void populateMap(Map result, List list) { | 82 static void populateMap(Map result, List list) { |
83 for (int i = 0; i < list.length; i += 2) { | 83 for (int i = 0; i < list.length; i += 2) { |
84 result[list[i]] = list[i + 1]; | 84 result[list[i]] = list[i + 1]; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 static bool isMap(obj) => obj is Map; | 88 static bool isMap(obj) => obj is Map; |
89 | 89 |
| 90 static List toListIfIterable(obj) => obj is Iterable ? obj.toList() : null; |
| 91 |
90 static Map createMap() => {}; | 92 static Map createMap() => {}; |
91 | 93 |
92 static makeUnimplementedError(String fileName, int lineNo) { | 94 static makeUnimplementedError(String fileName, int lineNo) { |
93 return new UnsupportedError('[info: $fileName:$lineNo]'); | 95 return new UnsupportedError('[info: $fileName:$lineNo]'); |
94 } | 96 } |
95 | 97 |
96 static bool isTypeSubclassOf(Type type, Type other) { | 98 static bool isTypeSubclassOf(Type type, Type other) { |
97 if (type == other) { | 99 if (type == other) { |
98 return true; | 100 return true; |
99 } | 101 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 * This method is used as Library prefixes include a trailing dot when using | 385 * This method is used as Library prefixes include a trailing dot when using |
384 * the C Dart debugger API. | 386 * the C Dart debugger API. |
385 */ | 387 */ |
386 static String stripTrailingDot(String str) => | 388 static String stripTrailingDot(String str) => |
387 (str != null && str[str.length - 1] == '.') ? str.substring(0, str.length -
1) : str; | 389 (str != null && str[str.length - 1] == '.') ? str.substring(0, str.length -
1) : str; |
388 | 390 |
389 static String addTrailingDot(String str) => '${str}.'; | 391 static String addTrailingDot(String str) => '${str}.'; |
390 | 392 |
391 static bool isNoSuchMethodError(obj) => obj is NoSuchMethodError; | 393 static bool isNoSuchMethodError(obj) => obj is NoSuchMethodError; |
392 | 394 |
393 // TODO(jacobr): we need a failsafe way to determine that a Node is really a | |
394 // DOM node rather than just a class that extends Node. | |
395 static bool isNode(obj) => obj is Node; | |
396 | |
397 static bool _isBuiltinType(ClassMirror cls) { | 395 static bool _isBuiltinType(ClassMirror cls) { |
398 // TODO(vsm): Find a less hackish way to do this. | 396 // TODO(vsm): Find a less hackish way to do this. |
399 LibraryMirror lib = cls.owner; | 397 LibraryMirror lib = cls.owner; |
400 String libName = lib.uri.toString(); | 398 String libName = lib.uri.toString(); |
401 return libName.startsWith('dart:'); | 399 return libName.startsWith('dart:'); |
402 } | 400 } |
403 | 401 |
404 static void register(Document document, String tag, Type type, | 402 static void register(Document document, String tag, Type type, |
405 String extendsTagName) { | 403 String extendsTagName) { |
406 // TODO(vsm): Move these checks into native code. | 404 // TODO(vsm): Move these checks into native code. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 _scheduleImmediateHelper._schedule(callback); | 569 _scheduleImmediateHelper._schedule(callback); |
572 }; | 570 }; |
573 | 571 |
574 get _pureIsolateScheduleImmediateClosure => ((void callback()) => | 572 get _pureIsolateScheduleImmediateClosure => ((void callback()) => |
575 throw new UnimplementedError("scheduleMicrotask in background isolates " | 573 throw new UnimplementedError("scheduleMicrotask in background isolates " |
576 "are not supported in the browser")); | 574 "are not supported in the browser")); |
577 | 575 |
578 void _initializeCustomElement(Element e) { | 576 void _initializeCustomElement(Element e) { |
579 _Utils.initializeCustomElement(e); | 577 _Utils.initializeCustomElement(e); |
580 } | 578 } |
OLD | NEW |