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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 * This method is used as Library prefixes include a trailing dot when using | 388 * This method is used as Library prefixes include a trailing dot when using |
387 * the C Dart debugger API. | 389 * the C Dart debugger API. |
388 */ | 390 */ |
389 static String stripTrailingDot(String str) => | 391 static String stripTrailingDot(String str) => |
390 (str != null && str[str.length - 1] == '.') ? str.substring(0, str.length -
1) : str; | 392 (str != null && str[str.length - 1] == '.') ? str.substring(0, str.length -
1) : str; |
391 | 393 |
392 static String addTrailingDot(String str) => '${str}.'; | 394 static String addTrailingDot(String str) => '${str}.'; |
393 | 395 |
394 static bool isNoSuchMethodError(obj) => obj is NoSuchMethodError; | 396 static bool isNoSuchMethodError(obj) => obj is NoSuchMethodError; |
395 | 397 |
396 // TODO(jacobr): we need a failsafe way to determine that a Node is really a | |
397 // DOM node rather than just a class that extends Node. | |
398 static bool isNode(obj) => obj is Node; | |
399 | |
400 static bool _isBuiltinType(ClassMirror cls) { | 398 static bool _isBuiltinType(ClassMirror cls) { |
401 // TODO(vsm): Find a less hackish way to do this. | 399 // TODO(vsm): Find a less hackish way to do this. |
402 LibraryMirror lib = cls.owner; | 400 LibraryMirror lib = cls.owner; |
403 String libName = lib.uri.toString(); | 401 String libName = lib.uri.toString(); |
404 return libName.startsWith('dart:'); | 402 return libName.startsWith('dart:'); |
405 } | 403 } |
406 | 404 |
407 static void register(Document document, String tag, Type type, | 405 static void register(Document document, String tag, Type type, |
408 String extendsTagName) { | 406 String extendsTagName) { |
409 // TODO(vsm): Move these checks into native code. | 407 // TODO(vsm): Move these checks into native code. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 _scheduleImmediateHelper._schedule(callback); | 572 _scheduleImmediateHelper._schedule(callback); |
575 }; | 573 }; |
576 | 574 |
577 get _pureIsolateScheduleImmediateClosure => ((void callback()) => | 575 get _pureIsolateScheduleImmediateClosure => ((void callback()) => |
578 throw new UnimplementedError("scheduleMicrotask in background isolates " | 576 throw new UnimplementedError("scheduleMicrotask in background isolates " |
579 "are not supported in the browser")); | 577 "are not supported in the browser")); |
580 | 578 |
581 void _initializeCustomElement(Element e) { | 579 void _initializeCustomElement(Element e) { |
582 _Utils.initializeCustomElement(e); | 580 _Utils.initializeCustomElement(e); |
583 } | 581 } |
OLD | NEW |