Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
scripts.systemhtml.DartLibrary Class Reference

Public Member Functions

 __init__ (self, name, template_loader, library_type, output_dir, dart_js_interop)
 
 AddFile (self, path)
 
 AddTypeEntry (self, idl_name, dart_name)
 
 Emit (self, emitter, auxiliary_dir)
 

Protected Attributes

 _template
 
 _dart_path
 
 _paths
 
 _typeMap
 
 _dart_js_interop
 

Detailed Description

Definition at line 2292 of file systemhtml.py.

Constructor & Destructor Documentation

◆ __init__()

scripts.systemhtml.DartLibrary.__init__ (   self,
  name,
  template_loader,
  library_type,
  output_dir,
  dart_js_interop 
)

Definition at line 2294 of file systemhtml.py.

2295 dart_js_interop):
2296 self._template = template_loader.Load(
2297 '%s_%s.darttemplate' % (name, library_type))
2298 self._dart_path = os.path.join(output_dir,
2299 '%s_%s.dart' % (name, library_type))
2300 self._paths = []
2301 self._typeMap = {}
2302 self._dart_js_interop = dart_js_interop
2303

Member Function Documentation

◆ AddFile()

scripts.systemhtml.DartLibrary.AddFile (   self,
  path 
)

Definition at line 2304 of file systemhtml.py.

2304 def AddFile(self, path):
2305 self._paths.append(path)
2306
static void append(char **dst, size_t *count, const char *src, size_t n)
Definition editor.cpp:211

◆ AddTypeEntry()

scripts.systemhtml.DartLibrary.AddTypeEntry (   self,
  idl_name,
  dart_name 
)

Definition at line 2307 of file systemhtml.py.

2307 def AddTypeEntry(self, idl_name, dart_name):
2308 self._typeMap[idl_name] = dart_name
2309

◆ Emit()

scripts.systemhtml.DartLibrary.Emit (   self,
  emitter,
  auxiliary_dir 
)

Definition at line 2310 of file systemhtml.py.

2310 def Emit(self, emitter, auxiliary_dir):
2311
2312 def massage_path(path):
2313 # The most robust way to emit path separators is to use / always.
2314 return path.replace('\\', '/')
2315
2316 library_emitter = emitter.FileEmitter(self._dart_path)
2317 library_file_dir = os.path.dirname(self._dart_path)
2318 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir)
2319 emitters = library_emitter.Emit(
2320 self._template,
2321 AUXILIARY_DIR=massage_path(auxiliary_dir),
2322 NULLABLE='?')
2323 if isinstance(emitters, tuple):
2324 imports_emitter, map_emitter = emitters
2325 else:
2326 imports_emitter, map_emitter = emitters, None
2327
2328 for path in sorted(self._paths):
2329 relpath = os.path.relpath(path, library_file_dir)
2330 imports_emitter.Emit("part '$PATH';\n", PATH=massage_path(relpath))
2331
2332 # Emit the $!TYPE_MAP
2333 if map_emitter:
2334 items = list(self._typeMap.items())
2335 items.sort()
2336 for (idl_name, dart_name) in items:
2337 map_emitter.Emit(
2338 " '$IDL_NAME': () => $DART_NAME.instanceRuntimeType,\n",
2339 IDL_NAME=idl_name,
2340 DART_NAME=dart_name)
2341
2342
2343# ------------------------------------------------------------------------------
2344
2345

Member Data Documentation

◆ _dart_js_interop

scripts.systemhtml.DartLibrary._dart_js_interop
protected

Definition at line 2302 of file systemhtml.py.

◆ _dart_path

scripts.systemhtml.DartLibrary._dart_path
protected

Definition at line 2298 of file systemhtml.py.

◆ _paths

scripts.systemhtml.DartLibrary._paths
protected

Definition at line 2300 of file systemhtml.py.

◆ _template

scripts.systemhtml.DartLibrary._template
protected

Definition at line 2296 of file systemhtml.py.

◆ _typeMap

scripts.systemhtml.DartLibrary._typeMap
protected

Definition at line 2301 of file systemhtml.py.


The documentation for this class was generated from the following file: