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

Side by Side Diff: lib/src/compiler/extension_types.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
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:analyzer/dart/element/element.dart' show Element;
6 import 'package:analyzer/dart/element/visitor.dart'
7 show GeneralizingElementVisitor;
8 import 'package:collection/collection.dart' show binarySearch;
9
10 class ExtensionTypeSet extends GeneralizingElementVisitor {
11 bool contains(Element element) {
12 var library = element?.library;
13 if (library == null) return false;
14
15 var source = library.source;
16 if (source.isInSystemLibrary) {
17 var types = _extensionTypes[source.uri.toString()];
18 if (types != null) {
19 int index = binarySearch(types, element.name);
20 return index >= 0;
21 }
22 }
23 return false;
24 }
25
26 // TODO(vsm): Eventually, we want to make this extensible - i.e., find
27 // annotations in user code as well. It would need to be summarized in
28 // the element model - not searched this way on every compile. To make this
29 // a little more efficient now, we do this in two phases.
30 final _extensionTypes = {
31 'dart:_interceptors': [
32 'Interceptor',
33 'JSArray',
34 'JSBool',
35 'JSIndexable',
36 'JSMutableIndexable',
37 'JSNumber',
38 'JSString'
39 ],
40 'dart:_internal': ['FixedLengthListMixin'],
41 'dart:_js_helper': ['JavaScriptIndexingBehavior'],
42 'dart:_native_typed_data': [
43 'NativeByteBuffer',
44 'NativeByteData',
45 'NativeFloat32List',
46 'NativeFloat64List',
47 'NativeInt16List',
48 'NativeInt32List',
49 'NativeInt8List',
50 'NativeTypedArray',
51 'NativeTypedArrayOfDouble',
52 'NativeTypedArrayOfInt',
53 'NativeTypedData',
54 'NativeUint16List',
55 'NativeUint32List',
56 'NativeUint8ClampedList',
57 'NativeUint8List'
58 ],
59 'dart:collection': ['ListMixin'],
60 'dart:core': [
61 'Comparable',
62 'Iterable',
63 'List',
64 'Map',
65 'Pattern',
66 'String',
67 'bool',
68 'double',
69 'int',
70 'num'
71 ],
72 'dart:indexed_db': [
73 'Cursor',
74 'CursorWithValue',
75 'Database',
76 'IdbFactory',
77 'Index',
78 'KeyRange',
79 'ObjectStore',
80 'OpenDBRequest',
81 'Request',
82 'Transaction',
83 'VersionChangeEvent'
84 ],
85 'dart:math': ['Rectangle', '_RectangleBase'],
86 'dart:typed_data': [
87 'ByteBuffer',
88 'ByteData',
89 'Float32List',
90 'Float64List',
91 'Int16List',
92 'Int32List',
93 'Int8List',
94 'TypedData',
95 'Uint16List',
96 'Uint32List',
97 'Uint8ClampedList',
98 'Uint8List'
99 ],
100 'dart:html': [
101 'AbstractWorker',
102 'AnchorElement',
103 'Animation',
104 'AnimationEffect',
105 'AnimationEvent',
106 'AnimationNode',
107 'AnimationPlayer',
108 'AnimationPlayerEvent',
109 'AnimationTimeline',
110 'ApplicationCache',
111 'ApplicationCacheErrorEvent',
112 'AreaElement',
113 'AudioElement',
114 'AudioTrack',
115 'AudioTrackList',
116 'AutocompleteErrorEvent',
117 'BRElement',
118 'BarProp',
119 'BaseElement',
120 'BatteryManager',
121 'BeforeUnloadEvent',
122 'Blob',
123 'Body',
124 'BodyElement',
125 'ButtonElement',
126 'ButtonInputElement',
127 'CDataSection',
128 'CacheStorage',
129 'Canvas2DContextAttributes',
130 'CanvasElement',
131 'CanvasGradient',
132 'CanvasImageSource',
133 'CanvasPattern',
134 'CanvasRenderingContext',
135 'CanvasRenderingContext2D',
136 'CharacterData',
137 'CheckboxInputElement',
138 'ChildNode',
139 'CircularGeofencingRegion',
140 'CloseEvent',
141 'Comment',
142 'CompositionEvent',
143 'ConsoleBase',
144 'ContentElement',
145 'Coordinates',
146 'Credential',
147 'CredentialsContainer',
148 'Crypto',
149 'CryptoKey',
150 'Css',
151 'CssCharsetRule',
152 'CssFilterRule',
153 'CssFontFaceRule',
154 'CssImportRule',
155 'CssKeyframeRule',
156 'CssKeyframesRule',
157 'CssMediaRule',
158 'CssPageRule',
159 'CssRule',
160 'CssStyleDeclaration',
161 'CssStyleDeclarationBase',
162 'CssStyleRule',
163 'CssStyleSheet',
164 'CssSupportsRule',
165 'CssViewportRule',
166 'CustomEvent',
167 'DListElement',
168 'DataListElement',
169 'DataTransfer',
170 'DataTransferItem',
171 'DataTransferItemList',
172 'DateInputElement',
173 'DedicatedWorkerGlobalScope',
174 'DeprecatedStorageInfo',
175 'DeprecatedStorageQuota',
176 'DetailsElement',
177 'DeviceAcceleration',
178 'DeviceLightEvent',
179 'DeviceMotionEvent',
180 'DeviceOrientationEvent',
181 'DeviceRotationRate',
182 'DialogElement',
183 'DirectoryEntry',
184 'DirectoryReader',
185 'DivElement',
186 'Document',
187 'DocumentFragment',
188 'DomError',
189 'DomException',
190 'DomImplementation',
191 'DomIterator',
192 'DomMatrix',
193 'DomMatrixReadOnly',
194 'DomParser',
195 'DomPoint',
196 'DomPointReadOnly',
197 'DomRectReadOnly',
198 'DomSettableTokenList',
199 'DomStringList',
200 'DomTokenList',
201 'Element',
202 'EmailInputElement',
203 'EmbedElement',
204 'Entry',
205 'ErrorEvent',
206 'Event',
207 'EventSource',
208 'EventTarget',
209 'ExtendableEvent',
210 'FederatedCredential',
211 'FetchEvent',
212 'FieldSetElement',
213 'File',
214 'FileEntry',
215 'FileError',
216 'FileList',
217 'FileReader',
218 'FileStream',
219 'FileSystem',
220 'FileUploadInputElement',
221 'FileWriter',
222 'FocusEvent',
223 'FontFace',
224 'FontFaceSet',
225 'FontFaceSetLoadEvent',
226 'FormData',
227 'FormElement',
228 'Gamepad',
229 'GamepadButton',
230 'GamepadEvent',
231 'Geofencing',
232 'GeofencingRegion',
233 'Geolocation',
234 'Geoposition',
235 'GlobalEventHandlers',
236 'HRElement',
237 'HashChangeEvent',
238 'HeadElement',
239 'Headers',
240 'HeadingElement',
241 'HiddenInputElement',
242 'History',
243 'HistoryBase',
244 'HtmlCollection',
245 'HtmlDocument',
246 'HtmlElement',
247 'HtmlFormControlsCollection',
248 'HtmlHtmlElement',
249 'HtmlOptionsCollection',
250 'HttpRequest',
251 'HttpRequestEventTarget',
252 'HttpRequestUpload',
253 'IFrameElement',
254 'ImageBitmap',
255 'ImageButtonInputElement',
256 'ImageData',
257 'ImageElement',
258 'ImmutableListMixin',
259 'InjectedScriptHost',
260 'InputElement',
261 'InputElementBase',
262 'InputMethodContext',
263 'InstallEvent',
264 'KeyboardEvent',
265 'KeygenElement',
266 'LIElement',
267 'LabelElement',
268 'LegendElement',
269 'LinkElement',
270 'LocalCredential',
271 'LocalDateTimeInputElement',
272 'Location',
273 'LocationBase',
274 'MapElement',
275 'MediaController',
276 'MediaDeviceInfo',
277 'MediaElement',
278 'MediaError',
279 'MediaKeyError',
280 'MediaKeyEvent',
281 'MediaKeyMessageEvent',
282 'MediaKeyNeededEvent',
283 'MediaKeySession',
284 'MediaKeys',
285 'MediaList',
286 'MediaQueryList',
287 'MediaQueryListEvent',
288 'MediaSource',
289 'MediaStream',
290 'MediaStreamEvent',
291 'MediaStreamTrack',
292 'MediaStreamTrackEvent',
293 'MemoryInfo',
294 'MenuElement',
295 'MenuItemElement',
296 'MessageChannel',
297 'MessageEvent',
298 'MessagePort',
299 'MetaElement',
300 'Metadata',
301 'MeterElement',
302 'MidiAccess',
303 'MidiConnectionEvent',
304 'MidiInput',
305 'MidiInputMap',
306 'MidiMessageEvent',
307 'MidiOutput',
308 'MidiOutputMap',
309 'MidiPort',
310 'MimeType',
311 'MimeTypeArray',
312 'ModElement',
313 'MonthInputElement',
314 'MouseEvent',
315 'MutationObserver',
316 'MutationRecord',
317 'Navigator',
318 'NavigatorCpu',
319 'NavigatorID',
320 'NavigatorLanguage',
321 'NavigatorOnLine',
322 'NavigatorUserMediaError',
323 'NetworkInformation',
324 'Node',
325 'NodeFilter',
326 'NodeIterator',
327 'NodeList',
328 'Notification',
329 'NumberInputElement',
330 'OListElement',
331 'ObjectElement',
332 'OptGroupElement',
333 'OptionElement',
334 'OutputElement',
335 'OverflowEvent',
336 'PageTransitionEvent',
337 'ParagraphElement',
338 'ParamElement',
339 'ParentNode',
340 'PasswordInputElement',
341 'Path2D',
342 'Performance',
343 'PerformanceEntry',
344 'PerformanceMark',
345 'PerformanceMeasure',
346 'PerformanceNavigation',
347 'PerformanceResourceTiming',
348 'PerformanceTiming',
349 'PictureElement',
350 'Plugin',
351 'PluginArray',
352 'PluginPlaceholderElement',
353 'PopStateEvent',
354 'PositionError',
355 'PreElement',
356 'Presentation',
357 'ProcessingInstruction',
358 'ProgressElement',
359 'ProgressEvent',
360 'PushEvent',
361 'PushManager',
362 'PushRegistration',
363 'QuoteElement',
364 'RadioButtonInputElement',
365 'Range',
366 'RangeInputElement',
367 'RangeInputElementBase',
368 'ReadableStream',
369 'RelatedEvent',
370 'ResetButtonInputElement',
371 'ResourceProgressEvent',
372 'RtcDataChannel',
373 'RtcDataChannelEvent',
374 'RtcDtmfSender',
375 'RtcDtmfToneChangeEvent',
376 'RtcIceCandidate',
377 'RtcIceCandidateEvent',
378 'RtcPeerConnection',
379 'RtcSessionDescription',
380 'RtcStatsReport',
381 'RtcStatsResponse',
382 'Screen',
383 'ScreenOrientation',
384 'ScriptElement',
385 'SearchInputElement',
386 'SecurityPolicyViolationEvent',
387 'SelectElement',
388 'Selection',
389 'ServiceWorkerClient',
390 'ServiceWorkerClients',
391 'ServiceWorkerContainer',
392 'ServiceWorkerGlobalScope',
393 'ServiceWorkerRegistration',
394 'ShadowElement',
395 'ShadowRoot',
396 'SharedWorker',
397 'SharedWorkerGlobalScope',
398 'SourceBuffer',
399 'SourceBufferList',
400 'SourceElement',
401 'SourceInfo',
402 'SpanElement',
403 'SpeechGrammar',
404 'SpeechGrammarList',
405 'SpeechRecognition',
406 'SpeechRecognitionAlternative',
407 'SpeechRecognitionError',
408 'SpeechRecognitionEvent',
409 'SpeechRecognitionResult',
410 'SpeechSynthesis',
411 'SpeechSynthesisEvent',
412 'SpeechSynthesisUtterance',
413 'SpeechSynthesisVoice',
414 'Storage',
415 'StorageEvent',
416 'StorageInfo',
417 'StorageQuota',
418 'StyleElement',
419 'StyleMedia',
420 'StyleSheet',
421 'SubmitButtonInputElement',
422 'TableCaptionElement',
423 'TableCellElement',
424 'TableColElement',
425 'TableElement',
426 'TableRowElement',
427 'TableSectionElement',
428 'TelephoneInputElement',
429 'TemplateElement',
430 'Text',
431 'TextAreaElement',
432 'TextEvent',
433 'TextInputElement',
434 'TextInputElementBase',
435 'TextMetrics',
436 'TextTrack',
437 'TextTrackCue',
438 'TextTrackCueList',
439 'TextTrackList',
440 'TimeInputElement',
441 'TimeRanges',
442 'Timing',
443 'TitleElement',
444 'Touch',
445 'TouchEvent',
446 'TouchList',
447 'TrackElement',
448 'TrackEvent',
449 'TransitionEvent',
450 'TreeWalker',
451 'UIEvent',
452 'UListElement',
453 'UnknownElement',
454 'Url',
455 'UrlInputElement',
456 'UrlUtils',
457 'UrlUtilsReadOnly',
458 'ValidityState',
459 'VideoElement',
460 'VideoPlaybackQuality',
461 'VideoTrack',
462 'VideoTrackList',
463 'VttCue',
464 'VttRegion',
465 'VttRegionList',
466 'WebSocket',
467 'WeekInputElement',
468 'WheelEvent',
469 'Window',
470 'WindowBase',
471 'WindowBase64',
472 'WindowEventHandlers',
473 'Worker',
474 'WorkerConsole',
475 'WorkerGlobalScope',
476 'WorkerPerformance',
477 'XPathEvaluator',
478 'XPathExpression',
479 'XPathNSResolver',
480 'XPathResult',
481 'XmlDocument',
482 'XmlSerializer',
483 'XsltProcessor',
484 '_Attr',
485 '_CSSPrimitiveValue',
486 '_CSSUnknownRule',
487 '_CSSValue',
488 '_Cache',
489 '_CanvasPathMethods',
490 '_ClientRect',
491 '_ClientRectList',
492 '_Counter',
493 '_CssRuleList',
494 '_CssValueList',
495 '_DOMFileSystemSync',
496 '_DirectoryEntrySync',
497 '_DirectoryReaderSync',
498 '_DocumentType',
499 '_DomRect',
500 '_EntryArray',
501 '_EntrySync',
502 '_FileEntrySync',
503 '_FileReaderSync',
504 '_FileWriterSync',
505 '_GamepadList',
506 '_HTMLAllCollection',
507 '_HTMLAppletElement',
508 '_HTMLDirectoryElement',
509 '_HTMLFontElement',
510 '_HTMLFrameElement',
511 '_HTMLFrameSetElement',
512 '_HTMLMarqueeElement',
513 '_MutationEvent',
514 '_NamedNodeMap',
515 '_PagePopupController',
516 '_RGBColor',
517 '_Rect',
518 '_Request',
519 '_Response',
520 '_ServiceWorker',
521 '_SpeechRecognitionResultList',
522 '_StyleSheetList',
523 '_SubtleCrypto',
524 '_WebKitCSSFilterValue',
525 '_WebKitCSSMatrix',
526 '_WebKitCSSTransformValue',
527 '_WindowTimers',
528 '_WorkerLocation',
529 '_WorkerNavigator',
530 '_XMLHttpRequestProgressEvent'
531 ],
532 'dart:svg': [
533 'AElement',
534 'AltGlyphElement',
535 'Angle',
536 'AnimateElement',
537 'AnimateMotionElement',
538 'AnimateTransformElement',
539 'AnimatedAngle',
540 'AnimatedBoolean',
541 'AnimatedEnumeration',
542 'AnimatedInteger',
543 'AnimatedLength',
544 'AnimatedLengthList',
545 'AnimatedNumber',
546 'AnimatedNumberList',
547 'AnimatedPreserveAspectRatio',
548 'AnimatedRect',
549 'AnimatedString',
550 'AnimatedTransformList',
551 'AnimationElement',
552 'CircleElement',
553 'ClipPathElement',
554 'DefsElement',
555 'DescElement',
556 'DiscardElement',
557 'EllipseElement',
558 'FEBlendElement',
559 'FEColorMatrixElement',
560 'FEComponentTransferElement',
561 'FECompositeElement',
562 'FEConvolveMatrixElement',
563 'FEDiffuseLightingElement',
564 'FEDisplacementMapElement',
565 'FEDistantLightElement',
566 'FEFloodElement',
567 'FEFuncAElement',
568 'FEFuncBElement',
569 'FEFuncGElement',
570 'FEFuncRElement',
571 'FEGaussianBlurElement',
572 'FEImageElement',
573 'FEMergeElement',
574 'FEMergeNodeElement',
575 'FEMorphologyElement',
576 'FEOffsetElement',
577 'FEPointLightElement',
578 'FESpecularLightingElement',
579 'FESpotLightElement',
580 'FETileElement',
581 'FETurbulenceElement',
582 'FilterElement',
583 'FilterPrimitiveStandardAttributes',
584 'FitToViewBox',
585 'ForeignObjectElement',
586 'GElement',
587 'GeometryElement',
588 'GraphicsElement',
589 'ImageElement',
590 'Length',
591 'LengthList',
592 'LineElement',
593 'LinearGradientElement',
594 'MarkerElement',
595 'MaskElement',
596 'Matrix',
597 'MetadataElement',
598 'Number',
599 'NumberList',
600 'PathElement',
601 'PathSeg',
602 'PathSegArcAbs',
603 'PathSegArcRel',
604 'PathSegClosePath',
605 'PathSegCurvetoCubicAbs',
606 'PathSegCurvetoCubicRel',
607 'PathSegCurvetoCubicSmoothAbs',
608 'PathSegCurvetoCubicSmoothRel',
609 'PathSegCurvetoQuadraticAbs',
610 'PathSegCurvetoQuadraticRel',
611 'PathSegCurvetoQuadraticSmoothAbs',
612 'PathSegCurvetoQuadraticSmoothRel',
613 'PathSegLinetoAbs',
614 'PathSegLinetoHorizontalAbs',
615 'PathSegLinetoHorizontalRel',
616 'PathSegLinetoRel',
617 'PathSegLinetoVerticalAbs',
618 'PathSegLinetoVerticalRel',
619 'PathSegList',
620 'PathSegMovetoAbs',
621 'PathSegMovetoRel',
622 'PatternElement',
623 'Point',
624 'PointList',
625 'PolygonElement',
626 'PolylineElement',
627 'PreserveAspectRatio',
628 'RadialGradientElement',
629 'Rect',
630 'RectElement',
631 'RenderingIntent',
632 'ScriptElement',
633 'SetElement',
634 'StopElement',
635 'StringList',
636 'StyleElement',
637 'SvgElement',
638 'SvgSvgElement',
639 'SwitchElement',
640 'SymbolElement',
641 'TSpanElement',
642 'Tests',
643 'TextContentElement',
644 'TextElement',
645 'TextPathElement',
646 'TextPositioningElement',
647 'TitleElement',
648 'Transform',
649 'TransformList',
650 'UnitTypes',
651 'UriReference',
652 'UseElement',
653 'ViewElement',
654 'ViewSpec',
655 'ZoomAndPan',
656 'ZoomEvent',
657 '_GradientElement',
658 '_SVGAltGlyphDefElement',
659 '_SVGAltGlyphItemElement',
660 '_SVGComponentTransferFunctionElement',
661 '_SVGCursorElement',
662 '_SVGFEDropShadowElement',
663 '_SVGFontElement',
664 '_SVGFontFaceElement',
665 '_SVGFontFaceFormatElement',
666 '_SVGFontFaceNameElement',
667 '_SVGFontFaceSrcElement',
668 '_SVGFontFaceUriElement',
669 '_SVGGlyphElement',
670 '_SVGGlyphRefElement',
671 '_SVGHKernElement',
672 '_SVGMPathElement',
673 '_SVGMissingGlyphElement',
674 '_SVGVKernElement'
675 ],
676 'dart:web_audio': [
677 'AnalyserNode',
678 'AudioBuffer',
679 'AudioBufferSourceNode',
680 'AudioContext',
681 'AudioDestinationNode',
682 'AudioListener',
683 'AudioNode',
684 'AudioParam',
685 'AudioProcessingEvent',
686 'AudioSourceNode',
687 'BiquadFilterNode',
688 'ChannelMergerNode',
689 'ChannelSplitterNode',
690 'ConvolverNode',
691 'DelayNode',
692 'DynamicsCompressorNode',
693 'GainNode',
694 'MediaElementAudioSourceNode',
695 'MediaStreamAudioDestinationNode',
696 'MediaStreamAudioSourceNode',
697 'OfflineAudioCompletionEvent',
698 'OfflineAudioContext',
699 'OscillatorNode',
700 'PannerNode',
701 'PeriodicWave',
702 'ScriptProcessorNode',
703 'WaveShaperNode'
704 ],
705 'dart:web_gl': [
706 'ActiveInfo',
707 'AngleInstancedArrays',
708 'Buffer',
709 'CompressedTextureAtc',
710 'CompressedTextureETC1',
711 'CompressedTexturePvrtc',
712 'CompressedTextureS3TC',
713 'ContextAttributes',
714 'ContextEvent',
715 'DebugRendererInfo',
716 'DebugShaders',
717 'DepthTexture',
718 'DrawBuffers',
719 'ExtBlendMinMax',
720 'ExtFragDepth',
721 'ExtShaderTextureLod',
722 'ExtTextureFilterAnisotropic',
723 'Framebuffer',
724 'LoseContext',
725 'OesElementIndexUint',
726 'OesStandardDerivatives',
727 'OesTextureFloat',
728 'OesTextureFloatLinear',
729 'OesTextureHalfFloat',
730 'OesTextureHalfFloatLinear',
731 'OesVertexArrayObject',
732 'Program',
733 'Renderbuffer',
734 'RenderingContext',
735 'Shader',
736 'ShaderPrecisionFormat',
737 'Texture',
738 'UniformLocation',
739 'VertexArrayObject'
740 ],
741 'dart:web_sql': [
742 'SqlDatabase',
743 'SqlError',
744 'SqlResultSet',
745 'SqlResultSetRowList',
746 'SqlTransaction'
747 ]
748 };
749 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698