Skip to content

Commit cf83877

Browse files
author
ownit
committed
优化代码
1 parent 1670193 commit cf83877

File tree

4 files changed

+40
-43
lines changed

4 files changed

+40
-43
lines changed

Makefile.win

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ CC = gcc.exe -D__DEBUG__
66
WINDRES = windres.exe
77
OBJ = src/Parser.o src/Base.o src/PyObj.o src/ExprAST.o src/main.o src/Scanner.o src/objhandler/PyBoolHandler.o src/objhandler/PyFloatHandler.o src/objhandler/PyIntHandler.o src/objhandler/PyFuncHandler.o src/objhandler/PyTupleHandler.o src/objhandler/PyDictHandler.o src/objhandler/PyStrHandler.o src/objhandler/PyClassHandler.o src/objhandler/PyClassInstanceHandler.o src/objhandler/PyModHandler.o src/SPython.o src/Util.o src/objhandler/PyCommonHandler.o src/objhandler/PyListHandler.o
88
LINKOBJ = src/Parser.o src/Base.o src/PyObj.o src/ExprAST.o src/main.o src/Scanner.o src/objhandler/PyBoolHandler.o src/objhandler/PyFloatHandler.o src/objhandler/PyIntHandler.o src/objhandler/PyFuncHandler.o src/objhandler/PyTupleHandler.o src/objhandler/PyDictHandler.o src/objhandler/PyStrHandler.o src/objhandler/PyClassHandler.o src/objhandler/PyClassInstanceHandler.o src/objhandler/PyModHandler.o src/SPython.o src/Util.o src/objhandler/PyCommonHandler.o src/objhandler/PyListHandler.o
9-
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc -pg -g3
9+
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc -g3
1010
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"./include"
1111
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" -I"./include"
1212
BIN = spython.exe
13-
CXXFLAGS = $(CXXINCS) -Wall -pg -g3
14-
CFLAGS = $(INCS) -Wall -pg -g3
13+
CXXFLAGS = $(CXXINCS) -g3
14+
CFLAGS = $(INCS) -g3
1515
RM = rm.exe -f
1616

1717
.PHONY: all all-before all-after clean clean-custom

spython.dev

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ OverrideOutputName=spython.exe
2323
HostApplication=
2424
UseCustomMakefile=0
2525
CustomMakefile=
26-
CommandLine=pysrc/main.py
26+
CommandLine=test.py
2727
Folders=include,include/ext,include/objhandler,src,src/objhandler
2828
IncludeVersionInfo=0
2929
SupportXPThemes=0
30-
CompilerSet=2
31-
CompilerSettings=0000000000100000101000000
30+
CompilerSet=1
31+
CompilerSettings=0000000000000000001000000
3232
UnitCount=59
3333

3434
[VersionInfo]

spython.layout

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
[Editors]
2-
Order=51,10,50,52,57,34,9,8,36,35,2,5,1,11,12,58,38,7,6,20,26
3-
Focused=12
2+
Order=51,10,50,52,57,34,9,8,36,35,2,5,1,11,12,58,38,7,6,20,26,4
3+
Focused=6
44
[Editor_0]
55
CursorCol=1
66
CursorRow=243
77
TopLine=220
88
LeftChar=1
99
[Editor_1]
10-
CursorCol=36
11-
CursorRow=1422
12-
TopLine=1423
10+
CursorCol=32
11+
CursorRow=989
12+
TopLine=978
1313
LeftChar=1
1414
[Editor_2]
1515
CursorCol=1
1616
CursorRow=149
17-
TopLine=517
17+
TopLine=138
1818
LeftChar=1
1919
[Editor_4]
2020
CursorCol=1
2121
CursorRow=204
22-
TopLine=188
22+
TopLine=191
2323
LeftChar=1
2424
[Editor_5]
2525
CursorCol=1
@@ -32,14 +32,14 @@ CursorRow=43
3232
TopLine=24
3333
LeftChar=1
3434
[Editor_11]
35-
CursorCol=23
36-
CursorRow=67
37-
TopLine=51
35+
CursorCol=1
36+
CursorRow=44
37+
TopLine=30
3838
LeftChar=1
3939
[Editor_12]
40-
CursorCol=55
41-
CursorRow=166
42-
TopLine=147
40+
CursorCol=1
41+
CursorRow=479
42+
TopLine=475
4343
LeftChar=1
4444
[Editor_13]
4545
CursorCol=55
@@ -52,24 +52,24 @@ CursorRow=19
5252
TopLine=9
5353
LeftChar=1
5454
[Editor_6]
55-
CursorCol=77
56-
CursorRow=190
57-
TopLine=185
55+
CursorCol=1
56+
CursorRow=442
57+
TopLine=429
5858
LeftChar=1
5959
[Editor_7]
60-
CursorCol=23
61-
CursorRow=575
62-
TopLine=564
60+
CursorCol=1
61+
CursorRow=551
62+
TopLine=594
6363
LeftChar=1
6464
[Editor_8]
6565
CursorCol=1
66-
CursorRow=791
67-
TopLine=776
66+
CursorRow=95
67+
TopLine=75
6868
LeftChar=1
6969
[Editor_9]
7070
CursorCol=1
71-
CursorRow=229
72-
TopLine=218
71+
CursorRow=160
72+
TopLine=148
7373
LeftChar=1
7474
[Editor_15]
7575
CursorCol=74
@@ -87,9 +87,9 @@ CursorRow=21
8787
TopLine=1
8888
LeftChar=1
8989
[Editor_20]
90-
CursorCol=29
90+
CursorCol=1
9191
CursorRow=24
92-
TopLine=1
92+
TopLine=4
9393
LeftChar=1
9494
[Editor_17]
9595
CursorCol=16
@@ -192,9 +192,9 @@ CursorRow=38
192192
TopLine=21
193193
LeftChar=1
194194
[Editor_38]
195-
CursorCol=61
196-
CursorRow=210
197-
TopLine=195
195+
CursorCol=19
196+
CursorRow=157
197+
TopLine=145
198198
LeftChar=1
199199
[Editor_39]
200200
CursorCol=19
@@ -252,9 +252,9 @@ CursorRow=119
252252
TopLine=107
253253
LeftChar=1
254254
[Editor_50]
255-
CursorCol=1
256-
CursorRow=13
257-
TopLine=8
255+
CursorCol=8
256+
CursorRow=14
257+
TopLine=14
258258
LeftChar=1
259259
[Editor_51]
260260
CursorCol=19

src/ExprAST.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,11 @@ PyObjPtr& PowerAST::eval(PyContext& context){TRACE_EXPR();
8484
return merge->eval(context);
8585
}
8686
PyObjPtr& StmtAST::eval(PyContext& context){TRACE_EXPR();
87-
if (exprs.empty()){
88-
return context.cacheResult(PyObjTool::buildNone());
89-
}
90-
unsigned int i = 0;
91-
for (; i < exprs.size() - 1; ++i){
87+
size_t size = exprs.size();
88+
for (size_t i = 0; i < size; ++i){
9289
exprs[i]->eval(context);
9390
}
94-
return exprs[i]->eval(context);
91+
return context.cacheResult(PyObjTool::buildNone());
9592
}
9693

9794
PyObjPtr& PrintAST::eval(PyContext& context){TRACE_EXPR();

0 commit comments

Comments
 (0)