-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdwsJSCodeGenModule.pas
More file actions
81 lines (69 loc) · 3 KB
/
Copy pathdwsJSCodeGenModule.pas
File metadata and controls
81 lines (69 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{**********************************************************************}
{ }
{ The contents of this file are subject to the GNU General }
{ Public License version 3 (the "License") as published by }
{ the Free Software Foundation. You may obtain a copy of }
{ the License at https://www.gnu.org/licenses/gpl-3.0.txt }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express }
{ or implied. See the License for the specific language }
{ governing rights and limitations under the License. }
{ }
{ Copyright Creative IT. }
{ Current maintainer: Eric Grange }
{ }
{**********************************************************************}
unit dwsJSCodeGenModule;
interface
uses
SysUtils, Classes, dwsComp, dwsExprs, dwsJScodeGen;
type
TDMJSCodeGenModule = class(TDataModule)
CodeGenLibModule: TdwsUnit;
procedure CodeGenLibModuleFunctionsRegisterSimpleCodeGenEval(
info: TProgramInfo);
procedure CodeGenLibModuleClassesCodeGenMethodsDependencyEval(
Info: TProgramInfo; ExtObject: TObject);
procedure CodeGenLibModuleClassesCodeGenMethodsNewUniqueGlobalVarEval(
Info: TProgramInfo; ExtObject: TObject);
procedure CodeGenLibModuleClassesCodeGenMethodsCustomDependencyEval(
Info: TProgramInfo; ExtObject: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
type
TCodeGenHelper = class helper for TProgramInfo
function Environment : TdwsJSCodeGenEnvironment;
end;
// Environment
//
function TCodeGenHelper.Environment : TdwsJSCodeGenEnvironment;
begin
Result:=(Execution.Environment.GetSelf as TdwsJSCodeGenEnvironment);
end;
procedure TDMJSCodeGenModule.CodeGenLibModuleClassesCodeGenMethodsCustomDependencyEval(
Info: TProgramInfo; ExtObject: TObject);
begin
Info.Environment.CodeGen.RegisterCustomDependency(Info.ParamAsString[0]);
end;
procedure TDMJSCodeGenModule.CodeGenLibModuleClassesCodeGenMethodsDependencyEval(
Info: TProgramInfo; ExtObject: TObject);
begin
Info.Environment.CodeGen.Dependencies.Add(Info.ParamAsString[0]);
end;
procedure TDMJSCodeGenModule.CodeGenLibModuleClassesCodeGenMethodsNewUniqueGlobalVarEval(
Info: TProgramInfo; ExtObject: TObject);
begin
Info.ResultAsString:=Info.Environment.CodeGen.NewUniqueGlobalVar(info.ParamAsString[0]);
end;
procedure TDMJSCodeGenModule.CodeGenLibModuleFunctionsRegisterSimpleCodeGenEval(
info: TProgramInfo);
begin
Info.Environment.RegisterIntercept(info.ParamAsString[0], info.ParamAsString[1], info.Params[2]);
end;
end.