#!/usr/bin/python # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. """This module provides shared functionality to provide Dart metadata for DOM APIs. """ import copy import json import logging import monitored import os import re from generator import ConstantOutputOrder from htmlrenamer import renamed_html_members, html_interface_renames _logger = logging.getLogger('dartmetadata') # Annotations to be placed on native members. The table is indexed by the IDL # interface and member name, and by IDL return or field type name. Both are # used to assemble the annotations: # # INTERFACE.MEMBER: annotations for member. # +TYPE: add annotations only if there are member annotations. # -TYPE: add annotations only if there are no member annotations. # TYPE: add regardless of member annotations. _dart2js_annotations = monitored.Dict('dartmetadata._dart2js_annotations', { 'AnimationEffectTiming.duration': [ "@Creates('Null')", "@Returns('num|String')", ], 'ArrayBufferView': [ "@Creates('TypedData')", "@Returns('TypedData|Null')", ], 'CanvasRenderingContext2D.createImageData': [ "@Creates('ImageData|=Object')", ], 'CanvasRenderingContext2D.getImageData': [ "@Creates('ImageData|=Object')", ], 'CanvasRenderingContext2D.webkitGetImageDataHD': [ "@Creates('ImageData|=Object')", ], 'CanvasRenderingContext2D.fillStyle': [ "@Creates('String|CanvasGradient|CanvasPattern')", "@Returns('String|CanvasGradient|CanvasPattern')", ], 'CanvasRenderingContext2D.strokeStyle': [ "@Creates('String|CanvasGradient|CanvasPattern')", "@Returns('String|CanvasGradient|CanvasPattern')", ], 'CryptoKey.algorithm': [ "@Creates('Null')", ], 'CustomEvent._detail': [ "@Creates('Null')", ], # Normally Window is never null, but starting from a