Runtime.ofProgram constructor
Runtime.ofProgram(
- Program program
Create a Runtime from a Program. This constructor should be preferred where possible as it avoids overhead of loading bytecode.
Implementation
Runtime.ofProgram(Program program)
: id = _id++,
_fromEvc = false,
typeTypes = program.typeTypes,
//typeNames = program.typeNames,
typeIds = program.typeIds,
runtimeTypes = program.runtimeTypes,
_bridgeLibraryMappings = program.bridgeLibraryMappings,
bridgeFuncMappings = program.bridgeFunctionMappings,
bridgeEnumMappings = program.enumMappings,
globalInitializers = program.globalInitializers,
overrideMap = program.overrideMap {
declarations = program.topLevelDeclarations;
constantPool.addAll(program.constantPool);
program.instanceDeclarations.forEach((file, $class) {
final decls = <String, EvalClass>{};
$class.forEach((name, declarations) {
final getters = (declarations[0] as Map).cast<String, int>();
final setters = (declarations[1] as Map).cast<String, int>();
final methods = (declarations[2] as Map).cast<String, int>();
final type = (declarations[3] as int);
final cls =
EvalClass(type, null, [], {...getters}, {...setters}, {...methods});
decls[name] = cls;
});
declaredClasses[file] = decls;
});
pr.addAll(program.ops);
}