From 74f4065caa7254b0e30afa955aa59092024decdb Mon Sep 17 00:00:00 2001 From: Yulong Bai Date: Fri, 15 Jun 2018 14:44:19 +0200 Subject: Add basic support for EcmaScript classes Most of the class creation is done inside the runtime in the CreateClass method. Added a corresponding instruction to the interpreter and jit. The compiled data now contains an array of classes containing the compile time generated layout of the class. Currently, classes without an explicit constructor and classes with inheritance are not supported. Done-with: Yulong Bai Change-Id: I0185dcc1e3b0b8f44deff74e44a8262fc646aa9e Reviewed-by: Simon Hausmann --- src/qml/compiler/qv4instr_moth_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qml/compiler/qv4instr_moth_p.h') diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index 85b30507a1..3bd60288c3 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -137,6 +137,7 @@ QT_BEGIN_NAMESPACE #define INSTR_DeclareVar(op) INSTRUCTION(op, DeclareVar, 2, varName, isDeletable) #define INSTR_DefineArray(op) INSTRUCTION(op, DefineArray, 2, argc, args) #define INSTR_DefineObjectLiteral(op) INSTRUCTION(op, DefineObjectLiteral, 3, internalClassId, argc, args) +#define INSTR_CreateClass(op) INSTRUCTION(op, CreateClass, 3, classIndex, heritage, computedNames) #define INSTR_CreateMappedArgumentsObject(op) INSTRUCTION(op, CreateMappedArgumentsObject, 0) #define INSTR_CreateUnmappedArgumentsObject(op) INSTRUCTION(op, CreateUnmappedArgumentsObject, 0) #define INSTR_CreateRestParameter(op) INSTRUCTION(op, CreateRestParameter, 1, argIndex) @@ -265,6 +266,7 @@ QT_BEGIN_NAMESPACE F(DeclareVar) \ F(DefineArray) \ F(DefineObjectLiteral) \ + F(CreateClass) \ F(CreateMappedArgumentsObject) \ F(CreateUnmappedArgumentsObject) \ F(CreateRestParameter) \ -- cgit v1.2.3